[18376] in Perl-Users-Digest
Perl-Users Digest, Issue: 544 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 21 18:11:00 2001
Date: Wed, 21 Mar 2001 15:10:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985216222-v10-i544@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 21 Mar 2001 Volume: 10 Number: 544
Today's topics:
Re: persistent cookie working with Netscape4.7x, not IE <m.grimshaw@salford.ac.uk>
Re: persistent cookie working with Netscape4.7x, not IE <jhall@ifxonline.com>
Re: persistent cookie working with Netscape4.7x, not IE <m.grimshaw@salford.ac.uk>
Re: persistent cookie working with Netscape4.7x, not IE (Abigail)
Re: queue <michas@nospam.uni-jena.de>
reading in, writing out checkbox array <tomcat@visi.com>
Re: reading in, writing out checkbox array (Damian James)
Re: Script for mail forwarding? (Randal L. Schwartz)
Re: Script mysteriously erases file it's supposed to ap <ddunham@redwood.taos.com>
Re: Script mysteriously erases file it's supposed to ap <hayati@math.uiuc.edu>
Re: Thanks for hash; how to read command line arguments (Jim Kroger)
Re: Threaded Perl on FreeBSD <dan@tuatha.sidhe.org>
Re: user module install under Solaris 8 <elaine@chaos.wustl.edu>
Weird(?) magic word for sh to invoke perl under Linux <sun_tong_001@yahoo.com>
Re: Weird(?) magic word for sh to invoke perl under Lin <Michael@Heiming.de>
Re: Weird(?) magic word for sh to invoke perl under Lin (Bill Unruh)
Re: Weird(?) magic word for sh to invoke perl under Lin (Abigail)
Re: Why do "Learning Perl" Books Do This? A Subroutine lvirden@cas.org
Re: Why do "Learning Perl" Books Do This? A Subroutine lvirden@cas.org
Re: Why do "Learning Perl" Books Do This? A Subroutine <cwparker@alve.com>
Win32::ODBC::ColAttributes problem <jarojaro@delta.ds2.pg.gda.pl>
Words in a String variable (Daniel Wetzler)
Re: Words in a String variable (Craig Berry)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Mar 2001 19:42:09 +0000
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: persistent cookie working with Netscape4.7x, not IE5x?
Message-Id: <3AB90411.4B6F903F@salford.ac.uk>
Hi,
Hmm I must be stupid. Downloaded, untarred, chmodded +x, added require
'/path/cookie.lib' and end up with messages such as undefined subroutine
SetCookiePath etc.
John Hall wrote:
> I had similar problems until I started using the 'simple' cookie.lib that
> matt's script archive has:
>
> http://www.worldwidemart.com/scripts/
>
> I 'require' it, then all I have to do is this:
>
> &SetCookies('cookiename','cookieval')
>
> Also, check to make sure the exp date is far off.. [in the cookie.lib
> somewhere]
>
> $Cookie_Exp_Date = 'Wed, 08-Jun-2011 00:04:11 GMT';
>
> "Mark Grimshaw" <m.grimshaw@salford.ac.uk> wrote in message
> news:3AB8F65C.D8A430C8@salford.ac.uk...
> > Using the Set-Cookie header within a perl script, I can set and get
> > persistent cookies with Netscape.
> >
> > With IE5, I can set the cookie (i.e. I can see and read the cookie on my
> > client hard drive) but cannot get the cookie back.
> >
> > Netscape properly sends the HTTP_COOKIE environmental back to the perl
> > script from which I can retrieve the state information.
> >
> > IE5 does not sent HTTP_COOKIE at all.
> >
> > Any ideas?
> >
------------------------------
Date: Wed, 21 Mar 2001 19:51:47 GMT
From: "John Hall" <jhall@ifxonline.com>
Subject: Re: persistent cookie working with Netscape4.7x, not IE5x?
Message-Id: <nD7u6.55252$o7.2396198@news1.rdc1.sdca.home.com>
I think I may have had a problem with strict when calling a subroutine in
something that was 'require'd and not 'use'd..
The simple solution is to integrate the functions in that cookie.lib file
into your script..
The correct solution would probably be if I could remember how to get around
that strict problem.. which I can't.
"Mark Grimshaw" <m.grimshaw@salford.ac.uk> wrote in message
news:3AB90411.4B6F903F@salford.ac.uk...
> Hi,
>
> Hmm I must be stupid. Downloaded, untarred, chmodded +x, added require
> '/path/cookie.lib' and end up with messages such as undefined subroutine
> SetCookiePath etc.
>
> John Hall wrote:
>
> > I had similar problems until I started using the 'simple' cookie.lib
that
> > matt's script archive has:
> >
> > http://www.worldwidemart.com/scripts/
> >
> > I 'require' it, then all I have to do is this:
> >
> > &SetCookies('cookiename','cookieval')
> >
> > Also, check to make sure the exp date is far off.. [in the cookie.lib
> > somewhere]
> >
> > $Cookie_Exp_Date = 'Wed, 08-Jun-2011 00:04:11 GMT';
> >
> > "Mark Grimshaw" <m.grimshaw@salford.ac.uk> wrote in message
> > news:3AB8F65C.D8A430C8@salford.ac.uk...
> > > Using the Set-Cookie header within a perl script, I can set and get
> > > persistent cookies with Netscape.
> > >
> > > With IE5, I can set the cookie (i.e. I can see and read the cookie on
my
> > > client hard drive) but cannot get the cookie back.
> > >
> > > Netscape properly sends the HTTP_COOKIE environmental back to the perl
> > > script from which I can retrieve the state information.
> > >
> > > IE5 does not sent HTTP_COOKIE at all.
> > >
> > > Any ideas?
> > >
>
------------------------------
Date: Wed, 21 Mar 2001 20:54:38 +0000
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: persistent cookie working with Netscape4.7x, not IE5x?
Message-Id: <3AB9150E.317258BA@salford.ac.uk>
Integration was what I was thinking after I'd tried turning it into a .pm file
and 'using' it without success.
John Hall wrote:
> I think I may have had a problem with strict when calling a subroutine in
> something that was 'require'd and not 'use'd..
>
> The simple solution is to integrate the functions in that cookie.lib file
> into your script..
>
> The correct solution would probably be if I could remember how to get around
> that strict problem.. which I can't.
>
> "Mark Grimshaw" <m.grimshaw@salford.ac.uk> wrote in message
> news:3AB90411.4B6F903F@salford.ac.uk...
> > Hi,
> >
> > Hmm I must be stupid. Downloaded, untarred, chmodded +x, added require
> > '/path/cookie.lib' and end up with messages such as undefined subroutine
> > SetCookiePath etc.
> >
> > John Hall wrote:
> >
> > > I had similar problems until I started using the 'simple' cookie.lib
> that
> > > matt's script archive has:
> > >
> > > http://www.worldwidemart.com/scripts/
> > >
> > > I 'require' it, then all I have to do is this:
> > >
> > > &SetCookies('cookiename','cookieval')
> > >
> > > Also, check to make sure the exp date is far off.. [in the cookie.lib
> > > somewhere]
> > >
> > > $Cookie_Exp_Date = 'Wed, 08-Jun-2011 00:04:11 GMT';
> > >
> > > "Mark Grimshaw" <m.grimshaw@salford.ac.uk> wrote in message
> > > news:3AB8F65C.D8A430C8@salford.ac.uk...
> > > > Using the Set-Cookie header within a perl script, I can set and get
> > > > persistent cookies with Netscape.
> > > >
> > > > With IE5, I can set the cookie (i.e. I can see and read the cookie on
> my
> > > > client hard drive) but cannot get the cookie back.
> > > >
> > > > Netscape properly sends the HTTP_COOKIE environmental back to the perl
> > > > script from which I can retrieve the state information.
> > > >
> > > > IE5 does not sent HTTP_COOKIE at all.
> > > >
> > > > Any ideas?
> > > >
> >
------------------------------
Date: Wed, 21 Mar 2001 21:05:02 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: persistent cookie working with Netscape4.7x, not IE5x?
Message-Id: <slrn9bi5ru.33r.abigail@tsathoggua.rlyeh.net>
Mark Grimshaw (m.grimshaw@salford.ac.uk) wrote on MMDCCLIX September
MCMXCIII in <URL:news:3AB8F65C.D8A430C8@salford.ac.uk>:
:) Using the Set-Cookie header within a perl script, I can set and get
:) persistent cookies with Netscape.
:)
:) With IE5, I can set the cookie (i.e. I can see and read the cookie on my
:) client hard drive) but cannot get the cookie back.
:)
:) Netscape properly sends the HTTP_COOKIE environmental back to the perl
:) script from which I can retrieve the state information.
:)
:) IE5 does not sent HTTP_COOKIE at all.
:)
:) Any ideas?
Yeah, get a clue about the HTTP protocol and the CGI protocol.
Browser don't sent environment variables. That would not make any sense.
Browser send HTTP request headers. With zero or more headers related
to cookies. (Browsers are free to ignore cookies, or to only send them
back on Wednesdays).
A server interacting with a CGI program passes information about the
pending request to the program using environment headers. If cookie
information is send in the request, the server will set the HTTP_COOKIE
environment variable.
But none of this has to do with Perl. Followups set.
Abigail
--
perl -we '$| = 1; $_ = "Just another Perl Hacker\n"; print
substr $_ => 0, 1 => "" while $_ && sleep 1 => 1'
------------------------------
Date: Wed, 21 Mar 2001 20:42:17 +0100
From: Michael Schnupp <michas@nospam.uni-jena.de>
Subject: Re: queue
Message-Id: <3AB90419.A5066007@nospam.uni-jena.de>
Logan Shaw wrote:
>
> In article <3AB275AD.490819E@nospam.uni-jena.de>,
> Michael Schnupp <michas@nospam.uni-jena.de> wrote:
> >How can I build a queue, that can be used by more than one process?
> >
> >I have a list of values, each of them is the base of some computation.
> >Now I want to use a few processes to do the work, i.e. get the next
> >value and do the computation.
>
> The easiest way to do this is on disk. Create a file for each job, and
> have the worker processes lock the files to prevent simultaneous access
> and delete them (or rename them) when finished.
I don't really like that idea. there may be many units and the
computation time may be quite different.
How can I find out, if a file's unit is already worked on?
> The most obvious other method is to create a server process that
> accepts network (or local IPC) connections and on those connections
> allows the client to submit work units or to claim them and work on
> them.
that was also a idea of mine. having one server process, that's managing
the list alowing the work-processes to request the next unit. that
should be possible with socket connections, so there _is_ a solution for
my problem, but it seemed to be not the very best one.
> This method has potential, but it's tricky to make it
> scaleable. You'd want either a connectionless protocol or persistent
> connections and the ability to service several at once. Personally,
> I'd go for the connectionless protocol, but then you have to have a way
> of transferring the work units over this protocol, which means
> implementing a file transfer protocol, in effect.
There has to be an easier way! I don't believe, that I'm the first one,
who hits that kind of problem.
Shouldn't there be a convenient perl-module?
(I didn't found one in the cpan, but I was also not sure what to search
for.)
> You could also use shared memory, I guess.
any idea how that works?
btw: it don't have to be portable. it just has to work on my unix
system.
I thought also of another way: I take a main process (with the list) and
fork a fixed number of child processes working on the first units. every
time when a child finishes, I get the output and fork a new child
processing the next unit. It's not as flexible as the original idea, but
it should work quite well.
how do you think of that?
--
----------------------------------------------
Ehrman's Commentary:
(1) Things will get worse before they get better.
(2) Who said things would get better?
----------------------------------------------
------------------------------
Date: Wed, 21 Mar 2001 21:57:53 GMT
From: uNcONvEntiOnaL <tomcat@visi.com>
Subject: reading in, writing out checkbox array
Message-Id: <Bt9u6.1539$SB2.128380@ruti.visi.com>
Here is a snippet from a script that gets input from a html form.
$phone = $in{"phone"};
$whotocheckboxes = $in{"whotocheckboxes"};
phone is a textbox, whotocheckboxes is a checkbox array.
The values of phone and the checkbox array (multiple if multiple
ones are checked) need to be passed to another web page.
print "<a HREF='http://www.sasha.com/contact2.html?phone=$phone&
whotocheckboxes=$whotocheckboxes'>Return</a>\n";
whotocheckboxes only has one value in it, it doesn't remember
all the checked boxes. Does someone know what else I need
to add?
Thanks Tom
------------------------------
Date: 21 Mar 2001 22:32:11 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: reading in, writing out checkbox array
Message-Id: <slrn9biauk.29c.damian@puma.qimr.edu.au>
uNcONvEntiOnaL chose Wed, 21 Mar 2001 21:57:53 GMT to say this:
>Here is a snippet from a script that gets input from a html form.
>
I just answered this question. Please do not multi-post.
Cheers,
Damian
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: 21 Mar 2001 13:22:33 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Script for mail forwarding?
Message-Id: <m1bsqug6li.fsf@halfdome.holdit.com>
>>>>> "Joe" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
Joe> Basically it's a trivial thing to add a header containing env-to info using
Joe> procmail installed as your local mailer (IIRC env-to is passed to
Joe> procmail via -d %u with the normal sendmail ruleset. By monkeying with
Joe> sendmail.cf you can fix the -a flag to pass whatever you want to $1 in a
Joe> procmailrc script.)
That's already done. It's the "joey@teleport.com" patch (that I
helped write) in the standard distro, if enabled.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 21 Mar 2001 19:16:55 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Script mysteriously erases file it's supposed to append to
Message-Id: <H67u6.13$Sp2.34475@news.pacbell.net>
Katia Hayati <hayati@math.uiuc.edu> wrote:
> #!/usr/local/bin/perl -w
> use strict;
> use Fcntl ':flock';
> print "Content-type:text/plain\n\n";
> my $logfile = "uiuc.log";
> my $fool = $ENV{'QUERY_STRING'} ? $ENV{'QUERY_STRING'} : '';
> if (($fool eq 'index') or ($fool eq 'pers')) {
> my $when = localtime();
> my $where = $ENV{'HTTP_REFERER'};
> my $what = $fool;
> my $who = $ENV{'REMOTE_ADDR'};
> open(LOG, ">>$logfile") or die "Could not open log file $logfile: $!\n";
> flock(LOG, LOCK_EX);
Well, I can't believe it's your problem (because you only have append
and not write access to the file), but you've just called a function and
you *did not check the return value*. It could return a false value
indicating failure to lock.
> print LOG "$who | $when | $what | $where\n";
> close LOG or die "Could not close log file $logfile: $!\n";
> }
> print "\n";
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< How are you gentlemen!! Take off every '.SIG'!! >
------------------------------
Date: Wed, 21 Mar 2001 13:37:14 -0600
From: Katia Hayati <hayati@math.uiuc.edu>
Subject: Re: Script mysteriously erases file it's supposed to append to
Message-Id: <Pine.GSO.4.32.0103211331260.13846-100000@u10.math.uiuc.edu>
On Wed, 21 Mar 2001, Darren Dunham wrote:
> Katia Hayati <hayati@math.uiuc.edu> wrote:
>
> > #!/usr/local/bin/perl -w
> > use strict;
> > use Fcntl ':flock';
> > [...]
>
> > open(LOG, ">>$logfile")
> > or die "Could not open log file $logfile: $!\n";
> > flock(LOG, LOCK_EX);
>
> Well, I can't believe it's your problem (because you only have append
> and not write access to the file), but you've just called a function and
> you *did not check the return value*. It could return a false value
> indicating failure to lock.
Ah, yes, thanks, stupid of me. I just modified the script, called it a few
times, and it doesn't seem like there's a problem there.
If it's not my problem, do you think it is a potential open() or flock()
problem, or a server problem that would be best discussed somewhere else?
Thanks again,
KH
------------------------------
Date: Wed, 21 Mar 2001 14:23:35 -0500
From: minorseventhSPAMBLOCK@earthlink.net (Jim Kroger)
Subject: Re: Thanks for hash; how to read command line arguments?
Message-Id: <minorseventhSPAMBLOCK-2103011423350001@tritone.csbmb.princeton.edu>
In article <70uhbtg0at49b8v1nh81drt3bujtgl7hai@4ax.com>, Dave Cross
<dave@dave.org.uk> wrote:
> I think you're misunderstanding what Randal says :)
>
> #!/usr/bin/perl -w
>
> use strict;
>
> my ($integer, $filename) = @ARGV;
>
> Then do whatever you want with the values in $integer and $filename.
>
> hth,
>
> Dave...
Yes, I did misunderstand. Thanks much Dave.
Jim
------------------------------
Date: Wed, 21 Mar 2001 22:26:25 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Threaded Perl on FreeBSD
Message-Id: <lU9u6.52036$Ok4.4496506@news1.rdc1.ct.home.com>
Mike Stevens <tick1@my-deja.com> wrote:
> Greetings,
> I am trying to build a threaded Perl 5.6.0 on FreeBSD 4.2-RELEASE. I ran
> configure as: sh Configure -des -Duserthreads -Duseithreads -Dcc=gcc.
> make seemed to complete without errors. However, make test fails on the
> lib/posix test. The README.threads file seems to apply to 5.005
> threading style, so it does not seem to apply to my problem. Does anyone
> have any ideas what I need to do to get past this problem? TIA,
It doesn't surprise me that some tests fail. Running the test by hand
and capturing the result might help diagnose things.
Out of curiosity, what do you have in mind for this build of perl? You
won't be able to spawn multiple threads from inside perl code with it.
Dan
------------------------------
Date: Wed, 21 Mar 2001 19:44:08 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: user module install under Solaris 8
Message-Id: <cw7u6.7213$cF.150209@news1.nokia.com>
"Matthew L. Langford" <langfml@goodall.eng.auburn.edu> wrote in message
news:998jlu$4vt$1@aunews.duc.auburn.edu...
> Is there a POD which spells all this stuff out? perlmodinstall doesn't
even begin
> to cover this special case.
You might want to explore sudo and making a perlinstall user.
e.
------------------------------
Date: 21 Mar 2001 16:57:42 -0400
From: * Tong * <sun_tong_001@yahoo.com>
Subject: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <sa8pufaq1q1.fsf@sun_tong_001.personal.yahoo.com>
Hi,
Under Solaris, I always use the following lines in my perl code to
invoke it:
#!/bin/sh -- # -*- perl -*- -w
eval 'exec perl $0 ${1+"$@"}'
if 0;
But after moving to Linux, I got very frustrated with this setting,
and I can't even get the following to work:
#!/bin/sh -x
eval 'exec `which perl` $0 ${1+"$@"}' # -*- perl -*- -w
if 0;
All I can see is recursive calling:
+ eval exec `which perl` $0 ${1+"$@"}
+++ which perl
++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
+ eval exec `which perl` $0 ${1+"$@"}
+++ which perl
++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
+ eval exec `which perl` $0 ${1+"$@"}
+++ which perl
++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
I thought it was a bash shell version problem, but I fount it is
not. My current bash is "BASH_VERSION='2.04.0(1)-release'".
Has anyone ever notice this? do you have any way to work around it?
thanks
PS, my perl:
$ perl -v
This is perl, version 5.005_03 built for i386-linux
--
Tong (remove underscore(s) to reply)
http://members.xoom.com/suntong001/
- All free contribution & collection & music from the heavens
------------------------------
Date: Wed, 21 Mar 2001 22:30:38 +0100
From: Michael Heiming <Michael@Heiming.de>
Subject: Re: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <3AB91D7E.6A5EF84E@Heiming.de>
* Tong * wrote:
>
> Hi,
>
> Under Solaris, I always use the following lines in my perl code to
> invoke it:
>
> #!/bin/sh -- # -*- perl -*- -w
> eval 'exec perl $0 ${1+"$@"}'
> if 0;
>
> But after moving to Linux, I got very frustrated with this setting,
> and I can't even get the following to work:
>
> #!/bin/sh -x
> eval 'exec `which perl` $0 ${1+"$@"}' # -*- perl -*- -w
> if 0;
>
> All I can see is recursive calling:
>
> + eval exec `which perl` $0 ${1+"$@"}
> +++ which perl
> ++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
> + eval exec `which perl` $0 ${1+"$@"}
> +++ which perl
> ++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
> + eval exec `which perl` $0 ${1+"$@"}
> +++ which perl
> ++ exec /usr/bin/perl /home/tong/s/scripts/mailh.pl
>
> I thought it was a bash shell version problem, but I fount it is
> not. My current bash is "BASH_VERSION='2.04.0(1)-release'".
>
> Has anyone ever notice this? do you have any way to work around it?
Not really, you should have the first line in your script:
#!/usr/bin/perl
Good luck
Michael Heiming
------------------------------
Date: 21 Mar 2001 21:47:03 GMT
From: unruh@physics.ubc.ca (Bill Unruh)
Subject: Re: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <99b7gn$4o9$1@nntp.itservices.ubc.ca>
In <sa8pufaq1q1.fsf@sun_tong_001.personal.yahoo.com> * Tong * <sun_tong_001@yahoo.com> writes:
]#!/bin/sh -- # -*- perl -*- -w
]eval 'exec perl $0 ${1+"$@"}'
] if 0;
? If it is a perl script, just do
#!/usr/bin/perl
as the first line to have perl interpret the rest of the script instead
of sh. I am not sure what your sh comands do on solaris.
]But after moving to Linux, I got very frustrated with this setting,
]and I can't even get the following to work:
]#!/bin/sh -x
]eval 'exec `which perl` $0 ${1+"$@"}' # -*- perl -*- -w
] if 0;
]All I can see is recursive calling:
Not surprisingly.
------------------------------
Date: Wed, 21 Mar 2001 22:26:49 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <slrn9bial9.33r.abigail@tsathoggua.rlyeh.net>
* Tong * (sun_tong_001@yahoo.com) wrote on MMDCCLIX September MCMXCIII in
<URL:news:sa8pufaq1q1.fsf@sun_tong_001.personal.yahoo.com>:
() Hi,
()
() Under Solaris, I always use the following lines in my perl code to
() invoke it:
()
() #!/bin/sh -- # -*- perl -*- -w
() eval 'exec perl $0 ${1+"$@"}'
() if 0;
()
() But after moving to Linux, I got very frustrated with this setting,
() and I can't even get the following to work:
()
() #!/bin/sh -x
() eval 'exec `which perl` $0 ${1+"$@"}' # -*- perl -*- -w
() if 0;
Well, let's see what happens.
0 You fire up the program, handing over control to the kernel.
1 Whatever is in control notices the #! hack, fires up /bin/sh for
you, and feeds the file to the shell.
2 The shell ignore the first line, it being a comment.
3 The shell sees the second line, does the interpolation, and then
execs (replacing itself with) perl, giving it the file name as argument.
4 Perl peeks at the file, sees it starts with the #! hack, not followed
by something Perl like, and decides to impersonate the kernel.
5 Goto 1.
Abigail
--
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";
------------------------------
Date: 21 Mar 2001 19:50:12 GMT
From: lvirden@cas.org
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <99b0lk$l08$1@srv38.cas.org>
According to Radicator <bankview1@[remove to send email]nucleus.com>:
:
:"Uri Guttman" <uri@sysarch.com> wrote in message >
:> based on that code, i would burn the book for fuel.
:> that is horrible code on so many levels.
:>
:> get a better book and forget everything this one attempted to teach
:> you. that is the best solution to your query.
:>
:> uri
:>
:
:LOL!
:
:Okay, I'll burn it when I'm done . . . promise.
:
I think the point that many have been trying to make is that you should
NOT finish the book. It is teaching really really bad habits, bad coding
style, and possibly flat out wrong information.
Would you want to visit a doctor who had similar training? I sure wouldn't
want to use code written by someone writing software under those conditions ...
--
--
"See, he's not just anyone ... he's my son." Mark Schultz
<URL: mailto:lvirden@cas.org> <URL: http://www.purl.org/NET/lvirden/>
Even if explicitly stated to the contrary, nothing in this posting
------------------------------
Date: 21 Mar 2001 19:51:46 GMT
From: lvirden@cas.org
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <99b0oi$l08$2@srv38.cas.org>
According to Abigail <abigail@foad.org>:
:Either read the usenet archives, or the rest of the thread.
With the demise of deja.com, most of the usenet archives are gone ... even
when deja was around, most of the historical info from usenet was being
lost...
--
--
"See, he's not just anyone ... he's my son." Mark Schultz
<URL: mailto:lvirden@cas.org> <URL: http://www.purl.org/NET/lvirden/>
Even if explicitly stated to the contrary, nothing in this posting
------------------------------
Date: Wed, 21 Mar 2001 21:19:27 GMT
From: "cwp" <cwparker@alve.com>
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <01c0b24c$b19deeb0$19dbe226@thanatos>
lvirden@cas.org wrote:
> According to Abigail <abigail@foad.org>:
> :Either read the usenet archives, or the rest of the thread.
>
> With the demise of deja.com, most of the usenet archives are gone ...
> even when deja was around, most of the historical info from usenet
> was being lost...
Google's working on restoring access to the archives.
http://groups.google.com/advanced_group_search/
can be used in a pinch, but last I checked still only
had recent articles. Might be good for reading "the
rest of the thread," should one be so inclined.
cwp
------------------------------
Date: Wed, 21 Mar 2001 21:28:28 +0100
From: Jaroslaw Olczak <jarojaro@delta.ds2.pg.gda.pl>
Subject: Win32::ODBC::ColAttributes problem
Message-Id: <3AB90EEC.B5286531@delta.ds2.pg.gda.pl>
I have MSSQL 7 Server and Win98. I have installed AcitvPerl v 5.22 and
use Win32::ODBC to get some data from tables, and database scheme. I
have problem with ColAttributes method. When I use this method to
retrive attributes of some columns, I get only 4 spaces without any
error messages. Using script ( from FAQ ):
$db=new Win32::ODBC("DSN=MQIS;UID=sa;PWD=") ;
$db->Sql("SELECT * FROM Customers ");
my(@fields) = $db->FieldNames;
my(%type) = $db->ColAttributes($db->SQL_COLUMN_TYPE);
my(%len) = $db->ColAttributes($db->SQL_COLUMN_LENGTH);
my(%null) = $db->ColAttributes($db->SQL_COLUMN_NULLABLE);
foreach $field (sort @fields) {
print "p: $field t:$type{$field} l:$len{$field} n:$null{$field}
\n";
}
I get :
p: Address t: l: n:
p: City t: l: n:
p: CompanyName t: l: n:
p: ContactName t: l: n:
p: ContactTitle t: l: n:
p: Country t: l: n:
p: CustomerID t: l: n:
p: Fax t: l: n:
p: Phone t: l: n:
p: PostalCode t: l: n:
p: Region t: l: n:
Please help !
Jaro
------------------------------
Date: Wed, 21 Mar 2001 20:28:27 +0000 (UTC)
From: dwetzler@bioropa.com (Daniel Wetzler)
Subject: Words in a String variable
Message-Id: <5.0.0.25.0.20010321154157.00a3e5a0@imail.bioropa.com>
Hallo,
I'm a newbie and want to extract words from a String variable.
A string looks for example like this :
$string = "Ammonium tartrate (lab)";
I would like to recognize each word (Ammonium, tartrate, (lab)) and put
them into
different variables
$string1 = "Ammonium"
$string2 = "tartrate"
$string3 = "(lab)"
I tried this for hours but I fear i don't have enough docu about regular
expressions.
Is somewhere out the who could helpme ?
Greetings,
Daniel
--
Posted from [216.205.134.103]
via Mailgate.ORG Server - http://www.Mailgate.ORG
------------------------------
Date: Wed, 21 Mar 2001 21:12:17 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Words in a String variable
Message-Id: <tbi69haihher82@corp.supernews.com>
Daniel Wetzler (dwetzler@bioropa.com) wrote:
: I'm a newbie and want to extract words from a String variable.
:
: A string looks for example like this :
:
: $string = "Ammonium tartrate (lab)";
:
: I would like to recognize each word (Ammonium, tartrate, (lab)) and put
: them into different variables
Putting them into an array would be more flexible; you could get the
individual words by indexing. Assuming you define a "word" to be "a
sequence of non-space (\s) characters, this will work:
@words = split ' ', $string;
If you really want to assign to specific variables:
($string1, $string2, $string3) = split ' ', $string, 4;
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 544
**************************************