[12993] in Perl-Users-Digest
Perl-Users Digest, Issue: 403 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 6 12:07:13 1999
Date: Fri, 6 Aug 1999 09:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 6 Aug 1999 Volume: 9 Number: 403
Today's topics:
a time to kill <tchrist@mox.perl.com>
Re: another question: quoting strings that already need (Matthew Bafford)
Re: build search engine <smiles@wfubmc.edu>
CGI.pm on NT <smiles@wfubmc.edu>
Re: CGI.pm on NT <tavi367@ibm.net>
Re: chomp not working <aqumsieh@matrox.com>
Getting return value from .exe called from system rick_bindview@my-deja.com
Re: Getting return value from .exe called from system (Matthew Bafford)
Re: Help with form input to ouput in another frame? (brian d foy)
Re: High demand for Perl programmers? <dwoods@ucalgary.ca>
How [not] to be Y2K compliant <flavell@mail.cern.ch>
Re: How [not] to be Y2K compliant <tchrist@mox.perl.com>
Re: How do I replace a "space" character? <aqumsieh@matrox.com>
Re: How to determine data-type? (Greg Bacon)
Re: How to determine data-type? (Matthew Bafford)
Re: looking for XML comments (brian d foy)
Mime:Lite problems (mail with attachments) lucap@my-deja.com
Re: My Last Words on => vs comma <aqumsieh@matrox.com>
Re: Nastiness contrary to the spirit of perl? <uri@sysarch.com>
Re: Nastiness contrary to the spirit of perl? <sariq@texas.net>
Re: Nastiness contrary to the spirit of perl? (I R A Darth Aggie)
Re: NE Deprecated? (Chris Nandor)
Re: net:FTP install <jpeterson@office.colt.net>
Re: qr{} and quoting pattern metachars (Anno Siegel)
Re: Question about hashes ? (I R A Darth Aggie)
Quick Question :) <iberg@montana.edu>
Return value from .exe that was called with system rick_bindview@my-deja.com
Re: smrsh and Perl Script: unknown mailer error 13 <anfi@bigfoot.com>
Re: SSH2, Need a little help <sariq@texas.net>
Re: Turning off cashing from Perl??? <flavell@mail.cern.ch>
Re: unpack to a hash? (Bart Lateur)
Re: Why is it.... [REPOST] (I R A Darth Aggie)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Aug 1999 09:41:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: a time to kill
Message-Id: <37ab0227@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, fl_aggie@thepentagon.com (I R A Darth Aggie) writes:
:Fine. You know who we are. Get a killfile, stick us in it, and be done
:with it. And provide that killfile to the newbies, so they can ignore
:us, too.
Two can play at that game. I see that it's time to put together and
post a comprehensive killfile again.
Here are my annotated suggestions for trn auto-kill and auto-select
entries, grouped and explained. Pick and choose as you will. I imagine
these will cause some flames, but I also imagine I won't be reading them,
since most will trigger a kill rule. :-)
Let's do the selects before the kills. Now, who's worth reading? First,
the whole thread selectors. You may wish to modify the second names :-)
/Larry Wall/f:T+
/Tom Christiansen/f:T+
/tchrist/f:T+
Now the subthread selectors:
/Damian Conway/f:T.
/Gurusamy Sarathy/f:T.
/Malcolm Beattie/f:T.
Now the article selectors. Not all are current, for long ago they passed
away to Mordor where the shadows lay.
/abigail/f:+
/Alan.*Flavell/f:+
/Andy Dougherty/f:+
/Chip Salzenberg/f:+
/Dean Roehrich/f:+
/Dominus/f:+
/Eric Arnold/f:+
/Friedl/f:+
/gnat/f:+
/Jarkko/f:+
/Nick Ing/f:+
/orwant/f:+
/Robert.*Seymour/f:+
/rosler/f:+
/Sriram Srinivasan/f:+
/sriram@weblogic.com/f:+
/Tim.Bunce/f:+
/Torkington/f:+
Are there any subject that cool enough to select? Sure, but it varies
between reader. Here are some of mine:
/conference/:+
/data.*structure/:+
/inheritance/:+
/poetry/:+
/Larry Wall/:+
/lwall/:+
Note that those last two are subject lines, not from lines.
Ok, enough of that selection crud. It's now a time to kill; the goal
is to read less crap. We'll start with broad rules first, then specific
ones. First, kill anything with too many crosspostings:
/xref:.*:.*:.*:.*:.*:/Hxref:j
Now kill any "spamblocked" addresses. If they want to be read, they can
bloody well use their own address. I don't believe in address munging.
Let them munge themselves into oblivion. This is not an acceptable
way to fight spam.
/\bspam/h:j
Now we shoot all the MIMEs. Usenet is a text medium. Don't
get me started. This is a beautiful thing.
/Content-Type: multipart/h:j
Blessèd is he who heeds these advisories:
/-Mailer:.*Microsoft/h:j
/-Mailer:.*Win/h:j
/-Newsreader:.*Microsoft/h:j
/-Newsreader:.*Win/h:j
Since I've just now pissed off nearly everyone I'd rather not read,
let's add the others, too. The quality of postings from these sites is
too low to bother annoying oneself with by reading:
/\baol\b/f:j
/\bdeja/f:j
/hotmail/f:j
Here are posters who've proven just too nasty for cohabitation.
Some are killed worse than others; that is, we kill their children's
children's children as well, yea even unto the Nth generation of
them that piss sulfuric vitriol in your mouth and eyes and serenity:
/Erik Naggum/f:T,
/Gary.*Burnore/f:T,
And here are regular kills. Some are annoying recruiters. Some I no
longer recall why they're dead, but dead they are and dead they'll be
the very next time their posts I'll see.
/Ategra/f:j
/Cerberus Nabokov/f:j
/Dave Beckstrom/f:j
/John Stanley/f:j
/linda lollipop/f:j
/lornkcor/f:j
/Perchansky/f:j
/Silicon Alley Connections/f:j
/why.invite.flames/f:j
And here are subjects that I'm happier never seeing. I'll group these
into categories.
First we kill anybody so clueless as not to include lower-case letters
in their subject. STOP SHOUTING, YOU NIMRODS!
/^Subject:[Re: ]*[^a-z]*$/c:j
Perl 4 is dead. Dead dead dead dead. Dust it was and dust 'twill be
next time a post on it I'll see.
/perl *4/:j
Here are the "noise" posts whose subjects indicate they should have
been spamboxed long ago, but somehow the newsadmins missed them:
/^adv*:/:j
/\bjob\b/:j
/fast money/:j
/FREE/c:j
/\$\$\$/:j
/jesus/:j
/make money/:j
/MISSING PERSON/c:j
/money fast/:j
/no subject/:j
/(none)/:j
/quick money/:j
/recruiter/:j
/shareware/:j
/^test/:j
Out, out, you demons of stupidity!
/\bgurus*/:j
/\bhelp\b/:j
/\bnewb[ieys]*\b/:j
/!!!/:j
/???/:j
/novice/:j
/please read/:j
/please/:j
/urgent/:j
/wanted/:j
Nothing shall bring you greater joy than these next entries:
/advert/:j
/banner/:j
/\bcgi/:j
/\bcounters?\b/:j
/\bform\b/:j
/\bforms?\b/:j
/\bhtml*\b/:j
/browser/:j
/\burl\b/:j
/button/:j
/\bweb\b/:j
/cgi-lib/:j
/cookie/:j
/download/:j
/drop-*down/:j
/engine/:j
/frame/:j
/guest *book/:j
/http/:j
/java/:j
/odbc/:j
/page/:j
/password/:j
/pop-*up/:j
/proxy/:j
/redirect/:j
/referr*er/:j
/referr*ing/:j
/remote/:j
/script header/:j
/search/:j
/server error/:j
/server/:j
/site/:j
/upload/:j
/www/:j
Quell the querulous querents who can't read a FAQ:
/attachment/:j
/\bcsv\b/:j
/\becho/:j
/\be-*mails*\b/:j
/\block/:j
/\bround/:j
/color/:j
/comma.delim/:j
/comma.sep/:j
/flush/:j
/^how can\b/:j
/^how do\b/:j
/install/:j
/menu/:j
/passwd/:j
/trim/:j
Look upon me ye mighty, and despair:
/activeperl/:j
/activestate/:j
/\bAccess.?9/c:j
/\bCR\b/:j
/\bDOS\b/:j
/\bExcel\b/c:J
/\biis\b/:j
/\bM*IIS\b/c:j
/\bMS\b/c:j
/\bMS\b/:j
/\bNT\b/:j
/\bOLE\b/c:j
/\bPC\b/:j
/carriage[- ]*return/:j
/DOS\b/c:j
/dosperl/:j
/microsoft/:j
/\bMS/:j
/NT/c:j
/ntperl/:j
/odbc/:j
/PerlII*S\.dll/:j
/\bw2k\b/:j
/\bwin2/:j
/win *32/:j
/win *95/:j
/win *98/:j
/win *00/:j
/win3\.1/:j
/Windows/:j
/winnt/:j
Here are systems or subsystems I don't myself have anything to do with,
and therefore don't really care much about. Others may have different
needs.
/\bdbi/b/:j
/\be*macs*\b/:j
/\bsql\b/:j
/\bVMS\b/:j
/database/:j
/hp-*ux/:j
/irix/:j
/mac *os/:j
/macintosh/:j
/msql/:j
/mysql/:j
/oracle/:j
/oraperl/:j
/solaris/:j
/sybase/:j
/sybperl/:j
/xml/:j
Pax vobiscum.
--tom
--
There is no problem so small that it can't be blamed on Datakit --Andrew Hume
------------------------------
Date: Fri, 06 Aug 1999 15:08:57 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: another question: quoting strings that already need to be in quotes for a system call.
Message-Id: <slrn7qlu1j.tkp.*@dragons.duesouth.net>
On Fri, 06 Aug 1999 14:49:20 GMT, chrisman81@my-deja.com spewed forth:
: system("grep $name $location >file");
system "grep '$name' $location >file" or
system qq{grep "$name" $location >file"} or
system qq<grep '$name' $location >file">;
: Thanks
HTH
--Matthew
------------------------------
Date: Fri, 06 Aug 1999 11:02:22 -0400
From: Steve Miles <smiles@wfubmc.edu>
Subject: Re: build search engine
Message-Id: <37AAF8FE.25C15B66@wfubmc.edu>
Try:
http://www.cgi-resources.com
http://www.gossamer-threads.com/scripts/links
------------------------------
Date: Fri, 06 Aug 1999 11:06:48 -0400
From: Steve Miles <smiles@wfubmc.edu>
Subject: CGI.pm on NT
Message-Id: <37AAFA08.FC06543B@wfubmc.edu>
Hi!
Does anyone use the CGI.pm module on NT? I've written a lot of scripts
using CGI.pm on a Unix server and whenever someone wants to use them on
a NT Server they never work. I haven't delved to far into this, but do
most NT hosting companies have the module installed - or is it that I'm
using a Perl command that just isn't suited for NT....
Any comments/suggestions appreciated.
Steve
=============================================
Steve Miles (smiles@wfubmc.edu)
Wake Forest University School of Medicine
5019 Hanes, Medical Center Blvd.
Winston-Salem, NC 27157
Phone: 336.716.0454 FAX: 336.716.7200
=============================================
------------------------------
Date: Fri, 6 Aug 1999 11:02:35 -0500
From: <tavi367@ibm.net>
Subject: Re: CGI.pm on NT
Message-Id: <37ab079f@news1.us.ibm.net>
Steve Miles wrote in message <37AAFA08.FC06543B@wfubmc.edu>...
>Hi!
Hello!
> Does anyone use the CGI.pm module on NT?
I use it, or used to use it.
I use cgi-lib.pl now because I don't need (as of now) 99% of what CGI.pm
does.
Anyway, I'ved used it with not real problems.
But I did make one small change to it so that the temp files where placed in
the proper location (the temp directory) and where removed properly.
Find this line...
# $TempFile::TMPDIRECTORY = '/usr/tmp';
You need to:
- Clone it
- Un comment it
- change '/usr/tmp' to be $ENV{'TEMP"}
BTW: Now, unlike most NT servers (which places the temp directory
at C:\TEMP) I have a complete vitrual volume as a temp space
(very UNIX-ish, I know, but it loves it!).
If you don't make this change, the temp files get dumped into the directory
your scripts live and there is a good chance that they will not be removed.
> I've written a lot of scripts using CGI.pm on a Unix server and
> whenever someone wants to use them on a NT Server they never work.
That could be for a lot of reasons. Not just CGI.pm
I guess I would like to know more of the nature of the problems.
> I haven't delved to far into this, but do most NT hosting companies
> have the module installed
I can only hazard a guess, yes, since it comes with the standard install of
Perl.
> or is it that I'm using a Perl command that just isn't suited for NT....
And what command is that?
It is my understanding that Linclon took a lot of pain to make sure the
CGI.pm works on UNIX and Win32 systems.
------------------------------
Date: Fri, 6 Aug 1999 09:55:42 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: chomp not working
Message-Id: <x3y672tc8td.fsf@tigre.matrox.com>
jembow@my-deja.com writes:
> #!/usr/bin/perl -w
> $x = "good night\n";
> chomp($x);
> print($x);
>
> yields the following error message. "Chop", however, works fine:
>
>
> "chomp" may clash with future reserved word at ./chomp_test line
> 3syntax error i
> n file ./chomp_test at line 3, next 2 tokens "chomp("
> Execution of ./chomp_test aborted due to compilation errors.
This should work fine. Type the following at the command prompt:
perl -v
and report the results. You seem to have an older Perl.
HTH,
Ala
------------------------------
Date: Fri, 06 Aug 1999 14:59:38 GMT
From: rick_bindview@my-deja.com
Subject: Getting return value from .exe called from system
Message-Id: <7oet8h$9k8$1@nnrp1.deja.com>
In my perl script I want to call an exe using
'system' that exe returns a number. However the
number I am getting back is 128. Not the number I
am looking for from the exe return.
Can anyone help?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 06 Aug 1999 15:28:56 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Getting return value from .exe called from system
Message-Id: <slrn7qlv7l.tqi.*@dragons.duesouth.net>
On Fri, 06 Aug 1999 14:59:38 GMT, rick_bindview@my-deja.com cut a
telephone line, and tapped the following to comp.lang.perl.misc using
only his tongue:
: In my perl script I want to call an exe using
: 'system' that exe returns a number. However the
: number I am getting back is 128. Not the number I
: am looking for from the exe return.
What are you doing blindly using functions without reading the
documentation for them?
: Can anyone help?
Try reading perlfunc.
perldoc perlfunc
--Matthew
------------------------------
Date: Fri, 06 Aug 1999 11:41:57 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Help with form input to ouput in another frame?
Message-Id: <brian-0608991142430001@rtp-cr45-dhcp-162.cisco.com>
In article <7o9pkv$94f$1@news2.vas-net.net>, "Chris Denman" <chris@inta.net.uk> wrote:
>In the form tag, specify a target for the results.
>
><form action=/cgi-bin/myprog.cgi method=post target=otherwindow>
>
>You cannot specify a target in the script itself.
yes you can. perhaps you should see the CGI MetaFAQ.
<URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
--
brian d foy
------------------------------
Date: Fri, 06 Aug 1999 09:31:26 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: Re: High demand for Perl programmers?
Message-Id: <7oev9q$bcu@ds2.acs.ucalgary.ca>
Thanks for the pointer...Dan
------------------------------
Date: Fri, 6 Aug 1999 17:06:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: How [not] to be Y2K compliant
Message-Id: <Pine.HPP.3.95a.990806170322.17374J-100000@hpplus03.cern.ch>
For those with strong nerves, this posting to the WWW CGI group
<37aa61fe@news5.newsfeeds.com>
seems to be an "object" lesson (sorry) in how not to use Perl.
Here's a taster:
if ($year == 99) {$fullyear = "1999";}
else {$fullyear = "20$year";}
Wibble.
--
"... The fire service had no explanation why the iguana
and the man were up the tree" - BBC teletext news item
------------------------------
Date: 6 Aug 1999 09:49:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How [not] to be Y2K compliant
Message-Id: <37ab0409@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Alan J. Flavell" <flavell@mail.cern.ch> writes:
:Wibble.
Interesting word; I like it. The OED calls it a dialectic form of
"weevil". There an Old English root of "wibb-" for beetle.
It also also has this entry:
wibble-wobble 'wIb(<e>)l'wob(<e>)l, colloq., reduplication of
wobble (with vowel-variation symbolizing alternation of movement:
cf. zigzag); hence wibble as a simple word (conjoined with
wobble). So 'wibbly-'wobbly (also simply wibbly), wibblety-wobblety
adjs., characterized by `wibbling and wobbling', unsteady; also
'wibbly-'wobbly sb., in phr. all of a wibbly-wobbly (nonce-use).
* 1847 Halliwell, - Wibble-wobble, unsteadily.
* 1871 L. W. M. Lockhart Fair to see ii, - The ample round red face,
which wibbled and wobbled in its billowy fatness.
* 1877 Holderness Gloss., - Wibblety-wobblety, shaky; tottering;
insecure. Wibble-wobble, to vibrate; to quiver; to oscillate.
* 1901 B'ham Daily Post 16 Dec. (E.D.D.) - His wibblely-wobblely
speeches.
* 1905 Motor-Car Jrnl. 23 Sept. 630/1 - The gait [of a motor-car]
was ungainly by reason of the wibbly-wobbly nature of a rear wheel.
* 1914 Daily News 5 June 6, - I..hauled myself up again, and with
wibbly knees crossed to the bushes south of the track.
* 1922 Joyce Ulysses 399 - Bless me,..I'm all of a wibbly-wobbly.
How were you using it?
--tom
--
: And it goes against the grain of building small tools.
Innocent, Your Honor. Perl users build small tools all day long.
--Larry Wall in <1992Aug26.184221.29627@netlabs.com>
------------------------------
Date: Fri, 6 Aug 1999 10:06:41 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How do I replace a "space" character?
Message-Id: <x3y4sidc8b2.fsf@tigre.matrox.com>
Makarand Kulkarni <makarand_kulkarni@my-deja.com> writes:
> [In article <37A9D807.44E903AA@texas.net>,
> Tom Briles <sariq@texas.net> wrote:
>
> > You have an unusual definition of 'spaces'.
> What do you mean unusual ?
He means that your code:
s/\s//g;
remove all occurrences of "white space" from a string. \s can match a
space, a newline (\n) or a tab (\t). The original poster only wanted
to remove spaces. So a \s isn't what you need there.
> > And tr is *much* quicker.
> I would like to know where I can find more stuff to read
> on how to write optimal PERL Programs. For example you
> say that 'tr' is faster than the scheme I was suggesting.
> Why ?
I can't think of anything that discusses optimizing Perl programs. You
optimize Perl programs just like you optimize any other program. There
is a useful module, though, called Benchmark (type 'perldoc
Benchmark') which is part of the standard distribution.
This module lets you benchmark various approaches to one task and
reports how much time each approach takes, on average. It could be
useful if you like to conduct your own tests.
HTH,
Ala
------------------------------
Date: 6 Aug 1999 15:06:36 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: How to determine data-type?
Message-Id: <7oetls$nlt$9@info2.uah.edu>
In article <37AAF697.95D544EA@ireland.sun.com>,
Peter Doyle <peter.doyle@ireland.sun.com> writes:
: I have a hash containing strings, arrays & hashes.
: How can I determine the type of a particular entry in the hash?
Use Perl's ref() operator. Find its documentation in the perlfunc
manpage.
: I would like to test for types then call the proper print function which
: would print out the arrays as a list, etc.
I recommend using the standard Data::Dumper module.
Greg
--
Anger is a gift.
-- rage against the machine
------------------------------
Date: Fri, 06 Aug 1999 15:17:31 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: How to determine data-type?
Message-Id: <slrn7qlud1.tkp.*@dragons.duesouth.net>
Fri, 06 Aug 1999 15:52:07 +0100, a great smashing of the head occured
against Peter Doyle <peter.doyle@ireland.sun.com>'s keyboard, causing
comp.lang.perl.misc to receive this:
: Hi,
: I have a hash containing strings, arrays & hashes.
array refs and hash refs.
: How can I determine the type of a particular entry in the hash?
my $type = ref $unknown;
: Thanks for your help,
HTH,
: Peter
--Matthew
------------------------------
Date: Fri, 06 Aug 1999 11:56:50 -0400
From: brian@pm.org (brian d foy)
Subject: Re: looking for XML comments
Message-Id: <brian-0608991157350001@rtp-cr45-dhcp-162.cisco.com>
In article <7oej8k$2070$1@news2.vas-net.net>, "Chris Denman" <chris@inta.net.uk> wrote:
>I'm sorry, I didn't realise that you had to be a 'member' to ask questions
>in this newsgroup.
>Also, what makes everyone so sure that this query is not perl related? I
because XML is not Perl.
>have spent the last 6 months developing a content management system using
>perl, and watched this group along the way for useful information. I have
>to upgrade my system so that the storage medium is XML and as perl has xml
um, XML is not a medium. it's a specification.
>Thanks for nothing comp.lang.perl.MISC
you need to emphasize the "perl" part.
and may i add, "thank YOU for nothing". you have only a handful
of posts oin this group and based on what i've read in DejaNews you've
either been wrong or off-topic. this is a community. if you play
nicely and contribute, you're more likely to get something out of it.
so far you don't seem to have done either.
--
brian d foy
------------------------------
Date: Fri, 06 Aug 1999 15:51:21 GMT
From: lucap@my-deja.com
Subject: Mime:Lite problems (mail with attachments)
Message-Id: <7of09l$c0p$1@nnrp1.deja.com>
I'm testing a script to send Email with attachments, and getting a
general error generated inside the Mime::Lite library:
Can't use string ("MIME::Lite") as a HASH ref while "strict refs" in use
at /usr/local/lib/perl5/site_perl/MIME/Lite.pm line 932, <> chunk 1 (#1)
(F) Only hard references are allowed by "strict refs". Symbolic
references are disallowed.
#!/usr/local/bin/perl -w
use diagnostics;
use CGI;
use Socket;
use MIME::Lite;
use Net::SMTP;
use strict;
(...)
my $mail_from = "anyone\@anyserver.it";
my $message_file = "filename.txt";
my $mail_file = "annullato.gif";
my $subject = "SUBJECT";
my $mail_to = "alp0\@bo.nettuno.it";
my $mime;
{
local $/;
$/ = undef;
local @ARGV;
@ARGV = $message_file;
my $main_message =<>;
$mime = new MIME::Lite( From => $mail_from,
To => $mail_to,
Subject => $subject,
Type => 'text/plain',
Data => $main_message);
}
my $type = ['image/jpeg','base64'];
$mime->attach( Type => $type->[0],
Encoding => $type->[1],
Path => '/usr/www/users/lucapost/
imgs'.$mail_file);
MIME::Lite->send('smtp','localhost',Timeout => 20);
$mime->send;
Any hints ???
Thanks, Luca_post
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 6 Aug 1999 10:35:19 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: My Last Words on => vs comma
Message-Id: <x3y3dxxc6zd.fsf@tigre.matrox.com>
"Perl King" <perlking@hotmail.com> writes:
> The point of my last post was to show that you can NOT use the
> corresponds-to operator everywhere you use the comma operator.
> In the case of the open example
>
> open PW => '/etc/passwd';
>
> it causes a syntax error.
Nope. No syntax errors. It causes a warning though:
% perl -we 'open PW => "/etc/passwd" or die "Ahem ..\n"; \
print "YEAH\n"'
Precedence problem: open PW should be open(PW) at -e line 1.
Name "main::PW" used only once: possible typo at -e line 1.
YEAH
It won't be very useful though in this case.
> It may cause unexpected errors in
> other code. In short, I see no reason to use "=>" instead of ",".
But there is a slight difference between the comma and =>. From
perlop:
The => digraph is mostly just a synonym for the comma
operator. It's useful for documenting arguments that come
in pairs. As of release 5.001, it also forces any word to
the left of it to be interpreted as a string.
This is often very useful, especially under 'strict'. Witness:
% perl -Mstrict -w
my %hash = (a, 1, b, 2);
Bareword "a" not allowed while "strict subs" in use at - line 1.
Unquoted string "a" may clash with future reserved word at - line 1.
Bareword "b" not allowed while "strict subs" in use at - line 1.
Unquoted string "b" may clash with future reserved word at - line 1.
__END__
Execution of - aborted due to compilation errors.
% perl -Mstrict -w
my %hash = (a => 1, b => 2);
__END__
See .. no warnings or errors when => was used instead of the comma. I
like that.
> The comment that "it looks better" just doesn't wash. A comma is
> used in virtually all programming languages to separate arguments
> and is easily recognized by programmers. The => can be confused
> with a structure pointer or branch operator. "=>" also requires
> extra keystrokes, and may be less efficient. I have not see it
> used anywhere in Perl books or standard code except for hash
> initialization. Using "=>" instead of "," just because you CAN
> makes me think of someone who prefixes numeric constants with "+" since "it
> makes them stand out more".
But why do use print() when there is printf()? Why do you use <> when
there is sysread()? Every person has his own taste, which he acquires
and refines with time. After all, the Perl's motto is TMTOWTDI.
Personally, I prefer using a comma only when referring to a list of
elements/object. Otherwise I would almost always use =>:
push @arry => $var;
unshift @arry => ($var1, $var2);
my %hash = (
key1 => val1,
key2 => val2,
);
I think this looks much better and focuses on what I am doing.
> My advice? Use the language as it was meant to be used, and don't
> try to decorate it! Perl is already beautiful enough as is.
But Perl was meant to be flexible and to give you many options. Use
whichever options you like. That is how it was meant to be used.
TMTOWTDI
> Perl King
Who crowned you?
-- Ala, the Perl peasant.
------------------------------
Date: 06 Aug 1999 11:23:35 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <x74sidgcg8.fsf@home.sysarch.com>
>>>>> "CIML" == Calum I Mac Leod <calum@bordernet.co.uk> writes:
CIML> No! I'm a Perl newbie and I don't want to killfile the people who
CIML> publish the most useful and informative posts.
CIML> Without these 'prodigious posters', this newsgroup would largely
CIML> consist of people who, rather than entering into disscussion about
CIML> Perl, expect others to do their work for them, for free. Just who is
CIML> it around here who has the 'bad attitude'?
CIML> All I can say is "Thanks!" to those Perl experts who continue
CIML> congregate in this public forum.
see, here is a newbie with a proper attitude. as always there are very
few nice people who can tolerate giving out the same answers to faqs
all day long. think about those burnouts on help desks! we just have
(rightfully so) shorter fuses here.
and i have seen many polite replies from even the most "nasty" ones here
(including tom, abigail, myself and others) to reasoned questions from
newbies who have tried and failed to grok some perl feature. it is the
cleless and rude newbies who we are railing against. so if reverse
'rocknroll' wants to answer all of those faqs be our guest. the quality
of the actual answers he has posted does not bode well though.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Fri, 06 Aug 1999 10:42:44 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37AB0274.97E02B9A@texas.net>
Uri Guttman wrote:
>
> >>>>> "CIML" == Calum I Mac Leod <calum@bordernet.co.uk> writes:
>
> CIML> No! I'm a Perl newbie and I don't want to killfile the people who
> CIML> publish the most useful and informative posts.
>
> CIML> All I can say is "Thanks!" to those Perl experts who continue
> CIML> congregate in this public forum.
>
> see, here is a newbie with a proper attitude.
I'd also like to point out that these are the newbies who will
eventually graduate to relative-newbie, then to...who knows?
The knowledge that I've gained just by *lurking* over the past several
months has been incredible...and worth twice what I paid for it! :)
I even feel confident in posting *answers* once in a while now...
- Tom
------------------------------
Date: 6 Aug 1999 15:44:44 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <slrn7qm0rh.916.fl_aggie@thepentagon.com>
On Fri, 06 Aug 1999 14:25:48 GMT, Calum I Mac Leod <calum@bordernet.co.uk>, in
<37aaee0f.86674443@news.ukgateway.net> wrote:
+ Without these 'prodigious posters', this newsgroup would largely
+ consist of people who, rather than entering into disscussion about
+ Perl, expect others to do their work for them, for free. Just who is
+ it around here who has the 'bad attitude'?
Wow. I sit here in awe. Or is it awk? ;)
+ Calum - (Just another Perl novice.)
James - Just Another Perl Journeyman
------------------------------
Date: Fri, 06 Aug 1999 16:00:29 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: NE Deprecated?
Message-Id: <pudge-0608991200340001@192.168.0.16>
In article <slrn7qknqe.uij.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:
>Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXVI September
>MCMXCIII in <URL:news:37aa4790@cs.colorado.edu>:
>$$ [courtesy cc of this posting mailed to cited author]
>$$
>$$ In comp.lang.perl.misc,
>$$ Jim Williams <james.p.williams@usahq.unitedspacealliance.com> writes:
>$$ :Why is NE deprecated?
>$$
>$$ Don't tell anybody I told you this, but that's the FORTRAN compatibility
>$$ mode. Witness:
>$$
>$$ % perl -le 'print uc "fred" EQ "FRED"'
>$$ 1
>
>
>And they say everything is found in the manual!
>
>
>Djee, I wonder which other cute Easter eggs there are.... ;-)
I actually found this out recently, when I was making some constants for
doing Apple events in MacPerl, and I had NE, EQ, LT, LE, GT, GE, and I got
all these bizarre warnings.
#!perl -w
%foo = (GT => 'gt');
use constant LE => 'le';
# Use of GT is deprecated.
File 'Untitled #2'; Line 2
# Ambiguous use of GT => resolved to "GT" =>.
File 'Untitled #2'; Line 2
# Use of LE is deprecated.
File 'Untitled #2'; Line 3
# Ambiguous use of LE => resolved to "LE" =>.
File 'Untitled #2'; Line 3
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 06 Aug 1999 15:32:26 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: net:FTP install
Message-Id: <eeDq3.478$uU3.3221@news.colt.net>
Jeff Miller <jeffm641@ibm.net> wrote:
> that you have mentioned, and I believe that if I had telnet it would be
> fairly straightforward to install in my webspace on my server. I am not
> sure
I strongly recommend ditching you ISP and getting one that allows users to
access their accounts with telnet. www.he.net works fine for me.
However, if I recall the Net::FTP module is perl perl and won't need compiling.
If you unzip the distribution, you should find a number of files ending in .pm
You can copy all of these to you ftp directory. You can let Perl know where to
find them by using the -I flag when you invoke perl.
But, much better to get an ISP that can handle telnet.
------------------------------
Date: 6 Aug 1999 16:00:13 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: qr{} and quoting pattern metachars
Message-Id: <7of0qd$ga1$1@lublin.zrz.tu-berlin.de>
Tom Christiansen <tchrist@mox.perl.com> wrote in comp.lang.perl.misc:
>I'll pretty much bet it's too change to fix this.
I'll spend the night wondering if that was deliberate...
Anno
------------------------------
Date: 6 Aug 1999 15:47:43 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Question about hashes ?
Message-Id: <slrn7qm113.916.fl_aggie@thepentagon.com>
On 6 Aug 1999 09:26:02 -0500, Abigail <abigail@delanet.com>, in
<slrn7qls2k.8m9.abigail@alexandra.delanet.com> wrote:
+ *ploink*
Is that the sound a newbie makes when it hits a killfile?
James
------------------------------
Date: Fri, 06 Aug 1999 09:53:07 -0600
From: Ivan Berg <iberg@montana.edu>
Subject: Quick Question :)
Message-Id: <37AB04E2.660D2F3F@montana.edu>
Anybody know how to add two binary number together.
When adding using th '+' operator I get a scientific notation number.
For instance, how would one add '011' and 100' and get '111'??
------------------------------
Date: Fri, 06 Aug 1999 15:02:40 GMT
From: rick_bindview@my-deja.com
Subject: Return value from .exe that was called with system
Message-Id: <7oete9$9ms$1@nnrp1.deja.com>
How can I get the value that was returned from the executable I called
using system? All I seem to get is what wait is returning 128 not the
number I was looking for. Can anyone help?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 06 Aug 1999 17:22:47 +0200
From: Andrzej Filip <anfi@bigfoot.com>
Subject: Re: smrsh and Perl Script: unknown mailer error 13
Message-Id: <37AAFDC6.8DD6B375@bigfoot.com>
Bruce Mohler wrote:
> I'm running Red Hat Linux 6.0 which seems to be running sendmail
> v8.9.3 which was built with support for smrsh.
>
> I need to have an account receive e-mail and pipe it to a Perl
> script for processing. This worked fine on a RH Linux 5.1
> system which was not configured for smrsh.
>
> The .forward file in the account's home directory looks like this:
>
> |/home/xyz/incoming.pl
>
> The permissions on the .forward file are 0600.
>
> The script resides in the home directory of account "xyz" with
> permissions 0755.
>
> The smrsh binary directory is /etc/smrsh and there is a symbolic
> from the /etc/smrsh directory to the Perl script in the account's
> home directory.
>
> ln -s /home/xyz/incoming.pl /etc/smrsh/incoming.pl
>
> Each time that I send e-mail to the "xyz" account on the system,
> the maillog reports "unknown mailer error 13".
>
> I did restart sendmail after creating the link in /etc/smrsh.
>
> I checked the Costales/Allman sendmail book 2nd ed., but the one
> reference in the index (p. 502) was not terribly enlightening.
> The majordomo FAQ suggested looking at errno.h to find out what
> the significance of "13" is and I finally found the <asm/errno.h>
> which says that it's EACCES "Permission denied".
>
> Any suggestions? I'm at a loss. I must be doing something stupid.
> I'd like to find out what it is so that I can stop it and move
> onto the next one...
Most likely your perl script returned exit code 13, so sendmail said
it does not know how to interpret it (sendmail wants codes listed in
sysexits.h).
--
Andrzej (Andrew) A. Filip | Warsaw, Poland | fax: +1(801)327-6278
anfi@bigfoot.com | anfi@polbox.com | http://bigfoot.com/~anfi
Postings: http://deja.com/profile.xp?author=Andrzej%20Filip
Who refuses a better job offer ?
------------------------------
Date: Fri, 06 Aug 1999 10:14:37 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: SSH2, Need a little help
Message-Id: <37AAFBDD.CACB6F94@texas.net>
Xeno Campanoli wrote:
>
> How do I do:
>
> @x = qw( C D . _ # M X N M V ALL )
>
qq
- Tom
------------------------------
Date: Fri, 6 Aug 1999 16:52:20 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Turning off cashing from Perl???
Message-Id: <Pine.HPP.3.95a.990806164027.17374I-100000@hpplus03.cern.ch>
On Fri, 6 Aug 1999, Dan Wilga wrote:
> Perhaps it is ad hoc, but it is nonetheless followed by both Netscape and
> IE.
Are you implying that these browsers fail to honour the correct HTTP
headers? I could certainly trust MSIE to do that, but I wasn't directly
aware of a problem. Sure they also support these non-standard
extensions, I wouldn't disagree with that.
> In a similar vein, if
> it weren't for browser manufacturers creating their own extensions to
> HTML, we wouldn't have a lot of the features that are in browsers today.
You mean like support for the HTML/2.0 <LINK>, the HTML3* <Q> tag,
external client-side imagemap files, the HTML4.0 <OBJECT> tag, the
protocol-mandatory support for HTTP Content-type, and so forth? Yes, if
they had refrained from fiddling around with proprietary extensions they
might have found the time to implement these useful parts of the
standards.
> Whether this is good or bad from a philosophical point of view is not
> relevant for me.
Quite.
> I write code that has to work with the browsers that do
> exist, not the ones that I wish existed.
So you _are_ saying that they fail to support the standard HTTP
mechanisms, and can only be influenced by using their non-standard
extensions?
I wonder why the caching tutorials composed by serious and reliable
people seem to make no mention of that. Do you suppose there is some
conspiracy at work here?
good luck
------------------------------
Date: Fri, 06 Aug 1999 15:09:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: unpack to a hash?
Message-Id: <37aafa2f.20658555@news.skynet.be>
jwilde74@my-deja.com wrote:
> %H = (
> trc => substr($buffer, 0, 2),
> st1 => substr($buffer, 6, 2),
> st2 => substr($buffer, 8, 2),
> st3 => substr($buffer, 10, 2),
> st4 => substr($buffer, 12, 2),
> st5 => substr($buffer, 14, 2),
> );
>
>I imagine that using unpack() rather than substr()
>would be a more efficient way to do this.
>However, nothing I've tried seems to work. Here's
>my latest attempt.
>
> ($H{trc}, $H{st1}, $H{st2}, $H{st3}, $H{st4},
>$H{st5}) =>
> unpack("a2 x4 a2 a2 a2 a2 a2" , $buffer);
As Alex Farbver wrote, "=>" is the wrong operator. Use "=" instead.
But you can do some more cosmetic changes (simplifications?):
@H{qw(trc st1 st2 st3 st4 st5)} =
unpack("a2 x4 a2 a2 a2 a2 a2", $buffer);
Bart.
------------------------------
Date: 6 Aug 1999 15:49:52 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Why is it.... [REPOST]
Message-Id: <slrn7qm154.916.fl_aggie@thepentagon.com>
On 6 Aug 1999 09:27:32 -0500, Abigail <abigail@delanet.com>, in
<slrn7qls5e.8m9.abigail@alexandra.delanet.com> wrote:
+ I R A Darth Aggie (fl_aggie@thepentagon.com) wrote on MMCLXVI September
+ MCMXCIII in <URL:news:slrn7qlqnu.8jv.fl_aggie@thepentagon.com>:
+ @@ On 5 Aug 1999 23:04:00 -0500, Abigail <abigail@delanet.com>, in
+ @@ <slrn7qknk8.uij.abigail@alexandra.delanet.com> wrote:
+ @@
+ @@ + Brain surgery and controlling air traffic are just jobs, yes. Although
+ @@ + it might take the better part of a decade studying, before you can do
+ @@ + your job. A brain surgeon doesn't have "the gift". It's years of _hard
+ @@ + work_.
+ @@
+ @@ And if you can't keep your hands steady?
+ Then you become an air traffic controller instead.... ;-)
Or a perl hacker... ;)
James
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 403
*************************************