[11132] in Perl-Users-Digest
Perl-Users Digest, Issue: 4732 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 23 16:17:13 1999
Date: Sat, 23 Jan 99 13:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 23 Jan 1999 Volume: 8 Number: 4732
Today's topics:
Re: A question about filehandle (Ronald J Kimball)
Re: CGI.pm File Upload <joe@laffeycomputer.com>
Re: CGI.pm File Upload (Arthur Corliss)
Re: chat2.pl and Solaris? (Randal L. Schwartz)
easy way to query other boxes mkaminer@yahoo.com
Re: flock and cgi: can it hang? (Arthur Corliss)
Re: Getting the last number in an IP addr with a regex. (Mike Bristow)
Re: Getting the last number in an IP addr with a regex. <jdf@pobox.com>
Help on Perl and Corba (fada)
Re: HELP WANTED: Appending a text file. <joe@laffeycomputer.com>
Re: HELP!! Perl Viewer?? (Ronald J Kimball)
Re: help?!: how to change a date to seconds since EPOCH <abey@hill.ucr.edu>
language support <n8twatch@usa.net>
Re: language support <michael@mismatch.com>
need Fcntl.pm and SDBM_File. Where to get it? <karl@nospamaddYproline.at>
Re: Need script for .htpasswd file <joe@laffeycomputer.com>
Re: Need script for .htpasswd file <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Newbie - Whats wrong with this script? (Ronald J Kimball)
Re: Newbie question: writing file <chester@ultranet.com>
Re: ok please don't shoot me for this question <eugene@snailgem.org>
Re: ok please don't shoot me for this question <elst.fels@nospam.ping.be>
Re: ok please don't shoot me for this question <rick.delaney@home.com>
Re: Passing array references. (Bart Lateur)
perl bug with substitution via subroutine? <tmp@he.net>
Re: Perl Criticism <staffan@ngb.se>
Personal lib dir - please help <joe@laffeycomputer.com>
Re: PROOF: Jesus is NOT LORD of the Sabbath! =? (Arthur Corliss)
Re: Question concerning perl and NT (Steve Linberg)
Re: Question concerning perl and NT (Ethan H. Poole)
Re: thanks <rick.delaney@home.com>
Re: Writing files (Ronald J Kimball)
Re: Writing files <rick.delaney@home.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 23 Jan 1999 14:56:32 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: A question about filehandle
Message-Id: <1dm373g.szra7mou6blsN@bay3-199.quincy.ziplink.net>
Zhengdong Zhang <zzhang@bayou.uh.edu> wrote:
> Is it possible to specify the directory of a file at run time
> when open a filehandle?
Yes, of course.
open(IN, "$dir/$file") or die "Could not open $dir/$file: $!\n";
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 23 Jan 1999 13:29:30 -0600
From: Joe Laffey <joe@laffeycomputer.com>
Subject: Re: CGI.pm File Upload
Message-Id: <Pine.LNX.4.05.9901231328220.11347-100000@tripe.laffeycomputer.com>
On Sat, 23 Jan 1999, FK wrote:
>=20
> running the script on the linux server the file is transfered
> correctly to the server and stored with the correct filename
> und file extension.
> running the programm under nt the file is also transferred
> to the server, but not with the correct filename and without
> any file extension (eg CGITEMP214243)
>=20
> Has anyone an idea what=B4s going wrong ?
There may be other problems, but be sure both have CGI.pm version 2.46 ( I
think that's the latest). I had a similar problem once, and upgrading
CGI.pm on the other server solved it.
Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
http://www.laffeycomputer.com/
------------------------------
------------------------------
Date: 23 Jan 1999 11:03:17 -0900
From: corliss@loki.org (Arthur Corliss)
Subject: Re: CGI.pm File Upload
Message-Id: <slrn7akb32.dr.corliss@loki.org>
On Sat, 23 Jan 1999 09:18:51 +0100, FK <fknetworxs@earthling.net> wrote:
>running the script on the linux server the file is transfered
>correctly to the server and stored with the correct filename
>und file extension.
>running the programm under nt the file is also transferred
>to the server, but not with the correct filename and without
>any file extension (eg CGITEMP214243)
>
>Has anyone an idea what4s going wrong ?
I'd be checking the docs for IIS. It's pretty broken, so you may have to
swing a few work arounds to get what you want out of it.
--Arthur Corliss
Bolverk's Lair -- http://www.odinicfoundation.org/arthur/
"Live Free or Die, the Only Way to Live" -- NH State Motto
------------------------------
Date: 23 Jan 1999 10:23:20 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: chat2.pl and Solaris?
Message-Id: <m1ognphmqv.fsf@halfdome.holdit.com>
>>>>> "Colin" == Colin Kuskie <ckuskie@cadence.com> writes:
Colin> wrapman, which wraps perl code in roff so that you could keep
Colin> you documentation along with your executable. (Kinda sounds like
Colin> pod, doesn't it?)
Nope. That's Larry's baby, if I recall correctly.
--
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@teleport.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: Sat, 23 Jan 1999 18:22:42 GMT
From: mkaminer@yahoo.com
Subject: easy way to query other boxes
Message-Id: <78d41b$avk$1@nnrp1.dejanews.com>
So i have 20 machines on a subnet. I want to know what each machine (NT,
UNIX, ROUTER...) is running. any ideas?
-matt
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 23 Jan 1999 10:55:18 -0900
From: corliss@loki.org (Arthur Corliss)
Subject: Re: flock and cgi: can it hang?
Message-Id: <slrn7akak2.dr.corliss@loki.org>
On Fri, 22 Jan 1999 21:35:56 -0500, Bob Mariotti <bobm@cunix.com> wrote:
>Having just implemented flock'ing in perl, my belief is that if one does not
>explicitly unlock the file, terminating the perl program will automatically
>unlock it.
Though it happens when the file is officially closed, at either the end of the
program, or specifying the close command.
--Arthur Corliss
Bolverk's Lair -- http://www.odinicfoundation.org/arthur/
"Live Free or Die, the Only Way to Live" -- NH State Motto
------------------------------
Date: Sat, 23 Jan 1999 18:56:06 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Getting the last number in an IP addr with a regex.
Message-Id: <slrn7ak6q6.1up.mike@lindt.fat.dotat.at>
On Sat, 23 Jan 1999 20:08:29 +1100, Kim Saunders <kims@tip.net.au> wrote:
>Hiya all,
>
>could someone please help me with a regex to give me the last number in an
>IP address with a regex???
>
>That is, I have an IP w.x.y.z where w,x,y and z are numbers between 1 and
>255 or so (the actual details of an IP are not important at the moment!)
>
>I just want a regex to give me z, something that will work regardless of the
>number of digits of each section.
#!/usr/bin/perl -w
use strict;
my $octet = '0*(?:1?\d\d?|2[01234]\d|25[012345])';
while (<>) {
print "that's not an IP address\n" and next
unless /(?:^|\D)$octet\.$octet\.$octet\.($octet)(?:$|\D)/;
print "OK, so that's an IP address with $1 as the last octet\n";
}
--
"I'd crawl over an acre of 'Visual This++' and 'Integrated Development
That' to get to gcc, Emacs, and gdb. Thank you."
-- Vance Petree, Virginia Power
------------------------------
Date: 23 Jan 1999 20:35:08 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Getting the last number in an IP addr with a regex.
Message-Id: <m3679xok9f.fsf@joshua.panix.com>
mike@fat.dotat.at (Mike Bristow) writes:
> my $octet = '0*(?:1?\d\d?|2[01234]\d|25[012345])';
So 0000000000253 is a legal octet?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 23 Jan 1999 19:15:16 GMT
From: faf@nafjfa.com (fada)
Subject: Help on Perl and Corba
Message-Id: <78d744$8su@bgtnsc03.worldnet.att.net>
A vendor told me that his system is using Perl, Unix Script, and Awk. Perl
indirectly support CORBA, therefore the application is CORBA compliance.
Is this true that using Perl implies that you are CORBA compliance?
Thanks for your help.
------------------------------
Date: Sat, 23 Jan 1999 13:22:07 -0600
From: Joe Laffey <joe@laffeycomputer.com>
Subject: Re: HELP WANTED: Appending a text file.
Message-Id: <Pine.LNX.4.05.9901231320120.11347-100000@tripe.laffeycomputer.com>
On 23 Jan 1999, Jonathan Feinberg wrote:
> networks@skynet.co.uk writes:
>
> > open (DATAFILE, ">>names.txt");
>
> You should always check the success of system calls.
>
> open(FOO, bar) || die $!;
>
> > but how do I add the new information to the file? the info will be one
> > word.
>
Always check the return values, true. Here's a little info to get you
going:
If you open a file with a filehandle named DATAFILE (as above) then you
simply use:
print DATAFILE "Hello World!\n";
to write to the file. print by default uses STDOUT, but in this case you
are telling it to use your filehandle.
> Whether one word or a million, your answer lies here:
>
> $ perldoc -f print
>
> But you *really* need to buy yourself a copy of _Learning Perl_.
Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
http://www.laffeycomputer.com/
------------------------------
------------------------------
Date: Sat, 23 Jan 1999 14:56:33 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: HELP!! Perl Viewer??
Message-Id: <1dm37p3.1w4kpn71l0hgz3N@bay3-199.quincy.ziplink.net>
[posted and mailed]
Julian Daniel <hachon@hotmail.com> wrote:
> i will
> be next week visiting a customer and developing there a few perl scripts.
> the customer has not a server with perl installed (nor will i have telnet
> access to my office server) so i want a tool for windows95 PC with which i
> can at least test if the scripts i'm developing with the customer do what
> they are supposed to do or if they are at all syntactically correct.
The only thing that can parse Perl is perl. Sounds like your client
will want to install Perl on one of their Win95 machines.
<http://www.activestate.com/activeperl/>
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 23 Jan 1999 10:45:12 -0800
From: Abraham Grief <abey@hill.ucr.edu>
To: Julian Kuiters <j.kuiters@bigpond.com>
Subject: Re: help?!: how to change a date to seconds since EPOCH
Message-Id: <Pine.LNX.4.05.9901231040030.14056-100000@hill.ucr.edu>
Depending on the format of the date, you might want to consider using the
timelocal() function in the Time::Local module. It does the reverse of
localtime, i.e., timelocal(localtime) is equivalent to time.
On 23 Jan 1999, Julian Kuiters wrote:
> Does anyone know the easiest way to convert a date back to seconds past
> EPOCH?
>
> thanx
> Julian
>
>
------------------------------
Date: Sat, 23 Jan 1999 20:24:09 +0100
From: n8twatch <n8twatch@usa.net>
Subject: language support
Message-Id: <36AA21D9.F89D6E7C@usa.net>
i'm a newbee on perl.
is there any language support for example for german 'cause i have some
problems with the characters like v V | \ d D and some problems with the
french characters like i h ` g.
the problems are for example:
by capitalising (uc) or uncapitalising (lc) or matching with option i.
thx in advance.
------------------------------
Date: 23 Jan 1999 20:32:56 GMT
From: "Michael Hvrmann" <michael@mismatch.com>
Subject: Re: language support
Message-Id: <78dblo$gid$1@goof.de.uu.net>
n8twatch <n8twatch@usa.net> schrieb in Nachricht
36AA21D9.F89D6E7C@usa.net...///
>i'm a newbee on perl.
>
>is there any language support for example for german 'cause i have some
>problems with the characters like v V | \ d D and some problems with the
>french characters like i h ` g.
>
>the problems are for example:
>by capitalising (uc) or uncapitalising (lc) or matching with option i.
>
>
>thx in advance.
I've had a similar problem under NT, and I've come up with the following
workaround subroutine:
sub icase {
local ($_, $toupper) = @_;
my $upper = "[A-Z]SO@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^Y";
my $lower = "[a-z]so`abcdefghijklmnopqrstuvxyz{|}~";
if (defined $toupper) {
($toupper) ? (eval "tr/$lower/$upper/") : (eval "tr/$upper/$lower/");
die $@ if $@;
} else {
print "usage: icase(\$string, \$case)\n\$case = 1 to convert to upper
case, \$case = 0 to convert to lower case\n\n";
}
return $_;
}
Not the greatest of hacks, admittedly ...
BTW, on Unix machines "\U and \L will pay attention to locale information"
(the Camel book, also true for uc() and lc()).
>i'm a newbee on perl.
>
>is there any language support for example for german 'cause i have some
>problems with the characters like v V | \ d D and some problems with the
>french characters like i h ` g.
>
>the problems are for example:
>by capitalising (uc) or uncapitalising (lc) or matching with option i.
>
>
>thx in advance.
------------------------------
Date: Sat, 23 Jan 1999 19:43:30 +0100
From: "Karl" <karl@nospamaddYproline.at>
Subject: need Fcntl.pm and SDBM_File. Where to get it?
Message-Id: <78d589$6l2$1@fleetstreet.Austria.EU.net>
I got a script with an application witch needs:
use Fvntl qw(:flock);
use SDBM_File;
or alternativly Fcntl.
Tried on CPAN, but only found directories and no moduls inside. any ideas
are greatly appreziated.
Please email also to karl@proline*at.
change the star to dot.
many thanks,
Karl
------------------------------
Date: Sat, 23 Jan 1999 13:25:14 -0600
From: Joe Laffey <joe@laffeycomputer.com>
Subject: Re: Need script for .htpasswd file
Message-Id: <Pine.LNX.4.05.9901231322580.11347-100000@tripe.laffeycomputer.com>
> Re: Need script for .htpasswd file, JS
> <js149@hotmail.com> said:
>
> JS> I have no problem using the .htaccess/.htpasswd
> JS> mechanism because I've done it before. Since we
> JS> have 400+ members, what I don't want to do is to
> JS> sit and manually input each ID and password for
> JS> encryption. Does anyone have a script or utility
> JS> that will input a text file containing all 400+
> JS> ID/password combos (one per line) and output a
> JS> file containing the 400+ encrypted passwords
> JS> (preferably in the .htpasswd format).
>
> perldoc HTTPD::UserAdmin
I have not tried HTTPD:UserAdmin, but there is another module called
Aapche::Htpasswd that I use frequently. It makes accessing the passwd file
very easy. You can simply open your text file and read each line; parse
the line into the username and password; and then pass these to the
easy-to-use function in Apache::Htpasswd. You can get it from www.cpan.org
(where else?)
Good luck,
Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
http://www.laffeycomputer.com/
------------------------------
------------------------------
Date: 23 Jan 1999 20:31:03 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Need script for .htpasswd file
Message-Id: <83emol23d4.fsf@vcpc.univie.ac.at>
Re: Need script for .htpasswd file, Joe
<joe@laffeycomputer.com> said:
>> Re: Need script for .htpasswd file, JS
>> <js149@hotmail.com> said:
>>
JS> I have no problem using the .htaccess/.htpasswd
JS> mechanism because I've done it before. Since we
JS> have 400+ members, what I don't want to do is to
JS> sit and manually input each ID and password for
JS> encryption. Does anyone have a script or utility
JS> that will input a text file containing all 400+
JS> ID/password combos (one per line) and output a
JS> file containing the 400+ encrypted passwords
JS> (preferably in the .htpasswd format).
>> perldoc HTTPD::UserAdmin
please attribute correctly
thanks
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Sat, 23 Jan 1999 14:56:34 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie - Whats wrong with this script?
Message-Id: <1dm38p9.dq9afq29dlhN@bay3-199.quincy.ziplink.net>
[followups set - no relevance to clp.modules]
Michael J. Bahr <targa@cornhusker.net> wrote:
> Extremely new to perl - go easy.
>
> I get this error -
> Can't modify subroutine entry in scalar assignment at
> E:\XITAMI\cgi-bin\netimage.cgi line 20, near "$hosts;"
> Execution of E:\XITAMI\cgi-bin\netimage.cgi aborted due to compilation
> errors.
Other posters have already pointed out the many other things to be fixed
in this script. So I'll just address this specific error message you
are getting...
> while() { # While any failing nodes
> chop; take off extraneous
> $xy = $hosts{$_}; # Lookup x,y coordinate
You forgot the comment character '#' before the comment on line 20.
take off extraneous $xy = $hosts{$_};
looks to Perl like an assignment to a subroutine call.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 23 Jan 1999 13:37:27 -0500
From: Kevin Chester <chester@ultranet.com>
To: Rick Delaney <rick.delaney@home.com>
Subject: Re: Newbie question: writing file
Message-Id: <36AA16E7.A486430D@ultranet.com>
Thanks for your quick reply! I made the change and received this error msg.
Cannot open tokens/285789068 for writing: Permission denied
Before I started the script I telnet'd from the cgibin "chmod 755
cart.cgi". I thought this was the correct setting.
Kevin
Rick Delaney wrote:
> [posted & mailed]
>
> Kevin D. Chester wrote:
> >
> > Hello Perl Group,
> >
> > What am I doing wrong here?
> >
> > #! /usr/local/bin/perl5.003
> ^^^^^
> You should consider an upgrade, but that's not your problem.
>
> > ...
> > open(token_file, ">$token_file_name") || &err_trap("Cannot open
> > $token_file_name for writing\n");
> > print(token_file "$token\n");
> > close token_file;
> > ...
> >
> > All I get is "Cannot open tokens/262805729 for writing ".
>
> If you want to know the reason the file couldn't be opened for writing,
> you will have to modify &err_trap to tell you.
>
> Something like:
>
> open(TOKEN_FILE, ">$token_file_name")
> || die "Can't open $token_file_name for writing: $!\n";
>
> It is customary to use all uppercase for filehandles so that they stand
> out. The key thing here is $! which gives the system error string.
>
> perldoc perlvar
>
> --
> Rick Delaney
> rick.delaney@shaw.wave.ca
--
==========================================
Kevin D. Chester chester@ma.ultranet.com
==========================================
------------------------------
Date: Sat, 23 Jan 1999 13:02:23 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: ok please don't shoot me for this question
Message-Id: <36AA0EAF.7D69E4B8@snailgem.org>
Familie Elst wrote:
>
> Ok, is there anybody who can write me a guestbook script without banners in
> perl
> or tell me where I can find it ?
> I was trying to write one but my brain has burned out and I really have a
> deathline.
Gee, this sounds terribel: I know about lifelines, what's a deathline?
--
Eugene
"I have an Apache Web Server that uses CGI forms written in COBOL."
Post in clpm
------------------------------
Date: Sat, 23 Jan 1999 20:00:28 +0100
From: "Familie Elst" <elst.fels@nospam.ping.be>
Subject: Re: ok please don't shoot me for this question
Message-Id: <78d65f$dui$1@news3.Belgium.EU.net>
OK, deadline then ... please help
Eugene Sotirescu heeft geschreven in bericht
<36AA0EAF.7D69E4B8@snailgem.org>...
>Familie Elst wrote:
>>
>> Ok, is there anybody who can write me a guestbook script without banners
in
>> perl
>> or tell me where I can find it ?
>> I was trying to write one but my brain has burned out and I really have a
>> deathline.
>
>Gee, this sounds terribel: I know about lifelines, what's a deathline?
>--
>
>Eugene
>
> "I have an Apache Web Server that uses CGI forms written in COBOL."
> Post in clpm
------------------------------
Date: Sat, 23 Jan 1999 19:36:59 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: ok please don't shoot me for this question
Message-Id: <36AA26B3.EC14E816@home.com>
Familie Elst wrote:
>
> Ok, is there anybody who can write me a guestbook script without banners in
> perl
> or tell me where I can find it ?
I'm not going to shoot you, but you are in the wrong place. If you want
someone to write you a script, you should put an add in a group with
'jobs' in it. If you just want to find one, try a search engine like
Yahoo.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 23 Jan 1999 19:57:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Passing array references.
Message-Id: <36ad2684.1761225@news.skynet.be>
OM wrote:
>What I then want to do in the function is to only print elements of the
>array, as specified in the list of numbers.
Why don't you just go ahead, select just the items you want printed,
without/before calling the function? You CAN suffix an array when
prefixed with "@", with several indices, and you'll just filter out
those elements. Note that even repitition is allowed.
A simple example:
@alphabet = (" ",'A' .. 'Z');
print @alphabet[10,21,19..20,0..1,14..15,20,8,5,
18,0,16,5,18,12,0,8,1,3,11,5,18];
Bart.
------------------------------
Date: 23 Jan 1999 19:42:10 GMT
From: "Michael Hvrmann" <tmp@he.net>
Subject: perl bug with substitution via subroutine?
Message-Id: <78d8mi$ean$1@goof.de.uu.net>
Hi all,
in the following script (don't tell me it's silly, it's only there to
demonstrate the problem) I use the /e switch on a substitute operation to
pass $1 to a function. However the corresponding function parameter $_[0] is
reset after a second substitute operation occurs within that function. As a
consequence, the second print command doesn't produce any output -- except
for a "Use of uninitialized value" message with the -w switch.
When I call the function from outside a substituion (&handler("bar");
instead of s/foo(bar)/&handler($1)/e;) $_[0] everything works fine.
$_ = "foobar";
s/foo(bar)/&handler($1)/e;
sub handler {
my $bar = $_[0];
print "here's a bar: $_[0]\n";
$bar =~ s/bar/foo/g;
print "wish there was a bar: $_[0]\n";
return $bar;
}
What's up? Is there a bug in perl? Or is there some point that I missed
about $1 and friends on the one hand and @_ on the other? I'm using perl,
version 5.005_02, ActiveState build 506 on an NT SP 4 machine.
MH
------------------------------
Date: Sat, 23 Jan 1999 21:50:33 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Perl Criticism
Message-Id: <36AA3619.6217495D@ngb.se>
topmind@technologist.com wrote:
> If I hear this flippen' MYTH stated one more time, I am going to
> have Norton classify Perl as a virus.
>
> ALL LANGUAGES ARE NOT EQUALLY ABUSABLE!!!!!!!
Maybe not. But I would argue that it's not the languages abusability
that is the biggest risk. The biggest risks come from languages that
SEEM to make complicated things simple. These languages invite people
who have no clue what they are doing to do things they don't know how to
do. Most bad code, if you ask me, is found in such languages, where
people with to small experience in programming write programs to do
complicated tasks. Such programs are leaky and hard to read.
Perl has features that makes it very easy to use for some things. You
can do the simplest tasks in quite obvious ways. When it becomes more
difficult, there is usually plenty of examples to look at in easily
available documentation. But for the really tricky tasks I find that
perl (as a language and as a community) always pushes me to investigate
the task further. Unless there is something in CPAN that does it for me,
that is.
> I am not going to explain it again.
I don't believe you ever DID explain it. Have you ever stated EXACTLY
what makes perl easy to abuse. I haven't really found any hard proof or
good examples in this thread.
And for your argument that everything (more or less) should be made into
a function, I only have to say: Look at mathematics. Here you have the
best examples of good and bad notation. Older notation gives way for new
notation all the time, because the new notation represents the problem
in a clearer way. One obvious example is the Leibnitz rule for
derivatives:
dx dy dx
-- -- = --
dy dz dz
Note that we're not talking about division here, but simply because of
the notation, this beautiful rule feels natural to us. If you would
write it like
D x(y(z)) D y(z) = D x(y(z))
y z z
It doesn't feel quite as natural. Imagine it with functional notation:
Multiply( Derivative( x(y(z)), y ), Derivative( y(z), z ) ) =
Derivative( x(y(z)), z )
What I'm trying to say is: Notation is important. Often functional
notation is not the best way to show something -- it is not the notation
that is most natural to the thing your applying it to. And now I'm not
talking about notation that is natural to the computer -- it doesn't
care, but I'm talking about notation that is natural to the human.
If a language gives the user the possibility to use the notation that
feels most natural for the task at hand, this must give the user a
greater possibility to write readable code, since most people feel the
same way about what notation feels natural for a certain task.
Also: A language that has a natural notation for different tasks should
be easier to learn and does invite you to write better code, simply
because it gives you a clearer view of the problem at hand.
As people have expressed here before -- perl gives you some
possibilities to write code with an intensional meaning, and not just a
functional ditto. This is something pretty good if you ask me.
Personally, I must say that going from TOP to perl is like going from
writing an instruction of how to use a spoon to writing a poem or a
fantasy novel, and I'm afraid I'm not kidding.
Staffan
------------------------------
Date: Sat, 23 Jan 1999 13:17:55 -0600
From: Joe Laffey <joe@laffeycomputer.com>
Subject: Personal lib dir - please help
Message-Id: <Pine.LNX.4.05.9901231306590.11347-100000@tripe.laffeycomputer.com>
Hi,
I'm trying to port a series of scripts that use MLDBM (as consequently
Storable, DB_File, and Data::Dumper) from my linux box to a Sun Ultra
Sparc. The Sun box now has perl 5.00502 I have 5.004 on the linux box.
I need to have my own personal lib directory because the Sun box belongs
to an ISP and I cannot install system-wide modules.
I built all of the modules using
%perl Makefile.PL PREFIX=/usr/home/me/mylib
%make test
%make install
I installed DB_File first, then Data::Dumper, then Storable, and finaly
MLDBM. This put files into different subdirs in mylib dir. I got
sun4-solaris directories and 5.00502 dirs and 5.005 dirs and a site_perl
dir.
In my script I write:
use lib "/usr/home/me/mylib"
Only the modules that were actually installed in the directory explicitly
named above could be found. Although perl reported that @INC includeded
all of the subdirs. So I moved all the .pm files to the mylib dir and all
the auto files to a mylib/auto. Now I get:
Can't locate object method "new" via package "MLDBM::Serializer::Storable"
at /usr/home/me/mylib/lib//MLDBM.pm line 132.
Storable is in the directory
/usr/home/me/mylib/lib/MLDBM/Serializer/Storable.pm
I tried moving Storable's auto files into
/usr/home/me/mylib/lib/MLDBM/Serializer/auto
and that did not work.
Anyone have any ideas how to get this to run correctly? Anyone wanna smack
me for developing the script under linux first?
Thanks for your time!
Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
http://www.laffeycomputer.com/
------------------------------
------------------------------
Date: 23 Jan 1999 10:57:56 -0900
From: corliss@loki.org (Arthur Corliss)
Subject: Re: PROOF: Jesus is NOT LORD of the Sabbath! =?iso-8859-1?Q?=AC=BA_=A8=B5=C7`=B0=A8?=
Message-Id: <slrn7akap1.dr.corliss@loki.org>
On Sat, 23 Jan 1999 04:59:56 -0500, MindSpring User
<kdp10@mindspring.com> wrote:
>How about a little compassion the my friend ... hate is what is tearing this
>world apart ... only unconditional love, compassion, and acceptance are
>gonna make a difference ... granted most Bible thumpers have to learn this
>much more than the rest of us ... but it has to start someplace ....
Please. There is a time and a place for all this nonsense. In a Perl news
group, it's never the place. Those who can't keep the signal to noise ratio
down should be banned.
<Sheesh> Of course, I just added to the noise level. . . :-P
--Arthur Corliss
Bolverk's Lair -- http://www.odinicfoundation.org/arthur/
"Live Free or Die, the Only Way to Live" -- NH State Motto
------------------------------
Date: Sat, 23 Jan 1999 18:46:38 GMT
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: Question concerning perl and NT
Message-Id: <slinberg-2301991346390001@cc11620-a.lwmrn1.pa.home.com>
In article <36A95CCD.4908CF5D@OnlineRAGE.com>, "Ronnie D. Jewell"
<jewell@OnlineRAGE.com> wrote:
> Hi All,
>
> I have a script that is supposed to read and append a file. I have
> everything in the cgi-bin on a virtual host and when I run the script
> from a browser it will read the file but will not allow me to write to
> it.... I thought anything under the cgi-bin had full rights? Script
> works corretly on unix machine.... I have even tried using the full path
> to make sure it is correct.....
>
> Any thoughts??
The web server has whatever rights you grant it. There's nothing magic
about cgi-bin in that regard. Check the rights you've granted the server,
and the file/directory permissions you're concerned with.
------------------------------
Date: Sat, 23 Jan 1999 20:15:14 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Question concerning perl and NT
Message-Id: <m5qq2.186$Vc4.594@news12.ispnews.com>
[Posted and Emailed] In article <36A95CCD.4908CF5D@OnlineRAGE.com>,
jewell@OnlineRAGE.com says...
>
>Hi All,
>
>I have a script that is supposed to read and append a file. I have
>everything in the cgi-bin on a virtual host and when I run the script
>from a browser it will read the file but will not allow me to write to
>it.... I thought anything under the cgi-bin had full rights? Script
>works corretly on unix machine.... I have even tried using the full path
>to make sure it is correct.....
Make certain the Anonymous Web User has "CHANGE" [file] permissions for the
/cgi-bin directory, perhaps the default on your system is "READ".
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day, Inc.--
| http://www.interact2day.com/
------------------------------
Date: Sat, 23 Jan 1999 18:15:14 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: thanks
Message-Id: <36AA1388.490B3DC@home.com>
[posted & mailed]
Lori Flynn wrote:
>
> Hi Rick,
>
> Thanks for figuring out my hash problem! Also, the perldoc perlref lead
> was a good place to go for more info, thanks again...
Hooray! Someone who appreciates a pointer to the docs!
You are very welcome. Please come again.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 23 Jan 1999 14:56:36 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Writing files
Message-Id: <1dm3aci.yd9yq3qn6fedN@bay3-199.quincy.ziplink.net>
R. Alcazar <alcazar@netcomp.net> wrote:
> I'm trying to do something quite simple... however, its got me stumped.
> All I wanna do is open a file (thus, creating a new file) inside of a
> directory store in my webserver. However, it fails and returns an error:
> permission denied. Such that:
>
> open(SOMEFILE, "/somedirectory/somefile.txt") || die "$!\n";
I don't believe you can create a file by opening it for reading. Try
opening for writing instead.
> I've checked the file permissions, and the only way I can get it to
> write to that directory is if I specify 777 on that directory. (Which is
> obviously what I DON'T want to do). It seems that (at the very least) in
> order for me to open/create a file inside that directory I need permissions
> of 007. I wrote another script outside of my prog which does the same thing
> and that seems to be working fine.
What userid does your original, working program run as?
What userid does your new, non-working program run as?
As you mention a webserver, I suspect that your new program is a CGI
script, in which case it is probably as the user 'nobody' or equivalent.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 23 Jan 1999 20:30:55 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Writing files
Message-Id: <36AA3357.6674DCD1@home.com>
Ronald J Kimball wrote:
>
> I don't believe you can create a file by opening it for reading.
use Fcntl;
sysopen(FH, $file, O_RDONLY | O_CREAT) or die "Can't open: $!\n";
Why one would do this, I don't know, but it can be done.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4732
**************************************