[6877] in Perl-Users-Digest
Perl-Users Digest, Issue: 502 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 20 02:28:08 1997
Date: Mon, 19 May 97 23:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 19 May 1997 Volume: 8 Number: 502
Today's topics:
Can anyone help with CMD32 error 2 ? <cahillp@topaz.cqu.edu.au>
Re: How could I do a wildcard search like real Search e (Tad McClellan)
Re: How to output special characters with PERL (Mike Stok)
Re: How to output special characters with PERL <rootbeer@teleport.com>
Re: idea for new for loop construct (Chipmunk)
Lotus Spread Sheet parser? (Evan Kirshenbaum)
Lotus Spreadsheet file parser (Evan Kirshenbaum)
Re: memory sharing between parent/child processes - Per <rootbeer@teleport.com>
Multiple ENDs in one file. (Abigail)
multiple finds to perl script <rosen@pfmc.net>
Re: multiple finds to perl script <rootbeer@teleport.com>
Re: multiple finds to perl script (Mike Stok)
Re: multiple finds to perl script (Mike Stok)
Re: Need Help with Perl Script Implementation for e-Mai <rootbeer@teleport.com>
Re: New draft of scripting white paper <joachim.durchholz@munich.netsurf.de>
News::NNTPCLient trouble with NEWNEWS (Danny Aldham)
pack bug? (Kevin Luster)
Re: Pattern matching question (Chipmunk)
Re: perl -e 'getpwuid 555;' ---> syntax error ? <rootbeer@teleport.com>
Re: Perl 5.003 and setuid <rootbeer@teleport.com>
perl4.036 to 5.003 code breaks <wart@ugcs.caltech.edu>
problem capturing data <poppy@khan.massart.edu>
Re: running a script from a script (Mike Stok)
SysV::* (was Re: Jack Shirazi?) <gbarr@ti.com>
Re: Updating dates of recurring events <rootbeer@teleport.com>
Re: While loops starting with "1"? (Abigail)
Re: While loops starting with "1"? <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 May 1997 15:36:43 +1000
From: Pat Cahill <cahillp@topaz.cqu.edu.au>
Subject: Can anyone help with CMD32 error 2 ?
Message-Id: <3381386B.52A163BF@topaz.cqu.edu.au>
When ever I try a system() call in my script which is called
from netscape, I get the error :
error creating cmd file (2)
Ive had a look in some of the FAQs and it appears to be a known problem
but how do I (is it possible) get around it?
I am using windows95 and the server is Alibaba.
The web browser is netscape communicator (but this doesnt seem to
matter)
any help is GREATLY appreciated
Pat
pat cahill <cahillp@topaz.cqu.edu.au>
------------------------------
Date: Mon, 19 May 1997 23:33:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How could I do a wildcard search like real Search engines do?
Message-Id: <ki9rl5.hi5.ln@localhost>
[ comp.lang.perl is not a newsgroup. Please don't post to non-existant
newsgroups. Trimmed from headers. ]
Brandon Wilkins (wilkins@digitaldaze.com) wrote:
: I am writing a database for a client and I need some advise on searching
: a parts list. What is happening is that the parts are listed as
: (Example:)
: 1N4001-1N4007
: 2W005G-2W10G
^^^ ^^ so, 2W08G should match or not match? ...
how about 2W8G ?
: Now how could I make it so if someone enters 1N4003 it will match the first
: example?
The Set::IntSpan module might be helpful.
: Is there a way to use the =~ /$keyword/i with a wildcard (ie: *
: )???
The asterisk character, when used in a regex, is not called a wildcard.
It does not match anything in a regex, as it does when used as
a wildcard in the shell.
It is a 'quantifier', it says how many of the *previous* thing
must be in the match. So it is an error to not have a "previous thing".
To get an effect like a wildcard in a regex, you use .*
The dot matches any character (except newline), and the asterisk says
it must match zero or more times.
-----
Anyway, to get to the question above:
/1N400.*/ would match the range above, but it would also match a bunch
of stuff that is not in that range:
eg: 1N400 1N4009 1N400abcdef 1N400199
/1N400[1-7](:?-|$)/ seems to work pretty good. But you need to know
(or calculate) how to write the regex to match the range. That's
a lot of work.
I'd use the perl module mentioned above instead...
: _ANY_ Would be appreciated Greatly,
Hope that helped.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 20 May 1997 02:20:06 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to output special characters with PERL
Message-Id: <5lr1om$gq8@news-central.tiac.net>
In article <3380f3e7.30106048@news1.pei.sympatico.ca>,
Dico Reyers <dico@peionline.com> wrote:
>Hello.
>
>I am writing a script in PERL that outputs special characters like "
>and ' to the HTML page. For example...
>
>
>print "<a href="./blabla.html">\n";
> ^ ^
>
>These little do-hickeys cause a problem? How do I fix this?
emailed too.
You can use \ to escape them e.g.
print "<a href=\"blabla.html\">\n";
or use perl's generalised quoting where qq lets you specify a character
(or pair of bracketing characters) as a douleb quote replacement for the
string (and q lets you do the same with single quotes) e.g.
print qq#<a href="blabla.html">\n#;
print qq(<a href="blabla.html">\n);
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Mon, 19 May 1997 19:37:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dico Reyers <dico@peionline.com>
Subject: Re: How to output special characters with PERL
Message-Id: <Pine.GSO.3.96.970519193144.12414S-100000@kelly.teleport.com>
On Tue, 20 May 1997, Dico Reyers wrote:
> I am writing a script in PERL that outputs special characters like "
> and ' to the HTML page. For example...
>
>
> print "<a href="./blabla.html">\n";
That's the same as saying this, since Perl can't tell what else you might
mean by a quoted quote mark.
print "<a href=" ./blabla.html "\n";
If you want to put a quote mark into a string, you can backslash it so
that it won't be special.
print "<a href=\"./blabla.html\">\n";
Or, you can use different quoting.
print qq{<a href="./blabla.html">\n};
Or you can represent the quote mark in other ways.
$doublequote = '"';
print "<a href=$quote./blabla.html$quote>\n";
print "<a href=\x22./blabla.html\x22>\n";
There are other ways as well, since the Perl motto is There's More Than
One Way to Do It. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 20 May 1997 01:40:43 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: idea for new for loop construct
Message-Id: <5lqver$l1b$2@dartvax.dartmouth.edu>
In article <33801F4B.C0A71BF9@ssil.uoregon.edu>
Trenton Lipscomb <trenton@ssil.uoregon.edu> writes:
> I think
> for(10 x)
> is a naturaly way of saying "repeat this ten times" and should be
It might be better to have a new reserved word instead of using for.
For example, 'repeat (EXPRESSION) BLOCK' could mean:
evaluate EXPRESSION, convert it to an int, execute BLOCK that many
times.
Chipmunk
------------------------------
Date: 20 May 1997 02:20:58 GMT
From: evan@poirot.hpl.hp.com (Evan Kirshenbaum)
Subject: Lotus Spread Sheet parser?
Message-Id: <5lr1qa$bq7@hplms2.hpl.hp.com>
I need to write a script to generate a form, and I just found out that
the input data is distributed as a Lotus spreadsheet (a ".wk4" file),
which is a rather cryptic binary format.
I would really rather not have to find the spec and figure out how to
parse it if someone else has already done so. There doesn't appear to
be anything in CPAN, but I thought that someone else might have found
themselves in a similar situation, bitten the bullet, and be willing
to share their solution.
Any pointers will be appreciated.
------------------------------
Date: 20 May 1997 02:22:44 GMT
From: evan@poirot.hpl.hp.com (Evan Kirshenbaum)
Subject: Lotus Spreadsheet file parser
Message-Id: <5lr1tk$bqg@hplms2.hpl.hp.com>
I need to write a script to generate a form, and I just found out that
the input data is distributed as a Lotus spreadsheet (a ".wk4" file),
which is a rather cryptic binary format.
I would really rather not have to find the spec and figure out how to
parse it if someone else has already done so. There doesn't appear to
be anything in CPAN, but I thought that someone else might have found
themselves in a similar situation, bitten the bullet, and be willing
to share their solution.
Any pointers will be appreciated.
--
Evan Kirshenbaum +------------------------------------
HP Laboratories |Yesterday I washed a single sock.
1501 Page Mill Road, Building 1U |When I opened the door, the machine
Palo Alto, CA 94304 |was empty.
| Peter Moylan
kirshenbaum@hpl.hp.com
(415)857-7572
http://www.hpl.hp.com/personal/Evan_Kirshenbaum/
------------------------------
Date: Mon, 19 May 1997 19:06:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Simon Kitching <simonk@telebusiness.co.nz>
Subject: Re: memory sharing between parent/child processes - Perl internals knowledge needed
Message-Id: <Pine.GSO.3.96.970519185934.12414K-100000@kelly.teleport.com>
On 19 May 1997, Simon Kitching wrote:
> I have a Perl program which initialises lots of large data structures on
> startup. The process then forks a child to handle client application
> requests (ie standard client-server stuff) as required.
> It all works fine, but I am concerned by the lack of memory sharing
> between the parent and child processes. The system was carefully
> designed so that lots of "read-only" data structures were initialised in
> the parent process - these pages should be shared by all the child
> processes.
In general, I don't think you can do that in Perl. AFAIK, there's no way
to make perl use shared memory for variables, read only or otherwise.
On the other hand, you could implement what you want with a tied hash
which could get the data from another process. There are some ideas in
perlipc(1) that might help. Good luck!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 20 May 1997 03:58:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Multiple ENDs in one file.
Message-Id: <EAGoDF.91s@nonexistent.com>
#!/usr/local/bin/perl -w
BEGIN {print "begin 1\n";}
BEGIN {print "begin 2\n";}
END {print "end 1\n";}
END {print "end 2\n";}
__END__
The above program gives:
begin 1
begin 2
Subroutine END redefined at /nfs1/home/abigail/xx.pl line 7.
end 2
end 1
Yet, Camel II says on page 283:
``You may have multiple END blocks within a file -- they will
execute in reverse order of definitions; that is: last in,
first out (LIFO)''
I like to have END routines that clean up the mess at the places
the mess is created (but while it possibly may be used later, so
I have to delay it till the end.)
Is this a bug in perl 5.003, is the Camel II wrong or incomplete,
or am I doing something which I shouldn't do?
And why does -w warn about multiple ENDs, yet multiple BEGINs
are allowed?
Abigail
------------------------------
Date: Mon, 19 May 1997 18:01:33 -0400
From: Michael Rosen <rosen@pfmc.net>
Subject: multiple finds to perl script
Message-Id: <3380CDBD.5B35@pfmc.net>
Dear Perl Helpers,
I have a shell script with multiple finds to chmod various
files and directories. This is some beating of the disk. Could
you please help me write a perl script that would be smoother and
quieter and faster. I am just beginning to learning perl and
would appreciate you help as I need to get this up and running.
Thank you,
Michael
#!/bin/sh
echo 'Now running '$0 (SEE NOTE BELOW)
date
echo 'changing directory to '$1
cd $1
echo 'changing ownership to '$2' with group '$3
find . -exec chown $2.$3 {} \;
echo 'changing file modes'
find . -perm 0640 -exec chmod 660 {} \;
find . -perm 0600 -exec chmod 660 {} \;
find . -perm 0644 -exec chmod 660 {} \;
find . -perm 0664 -exec chmod 660 {} \;
echo 'changing directory modes'
find . -perm 0755 -exec chmod 770 {} \;
find . -perm 0750 -exec chmod 770 {} \;
find . -perm 0744 -exec chmod 770 {} \;
find . -perm 0700 -exec chmod 770 {} \;
find . -type d -exec chmod 770 {} \;
echo 'changing directory group mode'
find . -type d -exec chmod g+s {} \;
chmod 400 .rhosts .cshrc
date
NOTE: another file provides the values of the variables $0 - $3
because we are running this monster script on a number
of computers, one after the other.
Can I use find2perl ?
------------------------------
Date: Mon, 19 May 1997 18:58:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Rosen <rosen@pfmc.net>
Subject: Re: multiple finds to perl script
Message-Id: <Pine.GSO.3.96.970519185126.12414J-100000@kelly.teleport.com>
On Mon, 19 May 1997, Michael Rosen wrote:
> I have a shell script with multiple finds to chmod various
> files and directories. This is some beating of the disk.
I'll say... :-)
> find . -perm 0640 -exec chmod 660 {} \;
> find . -perm 0600 -exec chmod 660 {} \;
> find . -perm 0644 -exec chmod 660 {} \;
> find . -perm 0664 -exec chmod 660 {} \;
> echo 'changing directory modes'
> find . -perm 0755 -exec chmod 770 {} \;
> find . -perm 0750 -exec chmod 770 {} \;
> find . -perm 0744 -exec chmod 770 {} \;
> find . -perm 0700 -exec chmod 770 {} \;
> Can I use find2perl ?
Yes! Yes! A thousand times yes! :-)
The easiest way may be to simply have it find every file and directory.
Then, check the mode (using whatever rule you need) and chmod if needed.
Maybe something like this.
$mode = (stat $_)[2] & 0777;
if (-f _) {
chmod 660, $_ if ($mode & 0713) == 0600; # ???
} elsif (-d _) {
chmod 770, $_ if ($mode & 0722) == 0700; # ???
} else {
# ignore
}
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 20 May 1997 02:15:48 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: multiple finds to perl script
Message-Id: <5lr1gk$ggk@news-central.tiac.net>
In article <3380CDBD.5B35@pfmc.net>, Michael Rosen <rosen@pfmc.net> wrote:
>Dear Perl Helpers,
>
>
> I have a shell script with multiple finds to chmod various
>
>files and directories. This is some beating of the disk. Could
>
>you please help me write a perl script that would be smoother and
>
>quieter and faster. I am just beginning to learning perl and
>
>would appreciate you help as I need to get this up and running.
>Can I use find2perl ?
You might want to use the File::Find module to make one pass over the tree
and do what's needed - this might be something to start from:
#!/usr/local/bin/perl -w
use strict;
use File::Find;
use vars qw/$dir $owner $group/;
($dir, $owner, $group) = @ARGV; # should check these...
find (\&doWork, $dir);
sub doWork {
my $name = $File::Find::name;
my $mode = (stat $name)[2] & 0777;
if (-f _) {
print "processing file $name\n";
chown $owner, $group, $name or warn "couldn't chown $name ($!)\n";
if ($mode == 0640 or $mode == 0600) { # etc
chmod 0660, $file or warn "couldn't chmod $name ($!)\n";
}
}
elsif (-d _) {
print "processing dir $name\n";
# etc
}
}
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 20 May 1997 02:24:25 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: multiple finds to perl script
Message-Id: <5lr20p$h7p@news-central.tiac.net>
In article <5lr1gk$ggk@news-central.tiac.net>,
Mike Stok <mike@stok.co.uk> wrote:
>sub doWork {
> my $name = $File::Find::name;
>
> my $mode = (stat $name)[2] & 0777;
> if (-f _) {
> print "processing file $name\n";
> chown $owner, $group, $name or warn "couldn't chown $name ($!)\n";
> if ($mode == 0640 or $mode == 0600) { # etc
> chmod 0660, $file or warn "couldn't chmod $name ($!)\n";
^^^^^
That should be $name, I changed from $file to $name as it was a more
accurate name if we were processing directories :-( Of course I forgot
to test it after doing the edit!
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Mon, 19 May 1997 18:45:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Webmaster(SB)" <kwire@icsi.net>
Subject: Re: Need Help with Perl Script Implementation for e-Mail .HTM Form
Message-Id: <Pine.GSO.3.96.970519183818.12414F-100000@kelly.teleport.com>
On Mon, 19 May 1997, Webmaster(SB) wrote:
[ Snipped: explanation about installing a canned script, and getting an
error from the webserver upon running it. ]
> I'm sure there's a problem with the .CGI script, but I am not a Unix or
> Perl expert and need some help.
Okay, but you're not going to like it. :-)
This is a lot like saying, "I bought a used car, and now it won't go.
What's wrong?" In this case, you need a software mechanic who can check it
out and maybe to fix it. Maybe you're just out of gas, or maybe the engine
fell out ten miles back; we can't tell from here.
If you'd like to learn Perl, I can recommend some good books. After that,
you can see about learning CGI programming. Somewhere along the way,
you'll probably find out what's not working.
In the meantime, when you're having trouble with a CGI program in Perl,
you should first look at the please-don't-be-offended-by-the-name Idiot's
Guide to solving such problems. It's available on the perl.com web pages.
Hope this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 19 May 1997 20:11:51 +0000
From: Joachim Durchholz <joachim.durchholz@munich.netsurf.de>
Subject: Re: New draft of scripting white paper
Message-Id: <VA.000000eb.0069155e@herold>
> the interpreter. The tcl interpreter does not define language
> statements, only language structure. Statements and procedures are
> the
> same in tcl. With the tcl 'proc' command you can add a new statement
> (you can also do this with 'c'). To demonstrate this, you can add an
> 'until' statment to tcl with a four or five lines of tcl in a 'proc'
> command (you could also use 'c'). 'until' does the same thing as
> 'while'
> except that the logic inverted. I don't think you can do this kind of
> thing with /bin/sh or anything derived from it. You can't do it with
> c or c++, pascal, ... etc, etc.
It's true you can't, and occasionally I missed some statements (in any
of these languages).
However, I don't consider opening up everything to redefinition
fruitful. If such language extension features are widely used, the end
result is that each programmer creates his own dialect that only he and
nobody else can read or maintain.
I guess this effect contributes to the supposed write-only character of
tcl (I don't know tcl, but I've seen some FORTH).
> Another interesting feature of tcl is that it has no operators (in
> particular, no replacement statement ). This eliminates the problem
> of type-matching that is endemic to languages that use the replacement
> statement.
Sorry, this is simply not true. If a programming language has any
functionality, be it operators, functions, macros, or whatever, you need
to check wether the parameters match the respective expected types.
(Substitute "behaviour" for "type" if you are a Smalltalker, and "can be
processed by the operator/function/whatever" if you are using a typeless
language.) That check might be done by the compiler, the run-time
system, or by the routines themselves (checking parameter validity), but
it must be done to avoid bugs passing routine boundaries.
> I think using the '=' sign in a replacement statement came
> to programming because people thought that, since computers do
> arithmetic, we should program the same way we do mathematics.
Yes. Though some languages (especially those in the tradition of Pascal)
use := to make the difference clear, and to emphasize the asymmetry.
Regards,
-Joachim
---
Please don't send unsolicited ads.
------------------------------
Date: 19 May 1997 21:45:00 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: News::NNTPCLient trouble with NEWNEWS
Message-Id: <5lra8c$ma1$1@hendrix.postino.com>
I have just started using the News::NNTPCLient module, and have tried
the example out of the man page as below:
#!/usr/local/bin/perl -w
require News::NNTPClient ;
$c = new News::NNTPClient("hendrix.postino.com") ;
foreach ($c->newnews("test", time - 3600)) {
print $c->body($_);
}
__END__
This gives me an error: NNTPERROR: 500 "NEWNEWS" not implemented; try "help".
I am running Inn1.5.1 , and do have a test newsgroup.
--
Danny Aldham SCO Ace, MCSE www.postino.com
------------------------------
Date: 19 May 1997 20:54:34 -0700
From: kluster@goth.engr.sgi.com (Kevin Luster)
Subject: pack bug?
Message-Id: <5lr79q$lcp@goth.engr.sgi.com>
I'm seeing this problem on a variety of OS/Chips from Perl 4.036
up to Perl 5.003 (wasn't able to test it on 5.004)
Under Irix/MIPS, for example,
perl -e "printf( pack("f", 1201.177383))" | od -x
0000000 4496 ad00
0000003
Which is wrong. The correct answer is "4496 25ad". Aside from changes
in byte ordering, the same result happens with NetBSD/Intel, and
SunOS/Sparc.
Am I missing something here?
--
Kevin Luster | Silicon Graphics MS-880
Consumer Group | 2011 N. Shoreline Blvd
kluster@sgi.com | Mountain View, Ca. 94043
------------------------------
Date: 20 May 1997 01:33:00 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Pattern matching question
Message-Id: <5lqv0c$l1b$1@dartvax.dartmouth.edu>
In article <5lp2u6$drl@chronicle.concentric.net>
ddougal@concentric.net (David Dougal) writes:
> Here is the output: element 1 is t0123456787
> found a lost
>
> The output should have been: element 1 is t0123456787
> found a tie
> ...
> # match the l character followed by any digits
> } elsif ($array[count] =~ /^l\d*/) {
> print ("found a lost\n");
> # match the t character followed by any digits
> } elsif ($array[count] =~ /^t\d*/) {
> print ("found a tie\n");
> } else {
Is this the actual code you're using? You've left out the $ in $count
in these two elsifs.
I don't think that would cause the problem you're having, though...
Chipmunk
------------------------------
Date: Mon, 19 May 1997 18:50:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Buck Huppmann <buck@genetics.uiowa.edu>
Subject: Re: perl -e 'getpwuid 555;' ---> syntax error ?
Message-Id: <Pine.GSO.3.96.970519184948.12414I-100000@kelly.teleport.com>
On 19 May 1997, Buck Huppmann wrote:
> $ perl -we 'getpwnam "foo";'
>
> Number found where operator expected at -e line 1, near "getpwuid 555"
Fixed in the imminent version 5.004. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 19 May 1997 19:20:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Q. Wade Billings" <blitz@axxis.com>
Subject: Re: Perl 5.003 and setuid
Message-Id: <Pine.GSO.3.96.970519190824.12414M-100000@kelly.teleport.com>
On Mon, 19 May 1997, Q. Wade Billings wrote:
> I changed the permissions of /usr/bin/perl to include the setuid bit,
NO! NO! NO! Don't do that! Turn off that bit AT ONCE. Just type this in
(from even a non-root account) and it should do the trick.
/usr/bin/perl -e 'chmod 0755, "/usr/bin/perl"'
Then you should stop and think about what you've done, and why you've
gotten me so upset. If I sound like I'm scolding you, that's because I am.
I usually say "Hope this helps", but that seems woefully inadequate at
this point. Well, I still hope it helps.
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 19 May 1997 18:36:39 -0700
From: Wart <wart@ugcs.caltech.edu>
Subject: perl4.036 to 5.003 code breaks
Message-Id: <33810027.41C67EA6@ugcs.caltech.edu>
I ran into this problem and didn't see anything in the
incompatibilities list that described it. What is wrong
with it?
The following is a perl program that worked with 4.036 and
then broke in 5.003 with the message:
"Modification of a read-only value attempted at adjlw.pl line 5, <STDIN>
chunk 1"
when given the input "3 setlinewidth\n"
Here is the program:
#!/usr/local/bin/perl
while(<STDIN>) {
if (m/([0-9])+\s+setlinewidth/) {
$1 && ($width = --$1);
s/[0-9]\s+setlinewidth/$width setlinewidth/;
}
print;
}
--Wart
------------------------------
Date: Mon, 19 May 1997 10:52:56 -0400
From: poppy <poppy@khan.massart.edu>
Subject: problem capturing data
Message-Id: <Pine.LNX.3.95.970519104855.763B-100000@khan.massart.edu>
while using the perl telnet library to log into
my portmaster...I've run into the problem where
by assigning data into an array, I keep getting
the command prompt in my array and not the data
which is fed-back...my perl looks like...
@data = $connect->cmd("set console");
Do I need to set a time out or something???
Has anyone evr set up anything like this before?
Thanks.
poppy
sys/net admin
Mass College of Art
------------------------------
Date: 20 May 1997 02:26:36 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: running a script from a script
Message-Id: <5lr24s$hms@news-central.tiac.net>
In article <864077683.5297@dejanews.com>, <liamtu@echonyc.com> wrote:
>I need to get the result of a perl script for use in a perl script... when
>I open the file in perl I just get the script text. I know there must be a
>simple answer.
You could say @outputLines = `script`; or open the script as a pipe e.g.
open SCRIPT, "script |" or die "open failed ($!)\n";
while (defined ($line = <SCRIPT>)) {
...
}
close SCRIPT or die "close failed ($!)\n";
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Tue, 20 May 1997 06:40:57 +0100
From: Graham Barr <gbarr@ti.com>
To: perl5-porters@perl.org
Subject: SysV::* (was Re: Jack Shirazi?)
Message-Id: <33813969.B8D7E2D3@ti.com>
Well it would seem that Jack has disappeared, so does anyone use
Jack's SysV modules as I would like to re-work them into objects,
but I do not want to screw anyone up
Jarkko Hietaniemi wrote:
>
> I was just asked (or actually my side personality cpan-adm@ftp.funet.fi)
> about Jack Shirazi and a module of his. He seems to have disappeared
> from the reach of email and web. (and dejanews shows up only Graham Barr
> asking the 7th of this May where Jack might be...) Anybody know more?
--
Graham Barr <gbarr@ti.com>
There is no ultimate answer.
Only more revealing ways of looking at the question.
------------------------------
Date: Mon, 19 May 1997 18:47:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jay Allen <allenjs@nic.techops.lmco.com>
Subject: Re: Updating dates of recurring events
Message-Id: <Pine.GSO.3.96.970519184612.12414G-100000@kelly.teleport.com>
On Mon, 19 May 1997, Jay Allen wrote:
> I've got the comparison of dates done, so that leaves my
> question: Has anyone written a script to do this?
> I know it's possible and probably been done, so I don't want to
> have to reinvent the wheel.
Then you'll certainly want to use one of the many Date modules from CPAN,
since CPAN is the repository for Perl wheels. Hope this helps!
http://www.perl.org/CPAN/
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 20 May 1997 01:59:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: While loops starting with "1"?
Message-Id: <EAGIvp.1Cx@nonexistent.com>
On Mon, 19 May 1997 21:43:56 +0200, Markus Schlegel wrote in
comp.lang.perl.misc URL: news:3380AD7C.249BD411@ibm.net:
++ Hello everyone,
++
++ I recently saw a strange construct, looking like this:
++
++ # put commas in the right places in an integer
++
++ 1 while s/ (\d) (\d\d\d) (!?\d)/($1,$2);
++
++ (From "programming Perl", O'Reilly)
++
++
++ My question here is: Is the "1" in this line used as a
++ boolean, and if so, why is this legal, since this doesn't
++ look conform to any "while" statement I have used so far.
++
++ (Another case of cryptic shorthand here, perhaps).
Indeed. Perl allows 2 forms of a while:
- The `traditional while': while (expression) BLOCK
(and in Perl, a BLOCK always contains {})
- Or: statement while expression;
The latter can be written as the former:
while (expression) {statement},
and the former can be written as the latter:
do BLOCK while expression;
Hence
1 while s/ (\d) (\d\d\d) (!?\d)/($1,$2);
is equivalent to:
while (s/ (\d) (\d\d\d) (!?\d)/($1,$2)) {1;}
`1' is just used as it's a very simple statement (you have to have
a non-empty statement).
It becomes less cryptic if you realize that you can do the same
trick with if:
if ($x < 5) {print "Foo!\n";}
can also be written as:
print "Foo!\n" if $x < 5;
which almost looks "natural".
There is also a vague resemblence with Pascal's REPEAT/UNTIL sequence:
REPEAT
1;
UNTIL too_bad_pascal_does_not_have_regexs;
++ Any help would be appreciated, also on what code around this
++ to read from and write back the substitution to a file
++ might look like.
Hmm, I'm not quite sure what you are asking here.
Abigail
------------------------------
Date: Mon, 19 May 1997 19:22:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Markus Schlegel <markus@ibm.net>
Subject: Re: While loops starting with "1"?
Message-Id: <Pine.GSO.3.96.970519192057.12414N-100000@kelly.teleport.com>
On Mon, 19 May 1997, Markus Schlegel wrote:
> 1 while s/ (\d) (\d\d\d) (!?\d)/($1,$2);
> Is the "1" in this line used as a boolean,
No; it's just a dummy statement. The compiler optimizes that loop to be
something like this.
while (condition) {
# Do nothing
}
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 502
*************************************