[7164] in Perl-Users-Digest
Perl-Users Digest, Issue: 789 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 29 02:35:29 1997
Date: Mon, 28 Jul 97 23:00:25 -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, 28 Jul 1997 Volume: 8 Number: 789
Today's topics:
Re: Assoc. array initialization query <merlyn@stonehenge.com>
Re: Can filehandles be stored in a hash? (Charles DeRykus)
Re: Can't turn off -w in script (M.J.T. Guy)
Re: Can't turn off -w in script (Andrew M. Langmead)
close pipe $? Win32 bug? <brian_zhou@sid.hp.com>
Re: Date::Manip Error (M.J.T. Guy)
Re: Date::Manip Error <zenin@best.com>
Re: Executing Shell commands in Perl (Tim Smith)
Re: function pointer dereferencing (Pete Jordan)
Need source example: fetch HTML from a URL <pociask@maricopa.edu>
Re: Net::FTP documentation and examples <zenin@best.com>
OLE HELP!!!!! <newland@vt.edu>
Re: PERL 5.004_1 bug? <rootbeer@teleport.com>
Perl behavior on Win32 vs Unix <hjy2@cornell.edu>
PERL on MS Internet Information Server <alta@tab.com>
Re: perl on Win32 - fork() <billc@tibinc.com>
Re: Perl5.004 installation problems on AIX 4.1 (David Guild)
Re: Poetry questions (Jonathan Feinberg)
Re: Poetry questions <rootbeer@teleport.com>
Questions on ARG Perl courses and value for money (Faust Gertz)
Re: Questions on ARG Perl courses and value for money (Charles DeRykus)
Re: redirection from STDERR <rra@stanford.edu>
Regular Expressions with metacharacters pdxjobs@pdxjobs.com
Re: Specifying where to look for modules first (M.J.T. Guy)
Re: Too many people in this group are arrogant #*(@# (R (Abigail)
Re: Unix time, local time, year 2000 question. (Abigail)
Re: using substr inside regexp for substitutions <rra@stanford.edu>
Re: using substr inside regexp for substitutions <rootbeer@teleport.com>
Re: using substr inside regexp for substitutions (Charles DeRykus)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Jul 1997 16:10:27 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: Assoc. array initialization query
Message-Id: <8cen8iydr0.fsf@gadget.cscaper.com>
>>>>> "Simon" == Simon Fairey <sfairey@adc.metrica.co.uk> writes:
Simon> I believe arrays and hashes are initialised as empty to start with,
Simon> however clearing them is always worth doing if your code is ever going
Simon> to end up looping and you don't want the array/hash to grow. I think {}
Simon> should normally be used to denote a BLOCK rather than an array/hash and
Simon> in the past I have always used () when clearing arrays/hashes ( whether
Simon> that is 100% correct I am not sure, but 5.004 doesn't complain. ).
Simon> I am not sure what the implications are of using {}, I doubt there are
Simon> any but I think the syntax checking in 5.004 has been enhanced
Simon> significantly so that you can no longer get away with things which are
Simon> strictly speaking not syntactically correct; whereas you could with
Simon> earlier versions.
It's worse than "not syntactically correct". It's plain wrong.
{} is a scalar... specifically a reference to an anonymous hash.
You were trying to do something like:
%foo = (35);
Except replace 35 with \%bar, and throw away %bar. :-)
It's good that it breaks, now. Sad that you got bit. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 399 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 28 Jul 1997 22:20:26 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Can filehandles be stored in a hash?
Message-Id: <EE1vE3.L3H@bcstec.ca.boeing.com>
In article <5ritku$nd5$1@Mars.mcs.net>,
Michael Borowiec <mikebo@MCS.COM> wrote:
>I have a script which will open many hundreds out output files.
>I would like to be able to do an open, then store the filehandle
>in a hash, indexed by a component of the filename, like so:
>
>> unless (defined($openhash{$filename})) {
>> open($handle, "> $dbdir/$filename") ||
>> die("Cannot open $dbdir/$filename: $!");
>> $openhash{$filename} = $handle;
>> }
>
>then later...
>
>> print($openhash{$filename} "some stuff\n");
>
>However, when I try to do this I get:
>String found where operator expected at ./script line XXX,
> near "} "some stuff\n""
> (Missing operator before "some stuff\n"?)
>Signal SEGV: No such file or directory
>Abort(coredump)
>
>I tried using scalar() around the de-referenced filehandle, but I get
>the same error. Suggestions?
>
>> print(scalar($openhash{$filename}) "some stuff\n");
print( {{$openhash{$filename}} "some stuff\n");
see "print" function in the Blue Camel, pg. 199.
HTH,
--
Charles DeRykus
ced@carios2.ca.pleasedelete.boeing.com
------------------------------
Date: 28 Jul 1997 18:11:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Can't turn off -w in script
Message-Id: <5rinbk$t5s@lyra.csx.cam.ac.uk>
Brett Denner <Brett.W.Denner@lmtas.lmco.com> wrote:
>If I try to run the following line:
>
> perl -w -e '1 if $a = 0'
>
>I get the following warning:
>
> Found = in conditional, should be == at -e line 1.
>
>When I turn off a local copy of the -w flag as such:
>
> perl -w -e 'local ($^W) = 0; 1 if $a = 0;'
>
>I get the same warning.
>
>Doesn't setting a local copy of $^W to 0 turn off the -w flag for the
>current block?
Yes - it turns it off _at run time_. What you have is a compile time
warning, so you need to do
perl -w -e 'BEGIN {$^W = 0}; 1 if $a = 0;'
to get the effect you want. And if you want to turn warnings off again,
you'll need another BEGIN block; there's no easy way to simulate the
automatic reset that 'local' provides.
A future version of Perl, perhaps 5.005, will have "lexical warnings"
which should make stuff like this more civilised.
Mike Guy
------------------------------
Date: Mon, 28 Jul 1997 23:39:18 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Can't turn off -w in script
Message-Id: <EE1z1I.AKE@world.std.com>
Brett Denner <Brett.W.Denner@lmtas.lmco.com> writes:
>When I turn off a local copy of the -w flag as such:
>
> perl -w -e 'local ($^W) = 0; 1 if $a = 0;'
>I get the same warning.
>Doesn't setting a local copy of $^W to 0 turn off the -w flag for the
>current block?
Perl discovers some of the questionable actions that it emits warnings
for when converting the script from text to syntax trees (lets call it
"compile time",) and other warnings as it is executing the syntax
trees (and lets call this "run time")
The "assignment found in conditional" is emitted at comile time, but
the $^W assigment is happening at run time.
One way of proving this is to see the results of this example:
perl -we 'print "begin\n"; 1 while $a = 0;'
and this:
perl -we 'print "begin\n"; print $a'
One way around your particular warning is to change your conditional
expression to:
perl -w -e '1 if (($a = 0) != 0);'
so that perl sees that you are trying to determine that the result of
the assignment is a boolean true value. (and not trying to compare
each side of the assignment to each other for equality.)
--
Andrew Langmead
------------------------------
Date: Mon, 28 Jul 1997 11:49:51 -0700
From: Brian Zhou <brian_zhou@sid.hp.com>
Subject: close pipe $? Win32 bug?
Message-Id: <33DCE9CE.69C0@sid.hp.com>
Hi,
Run the following on Unix/Win32 generates different result!
open P, "|exit 0;"; close P;
print sprintf("0x%04lx", $?), "\n";
open P, "|exit -1;"; close P;
print sprintf("0x%04lx", $?), "\n";
on Unix,
0x0000
0xff00
on Win32,
0x0000
0x0000
Is this feature not supported on Win32?
Any idea?
-Brian
------------------------------
Date: 28 Jul 1997 18:24:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Date::Manip Error
Message-Id: <5rio4g$cf@lyra.csx.cam.ac.uk>
J. Paul Reed <preed@psd.k12.co.us> wrote:
>I installed the Date::Manip module, and put use Manip in my perl code.
>But, now whenever I run whatever script I put that use Manip in, it says:
>
>
>Can't call method "import" in empty package "DateManip" at script.pl line 56.
>BEGIN failed--compilation aborted at script.pl line 56.
>
>I just installed it, and did move Manip.pm around to another directory,
>plus renamed it do DateManip.pm. Other than that, the install went fine;
>no error messages (other than I had to install it as root after I got done
>cofiguring it, which I did).
You can't just move around and rename modules like that. In general
modules have their own names written into them, as references to the
package name or otherwise. Sometimes these references are buried in
quite obscure ways.
In this case, you _may_ be able to get away with changing the
package Date::Manip;
somewhere near the top of the module to
package DateManip;
and change all other occurrences of Date::Manip as well.
But if you leave modules in their proper named files they have much more
chance of working..
Mike Guy
------------------------------
Date: 29 Jul 1997 00:58:02 GMT
From: Zenin <zenin@best.com>
Subject: Re: Date::Manip Error
Message-Id: <5rjf6q$u6$1@nntp2.ba.best.com>
J. Paul Reed <preed@psd.k12.co.us> wrote:
>snip<
> I just installed it, and did move Manip.pm around to another directory,
> plus renamed it do DateManip.pm. Other than that, the install went fine;
> no error messages (other than I had to install it as root after I got done
> cofiguring it, which I did).
> Any help on what this means would be appreciated!
Simple. Delete any of these files you moved around and/or renamed.
Then, WITHOUT MODIFYING ANY OF THE SOURCE FILES reinstall the
package using the following commands:
cd /your/source/dir
gunzip -c DateManip-5.10.tar.gz | tar -xvf -
cd DateManip-5.10
perl Makefile.PL
make
make test
make install
Once again, DO NOT MODIFY THE MODULE NAMES, DIRECTORYS, OR WHAT NOT!
If you still feel like you must change the names for whatever
reason, then you must also run these commands from root to let perl
know were to find them:
mv /usr/lib/libc.a /usr/lib/libTryToFindMeNowHaHaHa.a
mv /usr/lib/libc.so.* /usr/lib/libFindMeToHaHaHaHaHa.so
Anyone know if those Darwin awards are still going on? :)
--
-Zenin
zenin@best.com
------------------------------
Date: 28 Jul 1997 18:20:53 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: Executing Shell commands in Perl
Message-Id: <5rjghl$bar@web.azstarnet.com>
In article <870110598.30566@dejanews.com>,
<wchrist@flagmail.wr.usgs.gov> wrote:
>I am trying to execute shell commands in Perl with no success.
It sounds like you want to open a pipe to the taetm command, write
your arguments to it, then close the pipe. Please read the info in
the perlipc man page. I think the section labeled "using open() for
IPC" is what you're looking for. There are excellent examples given
for calling shell programs from Perl.
Tim
------------------------------
Date: Tue, 29 Jul 1997 02:18:37 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: function pointer dereferencing
Message-Id: <memo.19970729031836.45313F@horus.cix.co.uk>
In article <8cn2n6yiw6.fsf@gadget.cscaper.com>, merlyn@stonehenge.com
(Randal Schwartz) eeeked:
> You didn't take that far enough:
>
> sub {
> print "hello, ", (join ", ", @_), "!\n";
> } -> qw(Tom Randal Larry);
>
> Eeek. It works. So now we have a do-block that understands
> return:
>
> $a = sub {
> ...;
> ...;
> return $blah if $cond;
> ...;
> } -> ();
>
> Eeek. Eeek.
Excuse me while I start quietly gibbering to myself.
Trouble is, I can immediately envisage situations where I might actually
want to /use/ constructs like that.
I guess there's no hope for me...
Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Anyone who cannot cope with regular
expressions is not fully human. At best
he is a tolerable subhuman who has learnt
to log in, use ls, and not make messes in
his home directory."
------------------------------
Date: Mon, 28 Jul 1997 17:38:54 -0600
From: Jason Pociask <pociask@maricopa.edu>
Subject: Need source example: fetch HTML from a URL
Message-Id: <33DD2D8E.6B86@maricopa.edu>
Surely someone has a PERL program that is non-proprietary
enough to email it to me: just need a simple program or sub
that takes a URL, opens up a web connection, and fetches
the HTML page back for parsing. I know enough perl, but
pulling together all the right _use_ modules is proving
a little tough. If I just had a working example, I'd be
off and running on an important project.
Many thanks in advance, no explanations or support needed,
just a little bit of code, maybe something that was done
for fun or as part of a publicly funded project.
-Jason P. pociask@maricopa.edu
------------------------------
Date: 29 Jul 1997 01:05:50 GMT
From: Zenin <zenin@best.com>
Subject: Re: Net::FTP documentation and examples
Message-Id: <5rjfle$u6$2@nntp2.ba.best.com>
Keys <keys@babylon5fan.org> wrote:
> Does anyone know of a more detailed set of documentation for Net::FTP?
> I have been working with the example as given in the perldoc page, but
> it doesn't seem to work for me... no errors or anything... I haven't
> been able to get anything on CPAN for the last week or so either, as it
> appears that perl.com is having server problems...
Post your code with any error messages it might give. A copy of
the output from Perl -V is never a bad idea either.
For docs, try perldoc Net::FTP. Look for "Debug" in it. If that's
not enough, see my statement above.
--
-Zenin
zenin@best.com
------------------------------
Date: Mon, 28 Jul 1997 20:17:32 -0400
From: newland <newland@vt.edu>
Subject: OLE HELP!!!!!
Message-Id: <33DD369C.3837@vt.edu>
I am trying to use OLE with excel 5. My problem is, I do not know how
to pass a variable from the perl environment to use in the excel
environment. I would appreciate any help on this. Thank you.
------------------------------
Date: Mon, 28 Jul 1997 19:26:02 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Marshall Dudley <mdudley@execonn.com>
Subject: Re: PERL 5.004_1 bug?
Message-Id: <Pine.GSO.3.96.970728192317.6224M-100000@kelly.teleport.com>
On Mon, 28 Jul 1997, Marshall Dudley wrote:
> I think I have found a bug in PERL 5.004_1. The printf left
> justification does not work. Even with the "-" (ie. %-8.2f) it still
> prints right justified.
>
> Is there a workaround for this?
Sure. File a bug report and install the patch that you get back. :-) Just
run the perlbug program and show that this command
perl -we 'printf "%-8.2f\n", 3.14159'
...works differently on 5.004 than on 5.003. Somebody will promptly fix
this (if they don't have a patch already). If you hurry, it may be fixed
in 5.004_02. Thanks for noticing!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 28 Jul 1997 13:45:07 -0400
From: John Yang <hjy2@cornell.edu>
Subject: Perl behavior on Win32 vs Unix
Message-Id: <33DCDAA3.B0002D1D@cornell.edu>
I am trying to port a script from a Unix box to an NT box. Things seem
to work well, except that the system call doesn not seem to work. Well,
it is either the system call or the actual call. I've tried changing
it, but I can't seem to figure it out. Here's the line of code:
system ("cp $PATH_TO_MASTER/cgi/* $PATH_TO_COURSE_CGI/");
# system ("copy c:/inetpub/wwwroot/master/cgi/*
c:/inetpub/scripts/courses/nttest/");
The first line is the one we used for the unix machine, the bottom line
is what I think it should be for the WinNT machine. It does not seem to
work. The bottom line has the actual paths written in the system call.
It does not seem to copy the files at all. I cannot tell if it is the
system call, or possibly some permissions thing. I am writing into the
protected scripts directory, so that may be the problem. (This is
probably the problem, but I am unsure as to the permissions of the
Scripts directory) Any help, or ideas would be greatly appreciated.
other infomation.
Unix box: sun, running apache, perl5
NT box: NT workstation 4.0, Using IIS 2.0, perl5 win32.
Thanks again.
------------------------------
Date: 29 Jul 97 04:14:12 GMT
From: "ALTA RESEARCH" <alta@tab.com>
Subject: PERL on MS Internet Information Server
Message-Id: <01bc9bdd$be95d760$034eaacf@miked>
We are in the process of configuring PERL (CGI) on the MS Internet
Information Server.
There is very little documentation, either from Microsoft or on the WWW.
Has anyone come across a good information resource?
Please help.
This seems like a very heavy handed action by Microsoft. Are they trying
to limit support for PERL in an attempt to force everyone into ActiveX and
Visual Basic?
------------------------------
Date: Mon, 28 Jul 1997 19:17:24 -0400
From: Bill Cowan <billc@tibinc.com>
To: Andrew Cheyne <stud6x19@bnr.ca>
Subject: Re: perl on Win32 - fork()
Message-Id: <33DD2884.C10FA963@tibinc.com>
Andrew Cheyne wrote:
>
> Hello..
>
> I am porting a Unix perl script to perl for Win32 and keep
> getting an error message stating that fork is unspoorted. IS
> this true? Is it available anywhere else?
>
Check out STATUS.TXT file in Win32 Perl (ActiveWare) distribution;
here is portion:
"Only a subset of the standard Perl 5 Kit has been implemented, as
there is usually no direct equivalent of the functionality in Win32."
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: Tue, 29 Jul 1997 04:53:59 GMT
From: dfguild@sdsolutions.com (David Guild)
Subject: Re: Perl5.004 installation problems on AIX 4.1
Message-Id: <33dd76ff.41132926@news.javanet.com>
You can get an already compiled perl for AIX in installp format at
http://www-frec.bull.com/. I just installed it with no problems.
Dave Guild
dfguild@sdsolutions.com
On Mon, 28 Jul 1997 15:02:19 -0600, Thomas_Santamaria@ushc.com wrote:
>I was trying to install Perl5 on a local AIX box and did not have much
>luck when trying to run the tests. In particular when I run make test
>(or TEST -v), I get the following;
>
>FAILED on test 0
>Failed 1 test script out of 155, 0.00% okay.
> ### Since not all tests were successful, you may want to run some
> ### of them individually and examine any diagnostic messages they
> ### produce. See the INSTALL document's section on "make test".
>u=0.11 s=0.03 cu=0.05 cs=0.04 scripts=0 tests=0
>
>Not knowing how exactly to respond, I have also tried to run "harness"
>with the following results;
>
>Failed Test Status Wstat Total Fail Failed List of failed
>------------------------------------------------------------------------------
>comp/script.t 3 2 66.67% 1, 3
>io/argv.t 5 3 60.00% 1-3
>io/dup.t 6 1 16.67% 5
>io/pipe.t 10 1 10.00% 10
>lib/dirhand.t 5 2 40.00% 2-3
>lib/io_dup.t 6 1 16.67% 5
>lib/io_taint.t ?? ?? % ??
>op/exec.t 8 2 25.00% 1, 5
>op/glob.t 6 1 16.67% 3
>op/magic.t 30 3 10.00% 1, 15-16
>op/misc.t 45 45 100.00% 1-45
>op/readdir.t 3 1 33.33% 3
>op/runlevel.t 8 8 100.00% 1-8
>op/taint.t ?? ?? % ??
>pragma/locale.t ?? ?? % ??
>pragma/strict.t 47 47 100.00% 1-47
>pragma/subs.t 6 6 100.00% 1-6
>Failed 17/151 test scripts, 88.74% okay. 123/4069 subtests failed, 96.98% okay.
>
>Can someone advise me what to do next? I downloaded Perl to try and
>learn it on my own, but it seems as though I can't get out of the chute.
>What can I do about the failed tests? Are my results "good enough"?
>
>Please respond via e-mail, if possible.
>
>Thanks for your help.
>Tom
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
David Guild
Systems & Design Solutions -- A Web Consulting Firm
(413)268-9439
www.sdsolutions.com
------------------------------
Date: 29 Jul 1997 00:25:55 GMT
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Poetry questions
Message-Id: <5rjdaj$7ot$1@gte1.gte.net>
> $var2 = $var;
> $var2 =~ tr/qwerty/asdfg/;
>
> Can I do that in a single statement?
> like: $var2 = $var =~ tr/qwerty/asdfg/;
Very much like that:
($var2 = $var) =~ tr/qwerty/asdfg;
> $var = $long->{'variable'}->{'name'} ? $long->{'variable'}->{'name'} : "nope";
> Is there a way so I don't have to write that long variable name twice?
Standard Perl idiom:
$var = $long->{'variable'}->{'name'} || "nope";
--
Jonathan Feinberg jdf@pobox.com Sunny Manhattan, NY
------------------------------
Date: Mon, 28 Jul 1997 19:18:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Poetry questions
Message-Id: <Pine.GSO.3.96.970728191402.6224L-100000@kelly.teleport.com>
On 28 Jul 1997, Toutatis wrote:
> How to write cleaner scripts:
>
> $var2 = $var;
> $var2 =~ tr/qwerty/asdfg/;
>
> Can I do that in a single statement?
> like: $var2 = $var =~ tr/qwerty/asdfg/;
You were so close!
($var2 = $var) =~ tr/qwerty/asdfg/;
> $var = $long->{'variable'}->{'name'} ? $long->{'variable'}->{'name'} : "nope";
> Is there a way so I don't have to write that long variable name twice?
$var = $long->{'variable'}->{'name'} || "nope";
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 28 Jul 1997 22:41:59 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Questions on ARG Perl courses and value for money
Message-Id: <33dd17b4.6273972@news.wwa.com>
I'm not really a programmer and only dabble in Perl to do a few simple
CGI tasks, but would like to increase my abilities as far as CGI and
WWW programming goes. As I won't be able to attend the O'Reilly Perl
Conference, I thought I would convince my boss to send me to one of
XOR Network Engineering's "CGI and WWW Programming in Perl" courses to
pick up what I need to know about CGI, the CGI.pm, database access,
and writing well-behaved bots. My guess is Tom Christiansen's course
is a deal at $595, but my boss objects to the travel and expenses
(probably about an additional $1200). He says while he is willing to
pay for training, he is not willing to needlessly send me on a trip.
We are located in Chicago and he found out that American Research
Group is putting on a few courses in the Chicago area. The first is
your basic hands-on Perl programming course
(http://199.72.26.247/course/course.asp?course=6950) and the second
is entitled "Advance Perl with CGI"
(http://199.72.26.247/course/course.asp?course=6980). The courses run
$995 each and you get a copy of the Camel Book and O'Reilly's _CGI
Programming on the World Wide Web_ respectively. The courses will be
taught by Dave Nance and Bruce Regittko. Does anyone know anything
about Dave or Bruce's abilities to teach Perl or their expertise in
the area? I don't recall ever seeing their names in this newsgroup.
I am trying to get an idea as to what would be the best value for the
money. For example, it would be my guess that spending $1800 and
traveling for Tom's two day hands on class would be a better value for
the money than spending about $1000 to sit in Tom's one-day lecture
style course at Navy Pier during HPWORLD 97. But, I could be wrong.
:-)
TIA
Faust
------------------------------
Date: Tue, 29 Jul 1997 00:13:49 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Questions on ARG Perl courses and value for money
Message-Id: <EE20n2.59C@bcstec.ca.boeing.com>
In article <33dd17b4.6273972@news.wwa.com>, Faust Gertz <faust@wwa.com> wrote:
> I'm not really a programmer and only dabble in Perl to do a few simple
> CGI tasks, but would like to increase my abilities as far as CGI and
> WWW programming goes. As I won't be able to attend the O'Reilly Perl
> Conference, I thought I would convince my boss to send me to one of
> XOR Network Engineering's "CGI and WWW Programming in Perl" courses to
> pick up what I need to know about CGI, the CGI.pm, database access,
> and writing well-behaved bots. My guess is Tom Christiansen's course
> is a deal at $595, but my boss objects to the travel and expenses
> (probably about an additional $1200). He says while he is willing to
> pay for training, he is not willing to needlessly send me on a trip.
>
> We are located in Chicago and he found out that American Research
> Group is putting on a few courses in the Chicago area. The first is
> your basic hands-on Perl programming course
> (http://199.72.26.247/course/course.asp?course=6950) and the second
> is entitled "Advance Perl with CGI"
> (http://199.72.26.247/course/course.asp?course=6980). The courses run
> $995 each and you get a copy of the Camel Book and O'Reilly's _CGI
> Programming on the World Wide Web_ respectively. The courses will be
> taught by Dave Nance and Bruce Regittko. Does anyone know anything
> about Dave or Bruce's abilities to teach Perl or their expertise in
> the area? I don't recall ever seeing their names in this newsgroup.
>
> I am trying to get an idea as to what would be the best value for the
> money. For example, it would be my guess that spending $1800 and
> traveling for Tom's two day hands on class would be a better value for
> the money than spending about $1000 to sit in Tom's one-day lecture
> style course at Navy Pier during HPWORLD 97. But, I could be wrong.
> :-)
>
Tom's an excellent instructor: clear, helpful, reads his audience
well, and and is of course very knowledgeable about Perl. I'm still
amazed at how useful his handouts are a year after taking his 2 day
onsite CGI course here.
There are undoubtedly other good instructors around but in my
opinion you'll lose something of the soul of Perl without Tom or
Randal there :)
Regards,
--
Charles DeRykus
ced@carios2.ca.snip_it.boeing.com
------------------------------
Date: 28 Jul 1997 16:41:56 -0700
From: Russ Allbery <rra@stanford.edu>
To: tphilip@bnr.ca (Teebu Philip)
Subject: Re: redirection from STDERR
Message-Id: <m3k9ia7ni3.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Teebu Philip <tphilip@bnr.ca> writes:
> I wish to call an executable program xyz from within a perl script
> bubba.pl. The program xyz redirects STDERR into STDOUT. I wish to
> seperate the STDERR messages from STDOUT from within my perl script.
> Normally at the shell prompt I could do the following:
> brtphe33-132> (xyz > file.stdout) >& file.stderr
system 'xyz > file.stdout 2> file.stderr';
Perl uses sh syntax, not csh syntax, for redirects. Alternately, if you
need to be able to grab them both as Perl file handles, you can do
something along the lines of:
use FileHandle;
use IPC::Open3;
$write = new FileHandle;
$read = new FileHandle;
$errors = new FileHandle;
open3 ($write, $read, $errors, 'xyz');
and then read the errors from $errors and stdout from $read.
--
#!/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: Tue, 29 Jul 1997 02:23:59 GMT
From: pdxjobs@pdxjobs.com
Subject: Regular Expressions with metacharacters
Message-Id: <33dd53ac.74753943@news.teleport.com>
I'm not sure how best to match on a string containing metacharacters.
I thought the \Q operator would work here, and match on the line with
c++. But no match occurs. What's the best way to match on RE's with
metacharacters?
$RE="c++";
@lines=("line a", "line b c++ d", "line e f g");
@match=grep /\s\Q$RE\s/i, @lines;
for (@match){
print $_;
}
PDXJOBS - A Job Placement Website for Portland, OR
http://www.pdxjobs.com
email: pdxjobs@pdxjobs.com
(503)620-4579
------------------------------
Date: 28 Jul 1997 17:59:18 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Specifying where to look for modules first
Message-Id: <5rimlm$smi@lyra.csx.cam.ac.uk>
Jason Bodnar <jason@cimedia.com> wrote:
>I want to use the newer versions of some modules and my SysAmdin doesn't
>want to upgrade yet because it may adversely effect the other users.
>
>So, I created my own perl module directory and installed the modules there
>using PREFIX=. I put 'use lib q(/path-to-my-modules/);' at the start of my
>programs but it loads the older versions of the modules from the standard
>perllib directory. If I print @INC the path to my modules is first. Is
>there a way I can specify where to look for modules first?
I don't understand that. I do things like this all the time and they work.
You've checked that @INC is in the order you want. Perhaps looking
at %INC to see where the various modules have been loaded from may give
a clue. Try printing out %INC and @INC at various intermediate points
in the loading process.
I doubt this is relevant to you, but if you are trying to load private
versions of standard modules which may be loaded internally, you have
special problems. (Exercise for the reader - how do you get a
private version of "use lib ...;" ?)
Mike Guy
------------------------------
Date: Tue, 29 Jul 1997 01:13:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Too many people in this group are arrogant #*(@# (Re: Checking for valid Email...)
Message-Id: <EE23EC.66z@nonexistent.com>
John Bokma (jbokma@caiw.nl) wrote on 1427 September 1993 in
<URL: news:01bc9b49$aad90b00$d60ab2c2@tschai>:
++
++ But like the Bible, the FAQ is often used in cases it should not.
++ I can remember at least one posting (not long ago) about extracting
++ fields from
++ a csv file. Although the original poster stated that the solution in
++ the FAQ didn't work
++ is this special case, one of the answered posted was something like:
++ Read the FAQ.
++ (which really pissed him off 8-). What I mean, some people start
++ yelling "Read the FAQ"
++ like some mantra even before they have read the whole posing..
Yeah, yeah. One persons makes one mistakes, and all of the sudden
all those FAQs being asked aren't FAQs, but well thought out questions
including arguments why the answer in the FAQ doesn't work for
them, right?
++ Providers don't teach people
++ to go to news.answers before starting to use USENET.
Because that isn't a providers task. Does you shoe sales man
teach you how to walk? Does your car dealer give you driving
lessons? Does your grocery store give cooking classes? Can
learn how to read at the post office?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Tue, 29 Jul 1997 01:20:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Unix time, local time, year 2000 question.
Message-Id: <EE23qL.6rL@nonexistent.com>
Neil Briscoe (neilb@zetnet.co.uk) wrote on 1426 September 1993 in
<URL: news:memo.19970727080740.5007A@skep.compulink.co.uk.cix.co.uk>:
++
++ I very recently wrote a script on my firewall which worked based on that
++ very sentence. Since the string I have to pass to the postgres database
++ needs a four digit year, I do a :-
++
++ $year += 100;
++
++ rather than
++
++ $year = "19$year";
++
++ as I might have been inclined to do.
++
++ I'd dearly like to know if this code is going to keel over and die on New
++ Year's day 2000. I have a comment in the code on that line that reads :-
Well, if it isn't already keeling over and dying, I suspect
you will be save in 2000.
What makes you think $year += 100; and $year = "19$year";
are anywhere near equivalent?
If you want to be correct, now and in the year 2000, use $year += 1900.
BTW, could any of the people struggling with what the proper way is
dealing with the year component of localtime () explain what they don't
understand from the following fragment of Perl's documentation of
localtime, so it can be changed to a more understandable description?
> Also, $year is the number of
> years since 1900, that is, $year is 123 in year 2023.
Looks like pretty clear English to me.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 28 Jul 1997 16:46:38 -0700
From: Russ Allbery <rra@stanford.edu>
To: LRiddle@ness.agnesscott.edu (Larry Riddle)
Subject: Re: using substr inside regexp for substitutions
Message-Id: <m3g1sy7na9.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Larry Riddle <LRiddle@ness.agnesscott.edu> writes:
> I would like to take an expression like
> <a href="abcdefghijk.htm">
> and truncate the htm file name to just 8 characters to get
> <a href="abcdefgh.htm">.
> The substitution also needs to work on expressions like
> <a href="http://www.xxx.yyy/zzz/abcdefghijk.htm">
> and just truncate the abcdefghijk part to 8 letters.
$tag =~ s%\"(.*/)([^.]{1,8})[^.]*\.htm\b%\"$1$2.htm%g;
Just match only the first eight characters of the file name and pull them
off seperately, discarding the rest of the filename to the period for the
extension. Far easier than trying to use substr().
> I want to do something like
> s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
If you really want to try something like this, you'll need to use the /e
modifier on your s/// expression. See man perlop for the details.
--
#!/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: Mon, 28 Jul 1997 20:17:17 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Larry Riddle <LRiddle@ness.agnesscott.edu>
Subject: Re: using substr inside regexp for substitutions
Message-Id: <Pine.GSO.3.96.970728201238.6224T-100000@kelly.teleport.com>
On Mon, 28 Jul 1997, Larry Riddle wrote:
> <a href="abcdefgh.htm">. I want to do something like
>
> s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
Try again, but use the /e modifier and make the replacement an expression
which returns the replacement string. (And you don't need to backwhack
quote marks inside a regular expression or the quote or dot in the
replacement. And you don't want to use \1 on the replacement side. The
docs have a good explanation.)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 28 Jul 1997 23:19:13 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: using substr inside regexp for substitutions
Message-Id: <EE1y42.1Jw@bcstec.ca.boeing.com>
In article <LRiddle-2807971532120001@168.28.233.61>,
Larry Riddle <LRiddle@ness.agnesscott.edu> wrote:
> I am just learning Perl and am having trouble trying to do the following
> (I have checked the FAQ lists and a Perl reference without success).
>
> I would like to take an expression like
>
> <a href="abcdefghijk.htm">
>
> and truncate the htm file name to just 8 characters to get
>
> <a href="abcdefgh.htm">. I want to do something like
>
> s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
>
> but this substitutes the entire expression substr(\1,1,8) rather than
> evaluating the substr function and substituting the result. The
> substitution also needs to work on expressions like
>
> <a href="http://www.xxx.yyy/zzz/abcdefghijk.htm">
>
> and just truncate the abcdefghijk part to 8 letters. The method above
> doesn't work on this because it picks up everything from the first
> quotemark, not just the abcdefghijk.htm part. Any help would be
> appreciated. Please respond by email also if you send a response back to
> the newsgroup. Thank you.
Here're some possibilities:
s/(")(.+?)(\.htm\b)/$1 . substr($2,1,8) . $3/eg;
or,
s/"(.+?)(\.htm\b)/"@{[substr($1,1,8)]}$2/g; # @{[ ]} "block eval"
But, avoiding the eval would be even faster:
s/"(.{1,8}).*?(\.htm\b)/"$1$2$3/g;
HTH,
--
Charles DeRykus
ced@carios2.ca.please_snip.boeing.com
------------------------------
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 789
*************************************