[7557] in Perl-Users-Digest
Perl-Users Digest, Issue: 1183 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 16 00:47:29 1997
Date: Wed, 15 Oct 97 21: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 Wed, 15 Oct 1997 Volume: 8 Number: 1183
Today's topics:
Re: 'Insecure dependency in unlink while running with - (Faust Gertz)
Re: 'Insecure dependency in unlink while running with - (Ilya Zakharevich)
Re: 2000 time problem (Keith Thompson)
Re: [Q]: cgi/perl: Location (Martien Verbruggen)
Re: An SMTPD in Perl <rra@stanford.edu>
Re: An SMTPD in Perl <kjj@pobox.com>
Any plans for Min and Max operators? <Brett.W.Denner@lmtas.lmco.com>
Re: Any plans for Min and Max operators? (Tad McClellan)
Re: Any plans for Min and Max operators? (Jahwan Kim)
Re: Bulk email solution needed that works with Linux, P (Brad Knowles)
Re: Can someone look at this and tell me why it doesn't (Kevin Connery)
Re: CGI scripts to access client hard drives (Martien Verbruggen)
Re: Date::Manip (Michael Fuhr)
Re: How do I skip \, in a split /,/ <rick.delaney@shaw.wave.ca>
Re: How do I skip \, in a split /,/ (Jeremy D. Zawodny)
Re: HTTP Connect with PROXY? (Martien Verbruggen)
Re: Need a good perl guy for short project: shopping ca (Toutatis)
Re: open() missing line (Martien Verbruggen)
Re: Perl support (Faust Gertz)
Re: Tab delimited fields (Toutatis)
Re: the oddest syntax error (Kevin Connery)
Trouble Installing modules <as6f@cs.virginia.edu>
Unable to create sub named "" error msg <vincent.joseph@usa.net>
Re: We're targets. (Martien Verbruggen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Oct 1997 01:07:13 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: 'Insecure dependency in unlink while running with -T switch'
Message-Id: <344767b8.2826165@news.wwa.com>
On 15 Oct 97 at 17:31, a person wrote:
> You ever find out anything more about this error?
> I'd like to hear it.
>
>>The following is a bit of code from a larger CGI script that seems to
>>cause an 'Insecure dependency in unlink while running with -T switch'
>>error.
>>
>>:#!/usr/local/bin/perl -Tw
>>:use strict;
>>:$ENV{'PATH'} = '/user/bin:/bin'; # Set PATH for the kids
>>:my ($STATE_DIR) = './STATES/state.'; # Set place for state maintaining files
>>:
>>:&clean_up;
>>:
>>:exit (0);
>>:
>>:sub clean_up {
>>:
>>:# Iterate over the $STATE_DIR glob (state maintaining files begin with 'state.'),
>>:# if the file hasn't been modified in over a day, delete it or warn.
>>:
>>: for (glob ("$STATE_DIR*")) { (-M $_ < 1) || unlink || warn "$0 is having trouble deleting $_: $!" }
>>:}
>>
No one ever responded. I guess I should have said "N3W GUY N33D$
H31P!!!" :-) I figured it out. Apparently the values returned from
a glob are considered tainted. So, if you want to use them for
something like unlink, you need to "untaint" them. A working version
of that subroutine is below. A script in which I used this subroutine
can be found in <34451dd6.1774901@news.wwa.com>, entitled 'Re: Back
button work-around'.
:#!/usr/local/bin/perl -Tw
:use strict;
:$ENV{'PATH'} = '/user/bin:/bin'; # Set PATH for the kids
:my ($STATE_DIR) = './STATES/state.'; # Set place for state maintaining files
:
:&clean_up;
:
:exit (0);
:
:sub clean_up {
:
:# Iterate over the STATE_DIR glob (state maintaining files begin with 'state.'),
:# if the file hasn't been modified in over a day, delete it or warn.
:
:for (glob ("$STATE_DIR/state.*")) {
: /^($STATE_DIR\/state\.[\da-fA-F]{12}\.\d+)$/;
: (-M $1 < 1) || unlink $1 || warn "$0 is having trouble deleting $1: $!";
:}
:}
If the problem is not that you didn't expect glob values to be
considered tainted, but that you don't know how to "untaint' a
variable, read the following from the _The World Wide Web Security
FAQ_
(http://www.genome.wi.mit.edu/WWW/faqs/wwwsf5.html#Q47).
>Q47: How do I "untaint" a variable?
>
>Once a variable is tainted, Perl won't allow you to use it in a system(), exec(), piped open, eval(), backtick command, or any
>function that affects something outside the program (such as unlink). You can't use it even if you scan it for shell metacharacters
>or use the tr/// or s/// commands to remove metacharacters. The only way to untaint a tainted variable is by performing a pattern
>matching operation on it and extracting the matched substrings. For example, if you expect a variable to contain an e-mail address,
>you can extract an untainted copy of the address in this way:
>
> $mail_address=~/([\w-.]+\@[\w-.]+)/;
> $untainted_address = $1;
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: 16 Oct 1997 01:42:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 'Insecure dependency in unlink while running with -T switch'
Message-Id: <623re7$3of$1@agate.berkeley.edu>
(Repost...)
In article <344767b8.2826165@news.wwa.com>, Faust Gertz <faust@wwa.com> wrote:
> > $mail_address=~/([\w-.]+\@[\w-.]+)/;
> > $untainted_address = $1;
Anybody knowing the author of these immortal patterns? What do you
think [\w-.] would do?
perl -Dr
did not help (even with jumbo patch... :-().
Well, tracing it in C debugger shows that `-' is indeed non-metachar.
However, reading the docs does not expose this fact, the only chunk I
noticed
You may use C<\w>, C<\W>,
C<\s>, C<\S>, C<\d>, and C<\D> within character classes (though not as
either end of a range).
is not very helpful, and contains a misprint ;-).
Ilya
------------------------------
Date: 16 Oct 1997 01:19:43 GMT
From: kst@king.cts.com (Keith Thompson)
Subject: Re: 2000 time problem
Message-Id: <876964783.519984@wagasa.cts.com>
James Ludlow (ludlow@us.ibm.com) wrote:
> The function localtime() returns the year minus 1900. So, if your
> computer thinks that it's 2050, it's going to return 150 as the year.
Correct.
> A simple way to avoid this would be to subtract 100 if the year is > 99.
A simpler and better way is to add 1900, which gives you a proper
4-digit year.
(You may also run into problems with years >= 2038, when Unix's 32-bit
signed time type overflows; I don't know how or whether this affects
Win32 Perl.)
--
Keith Thompson (The_Other_Keith) kst@cts.com <*>
^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
San Diego, California, USA
"Simba, you have forgotten me. I am your father. This is CNN." -- JEJ
------------------------------
Date: 16 Oct 1997 02:42:00 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q]: cgi/perl: Location
Message-Id: <623uto$mfp$5@comdyn.comdyn.com.au>
In article <344516DF.6850@cisco.com>,
Ganesan Ramu <rganesan@cisco.com> writes:
> A server gives an URL to its client and the client has to open the
> URL with a *new* browser window.
This is not a perl question. Your question is about the HTTP protocol,
HTML and possibly JavaScript.
Try one of the comp.infosystems.www.* groups.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: 15 Oct 1997 16:55:43 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: An SMTPD in Perl
Message-Id: <m3sou2bmyo.fsf@windlord.Stanford.EDU>
Joseph Turian <XturianX@fas.harvard.edu> writes:
> How exactly would I go about writing a server? If the answer in RTFM,
> which FM? I have RFC 821, but what FM is there for writing a server in
> general?
Stevens. _Unix Network Programming_.
Also, read lots of existing code of SMTP servers and servers in general.
There are some good examples in the perlipc man page.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 15 Oct 1997 18:15:01 -0700
From: Kevin Johnson <kjj@pobox.com>
Subject: Re: An SMTPD in Perl
Message-Id: <m2sou2qzi8.fsf@pobox.com>
Joseph Turian <XturianX@fas.harvard.edu> writes:
> I was interested in writing a no-frills smtpd that would merely
> receive local mail and reject anything else. For fun, I thought that
> it would be cool to write the thing in Perl.
> How exactly would I go about writing a server? If the answer in
> RTFM, which FM? I have RFC 821, but what FM is there for writing a
> server in general? Like for, example, I never would have imagined
> without anyone having told me that when a server receives a
> connection that it should fork.
Don't forget to check rfc1123. It has updates to rfc821.
--
thx,
kjj@pobox.com http://www.pobox.com/~kjj/
------------------------------
Date: Tue, 14 Oct 1997 10:04:40 -0500
From: "Brett W. Denner" <Brett.W.Denner@lmtas.lmco.com>
Subject: Any plans for Min and Max operators?
Message-Id: <Pine.SGI.3.95.971014100214.13444C-100000@scourge>
Are there any plans for Min and Max operators in Perl? I'm thinking of
the >? and <? operators in gcc, which return the greater or lesser
of two scalars. For example,
$a = $b >? $c; # $a is set to $b if $b > $c, otherwise $c
$a = $b <? $c; # $a is set to $b if $b < $c, otherwise $c
Thanks,
Brett
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brett W. Denner Lockheed Martin TAS
Brett.W.Denner@lmtas.lmco.com P.O. Box 748
(817) 935-1144 (voice) Fort Worth, TX 76101
(817) 935-1212 (fax) MZ 9333
------------------------------
Date: Wed, 15 Oct 1997 19:27:17 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Any plans for Min and Max operators?
Message-Id: <51n326.8pi.ln@localhost>
Brett W. Denner (Brett.W.Denner@lmtas.lmco.com) wrote:
: Are there any plans for Min and Max operators in Perl?
I doubt it. We don't need it very badly.
: I'm thinking of
: the >? and <? operators in gcc, which return the greater or lesser
: of two scalars. For example,
: $a = $b >? $c; # $a is set to $b if $b > $c, otherwise $c
$a = $b > $c ? $b : $c;
: $a = $b <? $c; # $a is set to $b if $b < $c, otherwise $c
$a = $b < $c ? $b : $c;
Much more flexible. We can put arbitrarily complex expressions in
there, why limit ourselves to only > and < ?
We seem to be running out of the valuable resource of syntactic
elements. I would not want to spend any on something that is
already easy to do.
;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
no longer posts from that @lmtas.lmco.com domain ;-)
------------------------------
Date: 16 Oct 1997 03:39:02 GMT
From: jahwan@supernova.math.lsa.umich.edu (Jahwan Kim)
Subject: Re: Any plans for Min and Max operators?
Message-Id: <slrn64b32m.6n3.jahwan@supernova.math.lsa.umich.edu>
On Wed, 15 Oct 1997 19:27:17 -0500, Tad McClellan <tadmc@flash.net> wrote:
> Brett W. Denner (Brett.W.Denner@lmtas.lmco.com) wrote:
[snip]
What about adding functions, min and max?
print min $a,$b;
print max $a,$b,$c,$d;
Adding these wouldn't do any harm but hopefully tiny amount of good.
Jahwan
------------------------------
Date: Wed, 15 Oct 1997 22:04:49 -0400
From: brad@his.com (Brad Knowles)
Subject: Re: Bulk email solution needed that works with Linux, Perl
Message-Id: <brad-1510972204510001@brad.his.com>
In article <m2sou2so2x.fsf@desk.crynwr.com>, Russell Nelson
<nelson@crynwr.com> wrote:
> > We have a email subscription service for the users of one of our
> > client's websites. The user can specify the information which appears in
> > their email, which results in all the email contents being unique.
>
> Problems with sendmail are best solved by installing qmail.
> http://www.qmail.org.
You will notice that the largest "private subscription email" service
in the world (InfoBeat, was Mercury Mail) is *not* using QMail. They're
using sendmail, properly configured. I'd say that's a pretty big vote
against qmail in that kind of environment.
--
Brad Knowles <brad@his.com> <http://www.his.com/~brad/>
comp.mail.sendmail FAQ Maintainer Emeritus
The comp.mail.sendmail FAQ is now at <http://www.sendmail.org/faq/>
<http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0xE38CCEF1>
------------------------------
Date: 12 Oct 1997 19:47:58 -0700
From: keradwc@mustang.via.net (Kevin Connery)
Subject: Re: Can someone look at this and tell me why it doesn't work!!
Message-Id: <61s24u$iac@mustang.via.net>
In article <3441705f$1$senaxyva$mr2ice@news.alltel.net>,
<franklin@nospamingideas4you.com> wrote:
> foreach $CheckLog (@CheckLog) {
> ($PassFileName, $PassFile, $UserMaxLowDir) =
>split(/:/,$CheckLog);
> if ($PassFileName == $LogValue) {
> if ($PassFile==$PassValue) {
> $Logged=1;
> $BaseDir = $UserMaxLowDir;
> }
> }
> }
>
>The two if statements don't work. it just passes through them like it's
>not like thier not even there. --
>From the perlop man pages:
: Equality Operators
:
: Binary "==" returns true if the left argument is numerically equal to
: the right argument.
:
: Binary "eq" returns true if the left argument is stringwise equal to
: the right argument.
I can't be sure, but when I see variables "$...Name" and ==, I
tend to get suspicious. After all, if they ARE strings and non-blank
and not "0", all strings are _numerically_ equal.
There are two other things to try if this isn't the case; print
the variables immediately before the IF statements and confirm
that the data the if statements are getting is correct.
------------------------------
Date: 16 Oct 1997 02:40:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CGI scripts to access client hard drives
Message-Id: <623ur2$mfp$4@comdyn.comdyn.com.au>
(Please do not post to comp.lang.perl. comp.lang.perl is dead)
(Please only post questions about perl modules to comp.lang.perl.modules)
Crossposting to irrelevant groups is bad. Posting to irrelevant
groups, and crossposting to other irrelevant groups is even worse.
In article <876924534.6101@dejanews.com>,
praveen_s@trigent.com writes:
> I am looking for help on Perl CGI scripts or mechanisms to pop up a
> file dialog box, read the selected file which resides on the clients
> hard drive and pass the data to the server for processing. Can this
> be done using Perl and HTML only? (Without any client side
> scripting).
This is not a perl issue. This is a CGI issue. Try
comp.infosystems.www.* or something like that.
They will probably tell you that there is no way to do this. There are
a few Netscape or MSIE specific ways to have a client upload files to
your server, but there is no way in the world you can get a CGI
process to access a client's drive directly.
> This also holds good for saving, say a text file on the clients hard
> drive.
Hmmm.. Just think about this. If this was allowed, what sort of
security problems might it generate?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: 15 Oct 1997 18:36:27 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Date::Manip
Message-Id: <623nib$r29@flatland.dimensional.com>
Keywords: Date::Manip Perl Date
awm@luers.qosina.com (Aram Mirzadeh) writes:
> I'm trying to use Date::Manip to find 2 business days ago from today, I
> have:
>
> $time = (localtime); # Wed Oct 15 15:17:20 1997
>
> I need to find: Mon Oct 13 00:01:00 1997
>
> I tried using Date::Manip from CPAN, but the format seems to always come out
> wrong, when I try to reduce 2 business days from the date.
>
> Ex: 1997101300:01:00
What's wrong about that? It looks like the date you need -- just
use UnixDate to format it however you want.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 15 Oct 1997 20:45:57 -0400
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: How do I skip \, in a split /,/
Message-Id: <344563C5.A58BD23B@shaw.wave.ca>
Toutatis wrote:
> $line = 'xxxx,xx\,xx,xxxx'
> How do I split this line into three fields, omitting the escaped comma?
>
> --
split /\b,/, $line;How you would do the more generic case where the x's
weren't necessarily \w's, I have no idea. Anyone?
Rick.
------------------------------
Date: Thu, 16 Oct 1997 02:53:32 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: How do I skip \, in a split /,/
Message-Id: <3445816a.294873916@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Wed, 15 Oct 1997 20:45:57 -0400, Rick Delaney
<rick.delaney@shaw.wave.ca> wrote:
>Toutatis wrote:
>
>> $line = 'xxxx,xx\,xx,xxxx'
>> How do I split this line into three fields, omitting the escaped comma?
>>
>> --
>
>split /\b,/, $line;How you would do the more generic case where the x's
>weren't necessarily \w's, I have no idea. Anyone?
Depending what one means by "omit", maybe:
split(/[^x]\,/, $line);
or something to that effect. :-)
Jeremy
--
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: 16 Oct 1997 02:11:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: HTTP Connect with PROXY?
Message-Id: <623t49$mfp$1@comdyn.comdyn.com.au>
In article <6219lg$rop@examiner.concentric.net>,
"Byron Formwalt" <formwalt@concentric.net> writes:
> Can someone tell me how to connect to an HTTP server, when there is a fixed
> proxy that has to be used?
Use the LWP modules.
http://www.perl.com/CPAN/modules/00modlist.long.html
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: 16 Oct 1997 00:48:07 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Need a good perl guy for short project: shopping cart
Message-Id: <toutatis-ya023180001610970248080001@news.euro.net>
In article <344545fb.3275287@news.wwa.com>, faust@wwa.com wrote:
> On Wed, 15 Oct 1997 13:00:53 -0700, "Patrick Jia" <user@msn.com>
> wrote:
>
> > I have a "short project" for shopping cart & password entry log form.
> >Anyone intereested: $ 100-200 extra cash for you.
>
> So do you anticipate this project only about one or two hours? :-)
>
> Is there any consensus on whether we want to allow job related posts
> or if we should ask that they be redirected to
> misc.jobs.offered/contract or some other job newsgroup?
Yeah, for $200 I'll shove a shopping cart up his ass!
(For an extra $200, I'll use some lubricant)
--
Toutatis
------------------------------
Date: 16 Oct 1997 02:30:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: open() missing line
Message-Id: <623u81$mfp$2@comdyn.comdyn.com.au>
In article <Pine.SOL.3.95.971015120315.26290A-100000@b1.hkstar.com>,
Aldoliu Chan <chiyung@b1.hkstar.com> writes:
> TEST.DAT
> --------
> ABC
> DEF
> open(d, 'test.dat');
> while (<d>){ # This reads in a line (ABC) and stores it in $_
> $one=<d>; # This reads in the next line (DEF) -> $one
> $two=<d>; # This reads in the next line (undef!) -> $two
> }
> close(d);
> print "ONE=$one\n";
> print "TWO=$two\n";
If you are certain that you always have two lines, just don't use the
while loop.
open(IN, 'test.dat') or die "Cannot open file: $!";
$one = <IN> or die "No first line";
$two = <IN> or die "No second line";
close(IN);
print "ONE=$one\nTWO=$two\n";
Although I would probably store the stuff in an array, then look at
the length:
open(IN, 'test.dat') or die "Cannot open file: $!";
@in_array = <IN>;
close(IN);
die "Illegal file length" unless (@in_array == 2);
print "ONE=$in_array[0]\nTWO=$in_array[1]\n";
One advice, which you might already have deduced from my code:
Use LOTS of error checking. It will make your life as a programmer
about a thousandfold easier. Sure, it's a bit more coding, but a lot
less debugging.
Also: use perl with the -w flag, and use the strict pragma. The
combination of the two of those would have told you that you were
using undefined variables.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: Wed, 15 Oct 1997 23:37:52 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Perl support
Message-Id: <3445529f.5349859@news.wwa.com>
On 15 Oct 1997 16:07:08 -0400, phanly@panix.com (Patrick Hanly) wrote:
>Does anyone know of a company that provides professional quality support
>for perl?
Did you try
http://search.yahoo.com/bin/search?p=perl&y=n&e=17280&f=0%3A8101%3A9243%3A17006%3A17280&r=Business+and+Economy%02Companies%02Computers%02Consulting
>I know a company named Cygnus used to but upon contacting them I found
>that they no longer work with perl.
I noticed the Perl Clinic had an ad in the Perl Journal.
tel: +44.1483.424424
fax: +44.1483.419419
email: perl-support-info@perl.co.uk or Tim.Bunce@ig.co.uk
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: 16 Oct 1997 00:08:10 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Tab delimited fields
Message-Id: <toutatis-ya023180001610970208080001@news.euro.net>
In article <Pine.GSO.3.96.971015180910.1617A-100000@clark.net>,
<gbh@middlemarch.net> wrote:
> How can I read a tab delimited database line by line,
> and store the fields into backreferences? I'm trying
> to do something like:
>
> while (<tab.delimited.file>) {
> m/(field_1)(field_2).../;
> ...
> }
>
> What would be the correct syntax for the second line?
Don't match on the fields, match on the delimiter:
open (F,'tab.delimited.file') or die '*$#@!, ',\l$!;#;-)
while (<F>){
chop;
push @data,[split /\t+/];
}
or if you prefer a hash of arrayrefs:
while (<F>){
chop;
@data = split /\t+/;
foreach (qw(field1 field2 field3)){
push @{$data{$_}},shift @data;
}
}
close (F);
If that's what you mean with 'backreferences'.
--
Toutatis
------------------------------
Date: 12 Oct 1997 19:39:46 -0700
From: keradwc@mustang.via.net (Kevin Connery)
Subject: Re: the oddest syntax error
Message-Id: <61s1li$huu@mustang.via.net>
In article <344148AD.42449036@nospam.erols.com>,
Kenneth Taborek <oberon@nospam.erols.com> wrote:
>I have encountered an error which I cannot come to terms with. The
>program below has been stripped of all extraneous lines. But, prior to
>paring it down, I had a small loop which printed the key-element pairs
>of %rot13, and it worked fine. Then I noticed that @temp2 should fall
>in range (a..m) instead of (a..n). When I made this change, I got the
>following syntax error.
>
>syntax error at ./thingy.pl line 12, near "if"
>Execution of ./thingy.pl aborted due to compilation errors.
When I ran this on MacPerl (5), it reported no syntax errors, but
there's a number of things you might want to do to get better information.
1. Tell us which version of perl on which OS
2. If it's unix, don't use "#! /usr/bin/perl"; take the space out:
"#!/usr/bin/perl"
There were also numerous warnings; you might want to put the other
variable back, and run perl with the -w switch. I got 9 warnings,
most unquoted strings, and variables only used once.
That said, you should probably examine the tr command; it'll do
what you're looking for much more easily, and without requiring
a character by character loop; tens-to-hundreds of times speed
improvement should result.
------------------------------
Date: Wed, 15 Oct 1997 20:58:40 -0400
From: Anish Singh <as6f@cs.virginia.edu>
Subject: Trouble Installing modules
Message-Id: <344566C0.3A21@cs.virginia.edu>
Hi
I'm trying to install perl modules in my $HOME/lib .I'm getting
the following error...
*****************************************************
Warning: You do not have permissions to install into /usr/cs/man/man3 at
/usr/cs/lib/perl5/ExtUtils/Install.pm line 57.
Installing /usr/cs/man/man3/./MIME::Base64.3
Installing /usr/cs/man/man3/./MIME::QuotedPrint.3
Cannot forceunlink
/usr/cs/contrib/share/perl5/site-perl/./MIME/Base64.pm: Permission
denied at /usr/cs/lib/perl5/File/Find.pm line 127
*** Error code 13
make: Fatal error: Command failed for target `pure_site_install'
******************************************************
Makefile.PL is to cryptic. I'm getting permission denied errors
despite setting PREFIX to $HOME/lib.
I had to edit the Makefile to get rid of most permission error.
I need HELP pretty desperately ( I hope somebody is reading !)
Thanks and Regds.
Anish ( anish@virginia.edu)
------------------------------
Date: Wed, 15 Oct 1997 19:37:37 -0400
From: Vincent Joseph <vincent.joseph@usa.net>
Subject: Unable to create sub named "" error msg
Message-Id: <344553C1.F62D2783@usa.net>
-hi,
I have a small server that tries to execute a program. If the server
gets a message from the client that has the format
ADDQ:arguments
it should execute a command with the passed in arguments.
For the sake of testing I am using 'ls' as the command.
However my server dies even though it successfully fulfills the
request.
I also tried using backticks to invoke the program - that failed.
While testing, I am not too concerned about the return value from
system.
The majority of the code has been picked from the Programming Perl (2ed)
book.(pg 349-350).
Error messages and code follow. I am running perl 5.002 on AIX 3.2.5
Any help would be appreciated. Thanks in advance.
-v
Here are the error/warning messages I get:
(Line 75 is in the sub executeProg ($rc=system($cmd));
Use of uninitialized value at tS.pl line 75, <CLIENT> chunk 1.
Use of uninitialized value at tS.pl line 75, <CLIENT> chunk 1.
Unable to create sub named "" at tS.pl line 75, <CLIENT> chunk 1.
And here is the code for the server:
#!/usr/local/bin/perl -ws
use Socket;
$|=1;
# Initializations/Variable declarations
$dir="";
$pid=$$;
$thisProg=$dir.$0;
$log="";
if ($DEBUG)
{
my $logFile=$dir."log";
$log=$logFile;
open($log,">$logFile");
}
my $port=shift || 14397;
my $protocol=getprotobyname('tcp');
my $paddr;
$SIG{CHLD}=\&REAPER;
socket(SERVER,PF_INET,SOCK_STREAM,$protocol) or die "socket: $!";
setsockopt(SERVER,SOL_SOCKET,SO_REUSEADDR,pack("l",1)) or die "sockopt:
$!";
bind(SERVER,sockaddr_in($port,INADDR_ANY)) or die "bind: $!";
listen(SERVER,SOMAXCONN);
&logit("Server started on port $port");
for(;$paddr=accept(CLIENT,SERVER);close CLIENT)
{
my($portc,$iaddrc)=sockaddr_in($paddr);
my $name=gethostbyaddr($iaddrc,AF_INET);
my $inmsg="";
&logit("Connect from $name [",inet_ntoa($iaddrc),"] at port
$portc");
$inmsg=<CLIENT>;
chomp($inmsg);
&logit("Content: $inmsg ");
my ($commd,$args)=split(":",$inmsg);
if ($commd eq "ADDQ")
{
my $retVal=executeProg($args);
print CLIENT "HEADER=STATUS=GOOD $retVal\n";
&logit("Sending: HEADER=STATUS=GOOD $retVal");
}
elsif ($commd eq "OVER")
{
print CLIENT "HEADER=STATUS=DEAD=CAUSE=$commd\n";
&logit("HEADER=STATUS=DEAD=CAUSE=$commd\n");
exit 0;
}
else
{
print CLIENT "HEADER=STATUS=BAD=CAUSE=$commd
UNSUPPORTED\n";
&logit("HEADER=STATUS=DEAD=CAUSE=$commd UNSUPPORTED\n");
}
&logit("Client serviced");
}
#Subroutine declarations
sub logit
{
print $log "$0 $$: @_ at ",scalar localtime,"\n";
1;
}
sub executeProg
{
my $args=$_[0];
my $cmd="/bin/ls $args";
&logit("$cmd");
my $rc=system("$cmd");
$rc;
}
------------------------------
Date: 16 Oct 1997 02:34:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: We're targets.
Message-Id: <623ugg$mfp$3@comdyn.comdyn.com.au>
In article <5b7mbeoqda.fsf@smokey.prismnet.com>,
mlehmann@prismnet.com (Mark A. Lehmann) writes:
> What are techniques that you are using to be able to effectively contribute
> to this news group and not be targeted for them e-trash? Is there another
> group that discusses anti-e-trash infiltration?
This is a regularly recurring discussion. The best thing I have ever done was
install a filter that chucks all the email that is not directed to me, or a few
mailing lists I am subscribed to. use procmail.
> Can we do something as a group to tell the companies searching for email
> address targets to stay out of our perl newsgroups?
Sure. Tell them. If you think people like Spamford listen to a polite request
not to spam you, try it. Until there is some worldwide legislation on this
issue, there is not much you can do. Sorry.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
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 1183
**************************************