[19697] in Perl-Users-Digest
Perl-Users Digest, Issue: 1892 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 8 18:05:57 2001
Date: Mon, 8 Oct 2001 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1002578708-v10-i1892@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 8 Oct 2001 Volume: 10 Number: 1892
Today's topics:
Re: binmode with "perl -p" doesn't work (Abigail)
bulk user creation on Linux <mg@netops.de>
Re: CGI form email oddness - not acting as expected <loki_the_fiddler@hotmail.com>
changing time to different format (Michael R. Fox)
Re: changing time to different format (Mark Jason Dominus)
Filename case... <brian@brianracer.com>
Re: Filename case... <jurgenex@hotmail.com>
Re: Full-Time Perl programmer <dha@panix.com>
Re: How to run perl under bash not sh <invalid@nowhere.com>
Re: How to run perl under bash not sh <tony_curtis32@yahoo.com>
Re: integer division <novastar@novastar.dtdns.net>
Looking for sample scripts using SSH (and Telnet).... <jnj@pobox.com>
Re: Looking for sample scripts using SSH (and Telnet).. <djberge@qwest.com>
Need help - pragmatic modules not available (RoJo)
Re: Need help - pragmatic modules not available (Andrew J. Perrin)
perl module for 32-bit encryption <jkumar@atrenta.com>
size of an object? (F. Xavier Noria)
Re: Stop Transversal of a Directory... the dot dot prob (BUCK NAKED1)
Re: use strict my $foo = ""; Bug? (David R. Throop)
Re: What good is "\G" in a regular expression? <novastar@novastar.dtdns.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Oct 2001 21:55:04 GMT
From: abigail@foad.org (Abigail)
Subject: Re: binmode with "perl -p" doesn't work
Message-Id: <slrn9s4858.pns.abigail@alexandra.xs4all.nl>
John Lin (johnlin@chttl.com.tw) wrote on MMCMLX September MCMXCIII in
<URL:news:a73bcad1.0110071923.280bb9b@posting.google.com>:
'' Malcolm Dew-Jones wrote
'' > : John Lin wrote:
'' > : >So, do you think my proposal of "perl -b" switch for binmode is considerable?
'' > This identical problem and the identical suggested solution have been
'' > discussed in the past, so maybe work has already been done and could be
'' > found if you search in the right place. (I have no idea where the "right
'' > place" would be.)
''
'' In addition, I would also propose a "perl -g" switch for "glob pre-processing".
'' For example, in UNIX platforms:
''
'' perl -e "print @ARGV" *.pl *.txt *.cpp
''
'' The OS will do globbing first then pass the list to perl.
'' But some platforms (such as Win32) won't. On Windows, people have to write
''
'' perl -e "BEGIN { @ARGV = map {glob} @ARGV } print @ARGV" *.pl *.txt *.cpp
It's not a Unix vs. Windows issue. Globbing done by the shell. Some
of the shells that do globbing work fine under Windows.
'' If we have "-g" option, which is a short hand for
''
'' BEGIN { @ARGV = map {glob} @ARGV }
''
'' then the orginal script can still apply
''
'' perl -ge "print @ARGV" *.pl *.txt *.cpp
''
'' thus, helps the portability of scripts on those non-UNIX platforms.
'' What do you think about it?
Tell me, how should the user *not* do globbing? How do make a program
that's portable this way? It looks like some platforms "need" the -g,
while others don't. That's not very portable.
'' Has this problem and suggested solution also been discussed in the past?
'' If not, I am willing to work on it.
Yes. It was generally shot down as fast as possible.
The best solution is to install a proper shell on the platforms you
talk about.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Mon, 8 Oct 2001 20:21:21 +0200
From: "Milan Göllner" <mg@netops.de>
Subject: bulk user creation on Linux
Message-Id: <9psqje$jqtvt$1@ID-28578.news.dfncis.de>
All,
first of all I'm new to Perl and new to Linux System Administration.
I need to create a script to create 100+ Users from a file to be
used as Proftp Users. I was thinking of using something like this:
-- snip --
system("useradd -u $USER_ID -m -d /home/ftpusers/$USER_NAME -g
$USER_GROUP -s /usr/bin/passwd $USER_NAME");
-- /snip --
to create the Users. This of course will leave all new accounts
disabled and everyone trying to acctually log onto the box to be
kicked to passwd in order for them to change their passwords (which
is good since they are only supposed to do FTP).
Adding this:
-- snip --
-p $PASSWORD
-- /snip --
ought to add a password for every user. This password is added as
plain text into /etc/shadow. Am I correct in presuming that using
Crypt::DES to encrypt $PASSWORD will insert a valid password into
/etc/shadow?
I'm asking because the box the script is supposed to run on is not
being cooperative when I'm trying to install Crypt::DES - I'd like
to make sure that this is the right way to go. If this is the wrong
way could someone please tell me where to RTFM or maybe even post
some cute bit of code to solve my problem?
Thanks in advance,
Milan Goellner
------------------------------
Date: Mon, 8 Oct 2001 21:40:11 +0100
From: "The Mechnics" <loki_the_fiddler@hotmail.com>
Subject: Re: CGI form email oddness - not acting as expected
Message-Id: <k6ow7.39738$GT3.5137316@news2-win.server.ntlworld.com>
isn't RCPT TO: the cc field?
It's MAIL TO: I think, which is the SMTP for the destination.
I guess your sendmail can't find who to send the original to, but is
sending the copies.
Send mail just pipes the text file to the SMTP port (25) on the mail server
to:,cc:,bcc: aren't in SMTP (can't remember which RFC protocol it is) and
are exploded by the mail client not the server.
Do it the hard way.
Try telneting to the smtp server on port 25 and type helo then help.
eg.
telnet SMTP-Server-IP 25
B¬)
did this to solve a similar problem once where some one used MAIL-FROM in
Mabry mail extensions which really was REPLY TO:
"Jennifer" <jennlee.2@eudoramail.com> wrote in message
news:e836199f.0110050453.325739d0@posting.google.com...
> > What makes you think they may be Perl related as opposed to
> > application-domain related? I would have thought that even with near
> > zero Perl or SMTP knowledge it should have been possible to figure out
> > that these were likely to be SMTP issues not Perl ones.
>
> Sorry, I guess I figured I could start there because all the code I
> was using was in Perl, and there could have been something wrong with
> the Perl code. If not, as was the case apparently, a lot of Perl
> programmers have probably done programming related to SMTP and I
> figured maybe someone would be nice enough to give me some advice on
> that if so.
>
> Its sometimes difficult to pinpoint an issue between several
> technologies and I certainly didn't mean to step on any toes by
> posting. Maybe, in retrospect, I didn't start in the best place, but
> people are certainly free to ignore the posting if they feel it isn't
> relevant.
>
> > Again this has nothing to do with Perl. The reason it looks OK to you
> > is again related to your lack of knowledge of SMTP. The HELO command
> > takes a manatory parameter.
>
> Thanks for the parameter info. I had done some searching on the web
> and many of the examples I found had a parameter but I didn't see
> anything on being mandatory - this was why I assumed what was coded
> was 'OK'. Glad to know better now.
>
> > The code is not acting as expected because the expectation is based on
> > misconceptions about SMTP. This, as I said, has nothing to do with
Perl.
>
> And yet, you responded, despite it not actually being about Perl.
> Thanks for the info. Have a nice day ;-)
>
> Jennifer
------------------------------
Date: 08 Oct 2001 14:35:42 -0400
From: mrf4u@node5.unix.Virginia.EDU (Michael R. Fox)
Subject: changing time to different format
Message-Id: <y7bfvghqught.fsf@node5.unix.Virginia.EDU>
In my perl script I have a variable, $1, that contains a string like:
8:30:00 This is the hour, minute, and second.
I would like to convert this string into a format like:
8.5 This would be the decimal format of the time. Are there any builtin functions that are capable of doing this? If not, what would be the best way to do this?
Thanks,
Michael
------------------------------
Date: Mon, 08 Oct 2001 20:19:44 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: changing time to different format
Message-Id: <3bc20a5f.ddd$17@news.op.net>
In article <y7bfvghqught.fsf@node5.unix.Virginia.EDU>,
Michael R. Fox <mrf4u@node5.unix.Virginia.EDU> wrote:
>In my perl script I have a variable, $1, that contains a string like:
>8:30:00 This is the hour, minute, and second.
>
>I would like to convert this string into a format like:
>8.5
Try:
my ($h, $m, $s) = split /:/, $1;
$decimal_time = $h + $m/60 + $s/3600;
>Are there any builtin functions that are capable of doing this?
Nothing built in. Well, I guess if you really wanted you could use
the standard Time::Local module in the following rather bizarre way:
# Job Security
$decimal_time = timegm(reverse(split/:/, $t), 1,0,70) / 3600;
But that doesn't seem to be simpler.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Mon, 08 Oct 2001 20:53:23 GMT
From: "Brian Racer" <brian@brianracer.com>
Subject: Filename case...
Message-Id: <7now7.87578$ME2.13936841@typhoon.kc.rr.com>
What I need to do is in certain directories(unix), change every filename
that has any upper-case letters to a filename with only lower-case
charactors. I am somewhat new to perl (would perl even be the best tool for
this?) and I just have no idea how to go about doing this. Any help will be
greatly appreciated!!!
Brian Racer
brian@brianracer.com
------------------------------
Date: Mon, 8 Oct 2001 14:24:35 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Filename case...
Message-Id: <3bc21994@news.microsoft.com>
"Brian Racer" <brian@brianracer.com> wrote in message
news:7now7.87578$ME2.13936841@typhoon.kc.rr.com...
> What I need to do is in certain directories(unix),
File::find
perldoc -f glob
> change every filename
perldoc -f rename
> that has any upper-case letters to a filename with only lower-case
> charactors.
perldoc -f lc
> I am somewhat new to perl (would perl even be the best tool for
> this?)
Well, could just as easily be done in pretty much any Shell-script language
(sh, bash, ...)
jue
------------------------------
Date: 8 Oct 2001 19:19:03 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: Full-Time Perl programmer
Message-Id: <slrn9s3v17.mj1.dha@panix2.panix.com>
dell wrote:
> Full-Time Perl programmer wanted with a flare for writing CGI's.
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
You also seem to have misspelled "flair". Just FYI.
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"We're dumber than squirrels. We hear voices and do what they
command. I have broccoli in my socks." - Dilbert's boss
------------------------------
Date: Mon, 08 Oct 2001 19:09:32 GMT
From: Larry Alkoff <invalid@nowhere.com>
Subject: Re: How to run perl under bash not sh
Message-Id: <dnt3stc0aklqkej3j3ap0rum339ebocro8@4ax.com>
nobull@mail.com wrote:
> Larry Alkoff <invalid@nowhere.com> writes:
>
> > My question is actually very much on topic in this newsgroup
> > and has nothing to do with bash.
>
> You are, of course, right. So why did you ask a different question?
Apparently perl starts up under sh. How can I get it to start under bash so
perl can use my aliases?
> > It has to do with how is perl called and what shell(s) it uses
> > internally.
>
> Yep, the question you meant to ask was: "How do I control what shell
> Perl uses in system/backticks/open?"
You are correct but I didn't know enough about perl to phrase it that way.
> AFAIK you can't (not on Unix anyhow - ISTR there's a registry entry in
> Windows).
>
> But you can change:
> system($command)
> to:
> system('/bin/bash','-c',$command)
> (and so on).
#!/usr/bin/perl -w
# lba: so - scrolled output as a perl script by David Efflandt
my $cmd=join" ",@ARGV;
system('/bin/bash','-c', '$cmd | less ');
After weeding out more error msgs I am left with this error:
/bin/bash ELF: command not found
I'd guess it's a misplaced backtick or something.
Can you help me?
Larry
--
Larry Alkoff N2LA
My address is: larryalk is_at mindspring dot com
------------------------------
Date: Mon, 08 Oct 2001 14:32:00 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to run perl under bash not sh
Message-Id: <87vghqnd1r.fsf@limey.hpcc.uh.edu>
>> On Mon, 08 Oct 2001 19:09:32 GMT,
>> Larry Alkoff <invalid@nowhere.com> said:
> nobull@mail.com wrote:
>> Larry Alkoff <invalid@nowhere.com> writes:
>>
>> > My question is actually very much on topic in this
>> newsgroup > and has nothing to do with bash.
>>
>> You are, of course, right. So why did you ask a
>> different question?
> Apparently perl starts up under sh. How can I get it to
> start under bash so perl can use my aliases?
perl starts up under perl. perl doesn't really care what
the invoking process is, be it a shell or something else.
If you start a new process from within perl e.g. via
system() then that new process runs through the Bourne
shell (if it requires shell metacharacter parsing.
"perldoc -f system" says what those conditions are).
You need to use the non-shell version of system(), make it
invoke a new bash shell and run the command from within
that sub-process, as nobull indicated.
hth
t
--
Whoops, I've said too much. Smithers, use the amnesia ray...
------------------------------
Date: Mon, 8 Oct 2001 23:38:20 +0200
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Re: integer division
Message-Id: <9pt2r8$qbf$1@usenet.otenet.gr>
This is a multi-part message in MIME format.
------=_NextPart_000_001D_01C15052.5011D1D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
with ActiveState perl v6.1 build 629 the result is 11.5 How it could be =
different , what version and platform do you have ?
"Zimmen Gnauh" <yah00204052@yahoo.com> wrote in message =
news:3BC108E1.736EB0CB@yahoo.com...
$a1=3D1150=20
$a2=3D100=20
$quotient=3D$a1/$a2=20
the result is 11.50. What change has to be made to obtain 11?
------=_NextPart_000_001D_01C15052.5011D1D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#cdecf5>
<DIV><FONT face=3DArial size=3D2>with ActiveState perl v6.1 build 629 =
the result is=20
11.5 How it could be different , what version and platform do you have=20
?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Zimmen Gnauh" <<A=20
href=3D"mailto:yah00204052@yahoo.com">yah00204052@yahoo.com</A>> =
wrote in=20
message <A=20
=
href=3D"news:3BC108E1.736EB0CB@yahoo.com">news:3BC108E1.736EB0CB@yahoo.co=
m</A>...</DIV> =20
$a1=3D1150 <BR> $a2=3D100 <BR> $quotient=3D$a1/$a2=20
<CENTER>the result is 11.50. What change has to be made to obtain=20
11?</CENTER></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_001D_01C15052.5011D1D0--
------------------------------
Date: Mon, 8 Oct 2001 16:37:39 -0400
From: "JNJ" <jnj@pobox.com>
Subject: Looking for sample scripts using SSH (and Telnet)....
Message-Id: <ts43kltgbuhd3f@corp.supernews.com>
I am looking for a couple of scripts that utilize SSH to connect to devices
and execute commands. Nothing fancy really -- just a decent example I could
look at before I start working with it. For that matter, I could use some
that utilize Telnet as well.
Any references most appreciated.....
James
jnj@pobox.com
------------------------------
Date: Mon, 8 Oct 2001 15:59:39 -0500
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: Looking for sample scripts using SSH (and Telnet)....
Message-Id: <Koow7.406$MO6.225342@news.uswest.net>
"JNJ" <jnj@pobox.com> wrote in message
news:ts43kltgbuhd3f@corp.supernews.com...
> I am looking for a couple of scripts that utilize SSH to connect to
devices
> and execute commands. Nothing fancy really -- just a decent example I
could
> look at before I start working with it. For that matter, I could use some
> that utilize Telnet as well.
>
> Any references most appreciated.....
>
> James
> jnj@pobox.com
>
For ssh, see Benjamin Trott's Net::SSH::Perl. (at search.cpan.org).
For telnet see Net::Telnet (included with your distro probably)
The docs for both include some very straightforward examples.
Regards,
Mr. Sunblade
------------------------------
Date: Mon, 08 Oct 2001 18:27:28 GMT
From: rojo@mindspring.com (RoJo)
Subject: Need help - pragmatic modules not available
Message-Id: <3bc1ee26.180850198@news.mindspring.com>
I registered a domain name, bought the entry-level web hosting package
at Mindspring (now Earthlink), and bought O'Reilly's Programming Perl,
all so I could learn Perl. It's been going very well, by the way,
with occasional help from you guys in this newsgroup. But I'm on a
shoestring budget.
Per Mindspring tech sup, I am using v5.004_04 of Larry Wall's Perl on
their web server, but to my surprise, the pragmatic modules are not
available! (or at least not installed) Now that I've done the
research to find out who Larry Wall is (the daddy of Perl !!), I am
dumbfounded why a version he released would not include the pragma.
It does have the standard modules, thank goodness. I need the pragma
because I do not have telnet access and cannot run scripts (like a
compile). When I have a syntax error, the browser just says "The page
cannot be displayed". Thankfully, so far, I've eventually figured
them out via ActivePerl which I'm running on my Windows 2000
Professional workstation and calls to Mindspring tech sup.
Aside of the compiler aids, I'd like the assistance of "use lib" in
subroutine communication. Since that's not available, I had to place
modules for several different apps in the same directory, just so I
could access their packages. I'm also part analyst, so I'm trying to
make this a textbook OO learning experience. So those modules BELONG
in different directories.
I've thought of one alternative so far. Are the pragmatic modules for
version 5.004_04 available for download, and if I placed them in one
of my own directories, would I then be able to use them? Any other
ideas? Remember I'm a novice, with less that a month of part-time
Perl programming (but 23 years of I.T. experience analysis &
development, mostly analysis). As usual, I'd appreciate any and all
help in this matter.
Ron (rojo@mindspring.com)
------------------------------
Date: 08 Oct 2001 15:55:17 -0400
From: aperrin@email.unc.edu (Andrew J. Perrin)
Subject: Re: Need help - pragmatic modules not available
Message-Id: <87itdpaouy.fsf@hm269-26876.socsci.unc.edu>
rojo@mindspring.com (RoJo) writes:
> Per Mindspring tech sup, I am using v5.004_04 of Larry Wall's Perl on
> their web server, but to my surprise, the pragmatic modules are not
> available! (or at least not installed)
Therein lies your problem(s):
1.) 5.004_04 is rather old at this point; you should be using 5.6.1,
or if you must stay with the 5.0 level you should use the latest of
that, 5.005_03.
2.) Even 5.004_04 came with the pragma modules; if they're not
installed that's the system administrator's screw-up.
> [...] I need the pragma
> because I do not have telnet access and cannot run scripts (like a
> compile).
This is a very painful way to learn perl. Try learning it on a
workstation to which you do have access. And, in general, don't do
business with a web host that won't even give you access to the error logs.
--
----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
------------------------------
Date: Mon, 08 Oct 2001 12:14:30 -0700
From: Jayakumar Mundunuri <jkumar@atrenta.com>
Subject: perl module for 32-bit encryption
Message-Id: <3BC1FB16.2FB77A8@atrenta.com>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi !!
<p>Can you guys suggest me modules available for 32-bit symmetric
encryption??
<p>Thanks in advance..
<p>jay</html>
------------------------------
Date: 8 Oct 2001 20:14:15 GMT
From: fxn@retemail.es (F. Xavier Noria)
Subject: size of an object?
Message-Id: <9pt1en$5lhmg6@news1s.iddeo2.es>
We have a structure consisting of a reference to a hash, whose values
can be references to hashes, references to arrays, or scalars, and
this follows down for some levels. (Is the object that constructs the
module XML::Simple if you know it.)
Is there a way to know its size in memory?
-- fxn
------------------------------
Date: Mon, 8 Oct 2001 13:53:54 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Stop Transversal of a Directory... the dot dot problem
Message-Id: <572-3BC1F642-184@storefull-244.iap.bryant.webtv.net>
[same person as whataman@home.com]
I apologize to people in both computer.lang.perl.misc. and
computer.security unix groups. I attempted to cross-post for the first
time, and shouldn't have. I made a mess of things, not realizing that
when posters replied that if they weren't careful they would also
crosspost; and that's what happened. I learned my lesson about
cross-posting... it's a bad idea.
> (Benjamin=A0Goldberg) wrote:
> If you unzip first, then the user's files
> will end up going wherever [including to > your home directory,
possibly], and only > those files whose names were 'ok' will
> end up in wkdir... the 'bad' ones will
> escape!
Yes, I realize that. That's why I posted in comp.security.unix that I
was going to list files first, and *then* unzip, according to a list.
> #!/usr/local/bin/perl -w
> use strict;
> use Archive::Zip ();
> use Carp ();
> Archive::Zip::setErrorHandler(
> \&Carp::croak ); my $zip =3D
> Archive::Zip->new($ARGV[0]);
> print "Zip file $ARGV[0] has
> comment:\n" . =A0 $zip->zipfileComment . > "\n" if
$zip->zipfileComment;
> foreach my $member ($zip->members) {
=A0=A0=A0=A0=A0=A0=A0=A0local $_ =3D my $name =3D
> $member->fileName;
=A0=A0=A0=A0=A0=A0=A0=A0if(=A0tr[~/][]=A0||=A0m[^\.\./]=A0||=A0m[/\.\./]
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0warn "Member '$_' has
cooties. > Skipping it.\n";
=A0=A0=A0=A0=A0=A0=A0=A0next;
=A0=A0=A0=A0=A0=A0=A0=A0}
>=A0=A0=A0=A0=A0=A0=A0=A0print "Zip file member $name has comment:\n" .
=A0 =A0 =A0
> $member->fileComment . "\n" if
> $member->fileComment;
>=A0=A0=A0=A0=A0=A0=A0=A0print "Extracting '$name' to 'wkdir/$name'\n";
=A0
> $member->extractToFileNamed( "wkdir/$name" );
> }
__END__
Thanks for that example, but I'd rather use GNU *unzip* and hopefully
have the same solution to use with *tar*.
Regards,
--Dennis
------------------------------
Date: 8 Oct 2001 15:01:06 -0500
From: throop@cs.utexas.edu (David R. Throop)
Subject: Re: use strict my $foo = ""; Bug?
Message-Id: <9pt0m2$k8i$1@yojo.cs.utexas.edu>
In article <9nifpe$m68$02$1@news.t-online.com>,
Steffen Müller <tsee@gmx.net> wrote:
>"James Gilbert" <jgrg@sanger.ac.uk> schrieb im Newsbeitrag
>news:3B9CB627.B1333E63@sanger.ac.uk...
>>
>> A new programmer who has just started working
>> for me had this piece of code:
>>
>> use strict
>>
>> my $foo = "";
I'm with James. It's a bug. Any undocumented aspect of a language
that invites a very hard to track down unexpected behavior and doesn't
issue a warning is a bug.
David Throop
------------------------------
Date: Tue, 9 Oct 2001 00:14:56 +0200
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Re: What good is "\G" in a regular expression?
Message-Id: <9pt4vs$rja$1@usenet.otenet.gr>
reply to a FAQ , haha this is my first time ! anyway could not simply :
while (<>){ chomp;
print "number: $1\n" if /(\d+)\b/g;
print "word: $1\n" if /(\w+)/g;
print "space: $1\n" if /(\s+)/g;
print "other: $1\n" if /([^\w\d]+)/g; }
"PerlFAQ Server" <faq@denver.pm.org> wrote in message
news:Fxbw7.1032$Owe.387419136@news.frii.net...
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
>
> +
> What good is "\G" in a regular expression?
>
> The notation "\G" is used in a match or substitution in conjunction
with
> the "/g" modifier to anchor the regular expression to the point just
> past where the last match occurred, i.e. the pos() point. A failed
match
> resets the position of "\G" unless the "/c" modifier is in effect.
"\G"
> can be used in a match without the "/g" modifier; it acts the same
(i.e.
> still anchors at the pos() point) but of course only matches once and
> does not update pos(), as non-"/g" expressions never do. "\G" in an
> expression applied to a target string that has never been matched
> against a "/g" expression before or has had its pos() reset is
> functionally equivalent to "\A", which matches at the beginning of the
> string.
>
> For example, suppose you had a line of text quoted in standard mail
and
> Usenet notation, (that is, with leading ">" characters), and you want
> change each leading ">" into a corresponding ":". You could do so in
> this way:
>
> s/^(>+)/':' x length($1)/gem;
>
> Or, using "\G", the much simpler (and faster):
>
> s/\G>/:/g;
>
> A more sophisticated use might involve a tokenizer. The following
> lex-like example is courtesy of Jeffrey Friedl. It did not work in
5.003
> due to bugs in that release, but does work in 5.004 or better. (Note
the
> use of "/c", which prevents a failed match with "/g" from resetting
the
> search position back to the beginning of the string.)
>
> while (<>) {
> chomp;
> PARSER: {
> m/ \G( \d+\b )/gcx && do { print "number: $1\n";
redo; };
> m/ \G( \w+ )/gcx && do { print "word: $1\n";
redo; };
> m/ \G( \s+ )/gcx && do { print "space: $1\n";
redo; };
> m/ \G( [^\w\d]+ )/gcx && do { print "other: $1\n";
redo; };
> }
> }
>
> Of course, that could have been written as
>
> while (<>) {
> chomp;
> PARSER: {
> if ( /\G( \d+\b )/gcx {
> print "number: $1\n";
> redo PARSER;
> }
> if ( /\G( \w+ )/gcx {
> print "word: $1\n";
> redo PARSER;
> }
> if ( /\G( \s+ )/gcx {
> print "space: $1\n";
> redo PARSER;
> }
> if ( /\G( [^\w\d]+ )/gcx {
> print "other: $1\n";
> redo PARSER;
> }
> }
> }
>
> but then you lose the vertical alignment of the regular expressions.
>
> -
>
> Documents such as this have been called "Answers to Frequently
> Asked Questions" or FAQ for short. They represent an important
> part of the Usenet tradition. They serve to reduce the volume of
> redundant traffic on a news group by providing quality answers to
> questions that keep coming up.
>
> If you are some how irritated by seeing these postings you are free
> to ignore them or add the sender to your killfile. If you find
> errors or other problems with these postings please send corrections
> or comments to the posting email address or to the maintainers as
> directed in the perlfaq manual page.
>
> Answers to questions about LOTS of stuff, mostly not related to
> Perl, can be found by pointing your news client to
>
> news:news.answers
>
> or to the many thousands of other useful Usenet news groups.
>
> Note that the FAQ text posted by this server may have been modified
> from that distributed in the stable Perl release. It may have been
> edited to reflect the additions, changes and corrections provided
> by respondents, reviewers, and critics to previous postings of
> these FAQ. Complete text of these FAQ are available on request.
>
> The perlfaq manual page contains the following copyright notice.
>
> AUTHOR AND COPYRIGHT
>
> Copyright (c) 1997-1999 Tom Christiansen and Nathan
> Torkington. All rights reserved.
>
> This posting is provided in the hope that it will be useful but
> does not represent a commitment or contract of any kind on the part
> of the contributers, authors or their agents.
>
> 06.19
> --
> This space intentionally left blank
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 1892
***************************************