[17850] in Perl-Users-Digest
Perl-Users Digest, Issue: 10 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 7 09:05:26 2001
Date: Sun, 7 Jan 2001 06:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978876306-v10-i10@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 7 Jan 2001 Volume: 10 Number: 10
Today's topics:
Re: bitwise operation to find the inversion of a color (J.B. Moreno)
Re: checking/deleting mail duplicates <t@inode.at>
Re: checking/deleting mail duplicates <t@inode.at>
Re: Could I remotely zip a file before I get it by FTP (Abigail)
grep question -> what am I doing wrong? (Paul Delahunta)
Re: grep question -> what am I doing wrong? <uri@sysarch.com>
Re: grep question -> what am I doing wrong? (Paul Delahunta)
Re: grep question -> what am I doing wrong? <uri@sysarch.com>
Re: grep question -> what am I doing wrong? (Paul Delahunta)
Re: Help with flat text database <newsgroups@jhorn.cjb.net>
Re: howto config windows98 dble-clk to open perl with l shawn@flurg.com
Image Magick complaining about JPEG library <69camaro@home.com>
Re: Is there a Perl equivalent for servlets and jsp <Hans.de.Bruin@chello.nl>
Re: Mac pathnames shawn@flurg.com
Re: Newbie but serious - Problems reading file from mul <joe+usenet@sunstarsys.com>
What do you call the => operator? (Ben Okopnik)
Re: What do you call the => operator? <uri@sysarch.com>
Re: What do you call the => operator? (Ben Okopnik)
Re: What do you call the => operator? <uri@sysarch.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 7 Jan 2001 03:04:43 -0500
From: planb@newsreaders.com (J.B. Moreno)
Subject: Re: bitwise operation to find the inversion of a color
Message-Id: <1emtjmy.h0t3xqodz1uzN%planb@newsreaders.com>
David Steuber <nospam@david-steuber.com> wrote:
> I've noticed that a number of NEWBE and HELP type posts have munged
> addresses, making it difficult to answer off line. My address looks
> weird, but it is real.
If somewhere in the message the person expressly says the address is
undeliverable, you might want to point out that per RFC 2606,
undeliverable addresses of that type should end in the top level domain
".invalid".
--
JBM
"Moebius strippers only show you their back side." -- Unknown
------------------------------
Date: Sun, 7 Jan 2001 11:10:31 +0100
From: "matthias tarasiewicz" <t@inode.at>
Subject: Re: checking/deleting mail duplicates
Message-Id: <939f8o$cvq$1@readme.inode.at>
> First, you need to define what a 'duplicate' is. If you mean that it's
> the same message twice (maybe it arrived through a different channel),
> all you need to do is keep track of the Message-Id header. If you mean
> that you want to check whether the message body is identical, you can
> just compare those.
>
checking by the message-id header would be enough i think (these mails are
real duplicates)
> Get the MailTools package from CPAN, and either the Mail::Box or
> Mail::Folder modules. The Mail::Box or Mail::Folder modules allow you to
> deal with your mailbox, and the MailTools modules to work with
> individual messages.
>
very good! where can f find those modules?
> I think you probably have to write something yourself. But it wouldn't
> be too hard. Mail::Box and Mail::Folder allow you to to loop through all
> the mail in a box, and delete the ones you don't want. Keep a hash with
> the message id, and if you encounter the same one again, remove the
> current one (see the answer in the FAQ part 4 to the question "How can I
> remove duplicate elements from a list or array?"). If you don't just
> want to do this based on the Message-Id, maybe you can keep an MD5 sum
> around of the message body. But that depends on what you think is a
> duplicate.
the problem is that i never did anything with perl -- allthough i am
familiar with some programming languages
maybe there is any chance to use an existing script and apply just a few
changes to get the result?
thanks a lot
matt
------------------------------
Date: Sun, 7 Jan 2001 13:00:03 +0100
From: "matthias tarasiewicz" <t@inode.at>
Subject: Re: checking/deleting mail duplicates
Message-Id: <939lm9$qlq$1@readme.inode.at>
>
> > First, you need to define what a 'duplicate' is. If you mean that it's
> > the same message twice (maybe it arrived through a different channel),
> > all you need to do is keep track of the Message-Id header. If you mean
> > that you want to check whether the message body is identical, you can
> > just compare those.
> >
i just found a script that i think does the job
http://mail.gnu.org/pipermail/info-gnus-english/1999-July/019787.html
can anyone give me a hint if and how this works?
thanks
matt
------------------------------
Date: 7 Jan 2001 10:27:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Could I remotely zip a file before I get it by FTP
Message-Id: <slrn95gh5b.b8e.abigail@tsathoggua.rlyeh.net>
Monte Phillips (montep@hal-pc.org) wrote on MMDCLXXXV September MCMXCIII
in <URL:news:3a57781a.20805036@news.hal-pc.org>:
^^ On 6 Jan 2001 18:54:07 GMT, abigail@foad.org (Abigail) wrote:
^^
^^ >Regent Linus (wstsoi@netvigator.com) wrote on MMDCLXXXV September
^^ >MCMXCIII in <URL:news:937egf$kpg3@imsp212.netvigator.com>:
^^ >^^ How could perl do this?
^^ >
^^ >There are various ways. You could use UUCP to give a remote command.
^^ >Or you could NSF mount the drive the file is on, then zip it. Or
^^ >install (write?) an FTP server that zips on the fly. Perl doesn't
^^ >really play much of a role in all of this though.
^^ >Abigail
^^
^^ I beg your pardon? why not system() and zip or tarball the thing?
And which command do you propose to use for this zipping on a remote
system?
Abigail
--
print v74.117.115.116.32;
print v97.110.111.116.104.101.114.32;
print v80.101.114.108.32;
print v72.97.99.107.101.114.10;
------------------------------
Date: Sun, 07 Jan 2001 07:38:07 GMT
From: mustbe@pdelahunta.cjb.com (Paul Delahunta)
Subject: grep question -> what am I doing wrong?
Message-Id: <3a581ccd.8521997@news.planet.nl>
I've been breaking my head on this for some time:
I have:
@name=qw(a b c d);
$some_value='e';
Now when I say:
if(grep($some_value,@name))
It results true
What am I doing wrong?
Regards,
Paul Delahunta
------------------------------
Date: Sun, 07 Jan 2001 07:50:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: grep question -> what am I doing wrong?
Message-Id: <x7r92f7qdl.fsf@home.sysarch.com>
>>>>> "PD" == Paul Delahunta <mustbe@pdelahunta.cjb.com> writes:
PD> @name=qw(a b c d);
PD> $some_value='e';
PD> if(grep($some_value,@name))
PD> It results true
well, it is true.
read perldoc -f grep more carefully. the first argument to grep is not a
regular expression, but a plain expression. so you tested if 'e' was
true each time in the grep loop. you got all 4 values returned and that
is true in a boolean context. simple.
so figure out how to make your string into a regex. very simple
exercise.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 07 Jan 2001 08:31:15 GMT
From: mustbe@pdelahunta.cjb.com (Paul Delahunta)
Subject: Re: grep question -> what am I doing wrong?
Message-Id: <3a582769.11239268@news.planet.nl>
On Sun, 07 Jan 2001 07:50:14 GMT, Uri Guttman <uri@sysarch.com> wrote:
>well, it is true.
>
>read perldoc -f grep more carefully. the first argument to grep is not a
>regular expression, but a plain expression. so you tested if 'e' was
>true each time in the grep loop. you got all 4 values returned and that
>is true in a boolean context. simple.
>
Thanks for your reply Uri.
(My line:)
if(grep($some_value,@name))
(perldoc -f grep:)
Evaluates the BLOCK or EXPR for each element of LIST (locally setting
$_ to each element) and returns the list value consisting of those
elements for which the expression evaluated to TRUE
In my words (not a native English speaker) this means:
grep returns true for every time $some_value is found in @name, wich
is zero in this case.
Paul
------------------------------
Date: Sun, 07 Jan 2001 08:36:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: grep question -> what am I doing wrong?
Message-Id: <x7k8877o7w.fsf@home.sysarch.com>
>>>>> "PD" == Paul Delahunta <mustbe@pdelahunta.cjb.com> writes:
PD> (My line:)
PD> if(grep($some_value,@name))
PD> (perldoc -f grep:)
PD> Evaluates the BLOCK or EXPR for each element of LIST (locally setting
PD> $_ to each element) and returns the list value consisting of those
PD> elements for which the expression evaluated to TRUE
PD> In my words (not a native English speaker) this means:
PD> grep returns true for every time $some_value is found in @name, wich
PD> is zero in this case.
well, you have it backwards. look at this key phrase:
returns the list value consisting of those elements for which
the expression evaluated to TRUE
the expression is 'e' and it is evaluated for EACH of the list
elements. since it is true the list ELEMENT is returned. so you get a
list which is all the values in @name. it never says anything about
finding the value in the list. all you get is $_ is aliased to each
value of the list. you have to deal with $_ to determine if something is
in the list. 'e' does not even touch $_.
and since you are doing an IN test, you should probably be using a hash
anyway.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 07 Jan 2001 10:03:03 GMT
From: mustbe@pdelahunta.cjb.com (Paul Delahunta)
Subject: Re: grep question -> what am I doing wrong?
Message-Id: <3a582f81.13310883@news.planet.nl>
Thanks Uri. I think I'm beginning to see the light :)
------------------------------
Date: Sun, 07 Jan 2001 05:01:29 GMT
From: ^Jerry <newsgroups@jhorn.cjb.net>
Subject: Re: Help with flat text database
Message-Id: <938t77$rmb$1@nnrp1.deja.com>
I figured it out... sorry for any annoyance..
I messed up the print command... isn't it weird how many ways there are
to mess stuff up? hehe
just for reference.. I downloaded perl for windows (activeperl), and
ran the script through the command line.. fixed the print coding, and
it works great. :)
Jerry
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 07 Jan 2001 06:29:29 GMT
From: shawn@flurg.com
Subject: Re: howto config windows98 dble-clk to open perl with local dir as working dir?
Message-Id: <9392c6$vb9$1@nnrp1.deja.com>
What are you trying to access and how are you calling it? If it is a
module, you simply need to add a
use lib '.';
at the top of your script.
-shawn
In article <91ui4m$ckt$1@nnrp1.deja.com>,
dtbaker_dejanews@my-deja.com wrote:
> This is probably mostly a windows issue, but since it is affecting the
> way I am using perl, I am hoping that some win32 perl user can help me
> out on this one.
>
> The problem is that I have one machine that I cant seem to get to use
> the current . directory as the working directory when firing up a
scipt
> with a dble-click from an explorer window. I dont really want to add
the
> full path in the script, I have a couple utility scripts I just want
to
> be able to double-click a fire up to run on some files in the "local"
> directory. I KNOW its not a good idea to assume the path, but in this
> case I'd like to cheat a little.... and I'm frustrated because it
works
> on one. ;)
>
> I have two windows98 machines with the same version of perl
> (activestate522), and one uses the current dir as the working dir, and
> the other uses the c:\usr\bin where the perl.exe is when I run a
script.
>
> I have checked the file association for the .pl extension and it looks
> identical.... opening with C:\usr\bin\Perl.exe "%1" %*
>
> I have poked around win98 help but have not found a way to set the dir
> an executable opens IN.......
>
> any ideas?
>
> Dan
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 07 Jan 2001 05:28:27 GMT
From: <69camaro@home.com>
Subject: Image Magick complaining about JPEG library
Message-Id: <%7T56.56274$Y6.12951552@news1.mntp1.il.home.com>
I have been trying to compile ImageMagick 5.2.5 on Linux 6.2 but "configure" is failing on JPEG with the following error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
configure:7730: checking for jpeglib.h
configure:7742: cc -E -D_FILE_OFFSET_BITS=64 -I/usr/local/include conftest.c >/dev/null 2>conftest.err
configure:7764: result: yes
configure:7772: checking for jpeg_read_header in -ljpeg
configure:7798: gcc -o conftest -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/local/include -L/usr/local/lib -L/usr/X11R6/lib
conftest.c -ljpeg -lpng -lXext -lXt -lSM -lICE -lX11 -lz -lm >&5
configure:7808: result: yes
configure:7818: checking for JPEG library is version 6b or later
configure:7840: gcc -o conftest -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/local/include -L/usr/local/lib -L/usr/X11R6/lib
conftest.c -lpng -lXext -lXt -lSM -lICE -lX11 -lz -lm >&5
configure: failed program was:
#line 7827 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <jpeglib.h>
int
main ()
{
if ( JPEG_LIB_VERSION >= 62 ) exit(0);
exit(1);
}
configure:7852: result: no
configure:7859: result: no
configure:7864: checking if JPEG package is complete
configure:7870: result: no -- some components failed test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I compiled "jpegsrc.v6b" with gcc using
./configure --enable-shared
Does anyone have any suggestions? Or perhaps a Makefile for RedHat Linux 6.2?
Thanks,
Brian Busche
brian@rendition.net
------------------------------
Date: Sun, 07 Jan 2001 13:52:15 GMT
From: "Hans de Bruin" <Hans.de.Bruin@chello.nl>
Subject: Re: Is there a Perl equivalent for servlets and jsp
Message-Id: <jw_56.487362$%C1.5973106@Flipper>
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn95fh36.f4u.mgjv@martien.heliotrope.home...
> On Sat, 06 Jan 2001 17:22:11 GMT,
> Hans de Bruin <Hans.de.Bruin@chello.nl> wrote:
> > With java it is possible to separate html pages en cgi program by the
use of
> > server side java pages and servlets . This makes it possible for someone
to
> > edit the pages without tampering with the main script. I am looking for
the
> > Perl equivalent of this but had no luck so far. Does it exist?
>
> You're looking for a templating system?
>
> http://search.cpan.org
>
> There are several modules with template in their name. Most of them will
> allow you to split HTML and code.
>
> But maybe what you're really looking for is Mason. Info available at
> http://www.masonhq.com/. Integrates well with mod_perl and the Apache
> server.
>
Thanks, both hints, especially Mason, were very helpful.
Hans
------------------------------
Date: Sun, 07 Jan 2001 06:25:45 GMT
From: shawn@flurg.com
Subject: Re: Mac pathnames
Message-Id: <939256$v3d$1@nnrp1.deja.com>
use File::Spec for cross platform pathnames :
http://search.cpan.org/doc/RBS/File-Spec-0.82/Spec.pm
-Shawn
In article <978819565.41200@shelley.paradise.net.nz>,
"Tintin" <you.will.always.find.him.in.the.kitchen@parties> wrote:
> I've looked in the Perl FAQ, the deja archives and the MacPerl
mailing list,
> but I couldn't find a definitive resource or reference that explains
how to
> handle Mac pathnames and more importantly, how to write portable
scripts to
> cater for the differences.
>
> Maybe I just missed a reference, but I would certainly appreciate any
> pointers.
>
> I did see a few MacPerl scripts which had a section with
>
> sub GetDirSeperatorChar
> {
> my ($tOSString) = @_;
> my ($tDirSepChar);
> if ($tOSString eq 'MacOS') { #it's a Macintosh!
> $tDirSepChar = ':';
> }
> elsif ($tOSString =~ /nix/i) { #it's probably some flavor of Unix
> $tDirSepChar = '/';
> }
> else { #it could be other things, but assume a Wintel PC
> $tDirSepChar = '/'; #!?! -- same as unix, not '\' as expected!
> }
> return ($tDirSepChar);
> }
>
> so I'm assuming that you have to use a : as the Mac directory
separator.
> Is converting Unix pathnames to Mac as simple as converting / to :'s?
I
> suspect not.
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 07 Jan 2001 00:43:47 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Newbie but serious - Problems reading file from multipart forms (no binmode!) (repost)
Message-Id: <m3puhz29yk.fsf@mumonkan.sunstarsys.com>
mjd@plover.com (Mark Jason Dominus) writes:
> I think we're talking past each other. There are three problems here.
>
> 1. OP did not have taint checking on.
> 2. OP sanitized the input data in a way that was not completely effective.
> 3. Files in the upload area might have a meta-meaning for the web server.
>
> All three of these are contributing to the security problem.
>
> You appear to be saying that the big problem is #1.
Yes on all points. Within the context of this particuar thread,
Tad gave reasons as to why OP hadn't gotten a response to his
earlier post. I did read OP's earlier post, thought about a
solution (pretty sure it's a CGI.pm bug on his platform) and
was in the process of writing up a reply when I realized he didn't
have taint checks enabled. So I discarded my followup and read
other posts instead.
Enabling -T has nothing to do with OP's problem, but has a lot to
do with why noone responded to his first post.
> We just saw that the OP tried to sanitize the input data even though
> he *didn't* have taint checking on. He did it this way:
>
> $fileName =~ s!^.*(\\|\/)!!;
>
> it didn't work.
In my view, that's not a taint check- it's a quick way to drop the
directory info in the filename. A minimal taint check would be
the next step:
$fileName =~ /^(\w+[\w.]+)$/ or die "taint check failed: $fileName: $!";
$fileName = $1;
That's still pretty weak for my taste, but had he made a similar effort
I'd have sent my reply to his original post.
(aside 1: I've seen the idiom OP used in more than one CGI script, I
was/am still curious as to its origins. Is it from some book, or a
"popular" CGI script? )
> The only thing that taint checking does is force the programmer to try
> to sanitize the data. It can't ensure that they get it right. In
> this case, the programmer *did* try to sanitize the data, without
> being forced. He screwed it up, but turning on taint checking would
> not have helped him not screw it up.
That's a fair read of the situation, but it's not my view of the code
in question. I don't think any programmer effort was made at
"sanitization"; s/he just stripped the leading path info. That's
parsing it, not cleansing it, IMO.
> #1, the taint checking, is not going to help, and OP screwed up #2.
> He didn't screw it up completely. In fact, he hardly screwed up at
> all. He did, in fact, confine the uploaded file to the appropriate
> upload directory. The file is going right where it is supposed to.
> The remote user is not going to overwrite /etc/passwd or anything like
> that.
For as much as we've seen so far, yes. Moreover, it has nothing
to do with the data corruption problem that he's seeing.
=begin aside 2
However, it is easy for me to imagine a complementary feature
that allows a random goofball to name subdirectories as well.
If the same "sanitization" rule is used in both cases
$dirName =~ s!^.*(\\|\/)!!;
the script-writer has a significantly more serious security
problem (on linux, say) than before:
% cat /tmp/try.pl
#!/usr/bin/perl -wl
use strict;
use CGI qw(-debug);
my $q = new CGI;
my $dirName = $q->param('d');
my $fileName = $q->param('f');
$fileName =~ s!^.*(\\|\/)!!;
$dirName =~ s!^.*(\\|\/)!!;
if ($dirName) {
mkdir("/tmp/zero/$dirName", 0755) or die $!;
print "DIR=/tmp/zero/$dirName";
}
if ($fileName) {
open OUTFILE, ">/tmp/zero/$fileName" or die $!;
print OUTFILE "HI";
close OUTFILE;
print "FILE=/tmp/zero/$fileName";
}
__END__
% ls /tmp/zero
% ls /tmp/.ht*
% try.pl d=%0Amangler
Use of uninitialized value at /tmp/try.pl line 10.
DIR=/tmp/zero/
mangler
% ls /tmp/zero
?mangler
% try.pl f=%0Amangler/../../../tmp/.htaccess
% cat /tmp/.htaccess
HI
%
This issue could be avoided bit by adding the s modifier, but
by the time we've gone 'round a few cycles, we'll wind up where
we should have started- something that actually works with -T.
Again, this isn't the first time I've seen this idiom, and feel
quite strongly that it's further use should not be encouraged.
=end aside
> Taint checking cannot help you with this. Look:
>
> #!/usr/bin/perl -T
>
> ...
>
> ($filename) = ($filename =~ /^([a-z]+)$/m);
>
> Here I sanitized $filename heavily. It must be a sequence of
> lowercase letters. Surely this is safe.
>
> No, some idiot sysadmin has configured the web server to use 'config'
> as a synonym for '.htaccess'. Sanitize that, babe!
IMO, that's the whole point. Why even *let* someone else name files
on your server- you don't let them name variables in your scripts
(use strict refs?), so why is it any different here? if you want
to create an anonymous FTP service, use FTP.
> How can you fix this?
You use a "MIME->suffix hash" and map the reported MIME-type to an
internally generated name- no MIME type in the table, no file gets
written to your filesystem. You could store the file's name in a database
that maps name -> internally-generated url (based solely on th MIME
type), and voila! User clicks on link that has the name of the
file listed, and user sees file appear. If someone cares that the
name of the URI is ugly, oh well. You can't please everyone :)
> You have to know every detail of how the server
> is configured, not just today, but forever. That's clearly
> impossible.
Exactly, so why bother guessing about it? Don't trust any part of
user-supplied filename, and this never becomes an issue.
> So the .htaccess problem you brought up is not with the sanitization,
> and it's not with the lack of taint checking. The problem is that
> some idiot sysadmin *did* configure the web server to support control
> files in the upload directory.
Well, I disagree. Washing input to match your expectations is
what taint-checking is for. If you are unable to distinguish good
data from bad, simply quarantine all of it to a place that can do
no harm. (A row in a database is one of those places.)
You could try the example above and see if you can still find a way
to pass the buck to the sysadmin. When I run it, it allows access to
any file/directory on my linux filesystem that I have write access to.
Not good.
--
^J oe Schaefer
------------------------------
Date: 7 Jan 2001 07:24:15 GMT
From: ben-fuzzybear@geocities.com (Ben Okopnik)
Subject: What do you call the => operator?
Message-Id: <slrn95g6gf.59d.ben-fuzzybear@Odin.Thor>
I was just glancing through Ellie Quigley's "Perl Programming Guide", and
spied the following horror:
"Perl 4 used the comma to separate the key and value items; Perl5 uses =>
(digraph symbol)."
She proceeds to refer to it as 'the digraph symbol' further on in the
book. ACK! A perfect example of just reading the documentation (perlop)
without understanding it...
Does anyone know the actual name for this thing, though? _Is_ there one?
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
perl -we '$perl=0;JsP $perl "perl";$perl->perl(0)' \
2>&1 | perl -ne '{print ((split//)[19,29,20,4,5,1,2,
15,13,14,12,52,5,21,12,52,8,5,14,1,6,37,12,52,75])}'
------------------------------
Date: Sun, 07 Jan 2001 07:47:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: What do you call the => operator?
Message-Id: <x7u27b7qin.fsf@home.sysarch.com>
>>>>> "BO" == Ben Okopnik <ben-fuzzybear@geocities.com> writes:
BO> I was just glancing through Ellie Quigley's "Perl Programming Guide", and
BO> spied the following horror:
BO> "Perl 4 used the comma to separate the key and value items; Perl5
BO> uses => (digraph symbol)."
there's your proof of the quality of this book. the last statement is
so wrong. perl 5 can use either , or =>. and does she state the minor
but useful (and sometimes buggy) side effect that => has?
BO> Does anyone know the actual name for this thing, though? _Is_
BO> there one?
well, most perl hackers call it fat comma.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 7 Jan 2001 08:01:42 GMT
From: ben-fuzzybear@geocities.com (Ben Okopnik)
Subject: Re: What do you call the => operator?
Message-Id: <slrn95g8mm.5c8.ben-fuzzybear@Odin.Thor>
The ancient archives of Sun, 07 Jan 2001 07:47:13 GMT showed
Uri Guttman of comp.lang.perl.misc speaking thus:
>>>>>> "BO" == Ben Okopnik <ben-fuzzybear@geocities.com> writes:
>
> BO> I was just glancing through Ellie Quigley's "Perl Programming Guide", and
> BO> spied the following horror:
>
> BO> "Perl 4 used the comma to separate the key and value items; Perl5
> BO> uses => (digraph symbol)."
>
>there's your proof of the quality of this book.
That was my thought. :\
> the last statement is
>so wrong. perl 5 can use either , or =>. and does she state the minor
>but useful (and sometimes buggy) side effect that => has?
You mean the "forces any word to the left to be a string"? <snort> Nope.
Didn't realize it was buggy, though - I'll keep that in mind.
> BO> Does anyone know the actual name for this thing, though? _Is_
> BO> there one?
>
>well, most perl hackers call it fat comma.
Cool. Thanks, Uri.
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
perl -we '$perl=0;JsP $perl "perl";$perl->perl(0)' \
2>&1 | perl -ne '{print ((split//)[19,29,20,4,5,1,2,
15,13,14,12,52,5,21,12,52,8,5,14,1,6,37,12,52,75])}'
------------------------------
Date: Sun, 07 Jan 2001 08:30:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: What do you call the => operator?
Message-Id: <x7n1d37ohs.fsf@home.sysarch.com>
>>>>> "BO" == Ben Okopnik <ben-fuzzybear@geocities.com> writes:
BO> You mean the "forces any word to the left to be a string"? <snort> Nope.
BO> Didn't realize it was buggy, though - I'll keep that in mind.
well, more misprone to doing the wrong thing. in some cases if the
bareword is a perl operator it could be executed instead of being
quoted. there have been other issues with use integer not playing well
with -foo as a key and quoted by =>. some of these are fixed in some
versions but i can't quote which. so i rarely use the quote side effect
of =>.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 10
*************************************