[9177] in Perl-Users-Digest
Perl-Users Digest, Issue: 2795 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 3 10:07:24 1998
Date: Wed, 3 Jun 98 07:01:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 3 Jun 1998 Volume: 8 Number: 2795
Today's topics:
Re: "system" output redirect <gclim@NOSPAM.nt.com>
Re: [Q] system using grep <jhi@alpha.hut.fi>
Re: Can I email with attachements <quednauf@nortel.co.uk>
Re: Can I email with attachements (Tom Grydeland)
Re: CGI/Perl Department Head <webmaster@fccjmail.fccj.org>
Re: CGI/Perl Department Head (Chris Nandor)
Re: Cropping Images with PERL <fty@utk.edu>
Re: Excel via cgi msazonov@my-dejanews.com
Re: Exec a program... <straderb@mindspring.net>
Re: Exec a program... <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Exec a program... (Jonathan Stowe)
Forking and global variables <mortensi@idt.ntnu.no>
Re: Forking and global variables <qdtcall@esb.ericsson.se>
Re: LABOR CRISIS: Perl SW Guru NEEDED MA Intranet Start perlguy@mailexcite.com
Re: Leap Year Script... <david@solbors.no>
Re: map in void context regarded as evil - suggestion <rra@stanford.edu>
Re: map in void context regarded as evil - suggestion (Tony Bass)
Re: map in void context regarded as evil - suggestion (Tom Grydeland)
Re: map in void context regarded as evil - suggestion <jdporter@min.net>
Re: map in void context regarded as evil - suggestion (Chris Nandor)
Re: map in void context regarded as evil - suggestion <jdporter@min.net>
Re: map in void context regarded as evil - suggestion <tchrist@mox.perl.com>
Re: Net::Ping::Wont::Sodding::Work::Help!:: <qdtcall@esb.ericsson.se>
Re: new to OO Perl (M.J.T. Guy)
Re: new to OO Perl <zenin@bawdycaste.org>
oops (Re: Piping in Win32 Perl...) <quednauf@nortel.co.uk>
Re: perl 5.004_04 question (M.J.T. Guy)
Re: Perl class for newbie? <camerond@mail.uca.edu>
Re: Perl class for newbie? <camerond@mail.uca.edu>
perl Security Mode. <kenn@xuviet.org>
Re: Perl-Frage (J|rgen P|nter)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 03 Jun 1998 08:17:02 -0400
From: Gabriel Climescu <gclim@NOSPAM.nt.com>
Subject: Re: "system" output redirect
Message-Id: <35753EBE.2897183D@NOSPAM.nt.com>
Tom Christiansen wrote:
>
> In comp.lang.perl.misc, using a publicly revealed despammed address
> Gabriel Climescu <gclim@nt.com> writes:
>
> :My problem is that "sys_command" is writing occasionally messages on the
> :standard error (I have no control on that). I'd like these messages to
> :be redirected to a file (possibly /dev/null). Does anybody know how to
> :do that?
>
> See perlfaq8.
>
> Why can't I get the output of a command with system()?
> How can I capture STDERR from an external command?
>
> :Please send me a message, I don't read this newsgroup regularly,
>
> Don't you think it presumptive to expect us to reply when won't even
> bother to use a valid return address?
>
> --tom
> --
> Mathematics: That branch of Human Thought which takes a finite set of trivial
> axioms and maps them to a countably infinite set of unintuitive theorems.
Thanks for your answer. As I said, I'm a newbie as far as Perl is
concerned. Moreover, I haven't mentioned that the last time I was
posting on a newsgroup was a few years ago, so I should probably
apologize for this one too in order to save some flames :-)
I was able to find this perlfaq8 (well, it would have been easier to
mention a place where to find it, but never mind) and to solve my
problem.
Thanks one more time for your time,
Gabriel
------------------------------
Date: 03 Jun 1998 11:57:13 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: [Q] system using grep
Message-Id: <oeepvgqual2.fsf@alpha.hut.fi>
"Dave M. Lent [I]" <lentdm@cig.mot.com> writes:
>
> The following line is putting my Perl program into an infinite loop.
I doubt this. You mean that the system() never returns?
> system("grep -i -l -w $keyword $filename");
Are you certain that $keyword is not an empty string? (here, empty
means: undef, '', ^\s+$, but undef would have been caught by -w,
which you use, right?)
> When I use this line the code works though:
> system("grep -i -l -w Technical $filename");
>
> Does anyone know why "system" will not accept the variable $keyword?
> Thanks in advance for your help.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Wed, 03 Jun 1998 09:35:03 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Can I email with attachements
Message-Id: <35750AB6.B06705E@nortel.co.uk>
Guy Doucet wrote:
> I am running Perl scripts on my Novell Web Server. I am just starting to
> use a JMerril's SENDSMTP.PL script to send e-mails. It seems to work,
> but I was wondering if there is a way to include an attachment.
>
> Sorry if I am posting in the wrong group, but if anyone here is doing
> this I would appreciate your help. If I should search on the RFC822
> specifications, does anyone know where I can get them.
For one way of sending attachments,
check: http://www.surrey.ac.uk/~me51fq/perl/perl.htmI use the MIME::Lite
module. But then, TIMTOWTDI (or similar :)...
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 3 Jun 1998 11:04:19 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Can I email with attachements
Message-Id: <slrn6nabdh.2qd.Tom.Grydeland@mitra.phys.uit.no>
On Wed, 03 Jun 1998 03:53:29 GMT,
Guy Doucet <gdoucet@ait.acl.ca> wrote:
> I am running Perl scripts on my Novell Web Server. I am just starting to
> use a JMerril's SENDSMTP.PL script to send e-mails. It seems to work,
> but I was wondering if there is a way to include an attachment.
Look for MIME::Tools or MIME::Lite (sp?) on CPAN
> Sorry if I am posting in the wrong group, but if anyone here is doing
> this I would appreciate your help. If I should search on the RFC822
> specifications, does anyone know where I can get them.
<URL:http://sunsite.auc.dk/RFC/> in Denmark. You might have closer
mirrors. There is supposedly one on
<URL:ftp://ds.internic.net/> but I'm unable to reach it now.
> Guy Doucet
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
- Do radioactive cats have 18 half-lives? -
------------------------------
Date: Wed, 03 Jun 1998 10:08:19 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: CGI/Perl Department Head
Message-Id: <35751E8D.AC3B05AB@fccjmail.fccj.org>
rishi_bhat@hotmail.com wrote:
> I am currently looking for someone to head the CGI section of the website.
> Your responsibilities will include writing two to three (more if possible)
> articles (on the topic of your choice) per month. The ideal candidate will
> have excellent writing skills and at least one year of solid
> CGI/Perl programming experience. Details such as article length, topics, etc.
> will be discussed in further detail in the "interviewing" process.
Hmmm, wasn't able to find one all those months ago?
>
> Compensation :
>
> To begin with, we will implement a pay per article system. For each article
> you write, you will be paid $35 US dollars.
Why? I get $600 for each one I write now...
And no, I could care less about advertising. Pay now for work now.
(This was an advertisement of the Fair Pay for Fair Work campaigne)
:-)
-Sneex-
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: Wed, 03 Jun 1998 13:44:50 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: CGI/Perl Department Head
Message-Id: <pudge-0306980939080001@192.168.0.3>
In article <6l2agr$ign$1@nnrp1.dejanews.com>, rishi_bhat@hotmail.com wrote:
# If you are interested, please send your resume (in any format you want) and a
# few urls of your work to :
Please refrain from sending job postings to comp.lang.perl.misc, unless
you don't care about your reputation.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 03 Jun 1998 08:40:20 -0400
From: Jay Flaherty <fty@utk.edu>
To: "Justin C. Johnson" <jcj@visi.com>
Subject: Re: Cropping Images with PERL
Message-Id: <35754433.5EF84F55@utk.edu>
Justin C. Johnson wrote:
> ALL,
>
> I need to crop a large amount of pictures in exactly the same fashion and
> would like to write a script in PERL that will take care of this for me.
Look at netpbm. Here's the blurb:
Netpbm is a toolkit for conversion of images between a variety of
different formats, as well as to allow a few basic image operations.
The package is intended to be portable to many platforms. It has been
tested under UNIX (BSD and SYSV, e.g. SGI, Sun4, Sun386i, DEC and
Apollo DN 3500), VMS and Amiga OS. There are also compiler directives
in it for MS-DOS.
You'll find the latest release of Netpbm at the following sites:
* wuarchive.wustl.edu (128.252.135.4),
directory /graphics/graphics/packages/NetPBM
* ikaros.fysik4.kth.se (130.237.35.2), directory /pub/netpbm.
* ftp.informatik.uni-oldenburg.de (134.106.1.9). This site also carries
binaries for the Amiga.
* peipa.essex.ac.uk (155.245.115.161), directory ipa/src/manip
* ftp.rahul.net (192.160.13.1), directory /pub/davidsen/source
* ftp.cs.ubc.ca, directory /ftp/archive/netpbmThere is a pnmcrop program that
might work for you...jay
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: Wed, 03 Jun 1998 10:17:16 GMT
From: msazonov@my-dejanews.com
Subject: Re: Excel via cgi
Message-Id: <6l37r9$nig$1@nnrp1.dejanews.com>
Hi, All!
Peter Tapolyai wrote (April, 1998):
> I have to query an MS Excel Spreadsheet across the web.
> I have the simplified core of the cgi below. However, this
> query does not return the very first 'records' (or cell values)
> or any text values either.
> That is if I have:
> A B
> 1 11 12
> 2 21 text
> 3 31 32
> values in a spreadsheet, then all numberical values returned,
> with the exception of A1 and B1 values in addition to the B2 'text'.
> Column A's name is F1 and Column B is F2 through ODBC.
1. In Excel Database, to my mind, the aim of the first row is field labels.
And so this query does not return the very first 'records'.
2. After some experiments, I find the next feature in Excel. If the count of
numberical values in the column is greater then or equal to the count of text
values, then this field will be numberical through ODBC (and, of course, text
values will be empty), and vice versa. In other words, you should be sure
that all values in each column have identical type.
Mike Sazonov
------------
To be delighted with Perl
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 03 Jun 1998 03:31:57 -0400
From: Billy Strader <straderb@mindspring.net>
Subject: Re: Exec a program...
Message-Id: <3574FBED.D54FAB40@mindspring.net>
OK I was wrong you need to use system('/usr/games/./fortune'); but I
still cant get that working... any ideas....
Sincerley,
Billy Strader
------------------------------
Date: 03 Jun 1998 12:00:07 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Exec a program...
Message-Id: <7xwwayiz4o.fsf@beavis.vcpc.univie.ac.at>
Re: Exec a program..., Billy <straderb@mindspring.net> said:
Billy> excute fortune and then take the print out and put it
Billy> at the end of a web page it prints out. How do I do
Billy> exec('/usr/games/./fortune');
Why the extra "./" ?
Billy> But I cant seem to get it to work with a web page.
Billy> Can anyone help??? All help is greatly appriacted.
The exec is a new process. Are you flushing stdout and/or
outputing a MIME header for inclusion in the HTML document?
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: Wed, 03 Jun 1998 11:38:15 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Exec a program...
Message-Id: <35751873.1407672@news.btinternet.com>
On Wed, 03 Jun 1998 03:31:57 -0400, Billy Strader wrote :
>OK I was wrong you need to use system('/usr/games/./fortune'); but I
>still cant get that working... any ideas....
>
search for 'qx' in perlop manpage (perldoc)
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 3 Jun 1998 09:45:25 GMT
From: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Forking and global variables
Message-Id: <6l35vl$4ak$1@due.unit.no>
Hi
I am considering building a perl-server for communication with some
java applets. These java applets all need the same information from
the very same database. My question is then: Is it possible to do it
this way?: (pseudocode)
#!/perl
tie %database $databasefile
listen
accept
fork {
$database{$key}=$value
}
To rephrase the question: Will the information which are altered in a
child process be updated in the other child processes?
Thanks for any input
Morten Simonsen
------------------------------
Date: 03 Jun 1998 11:56:15 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Forking and global variables
Message-Id: <isg1hmyfk0.fsf@godzilla.kiere.ericsson.se>
Morten Simonsen <mortensi@idt.ntnu.no> writes:
> To rephrase the question: Will the information which are altered in a
> child process be updated in the other child processes?
Not normally, but have a look at the IPC::Shareable module.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 03 Jun 1998 11:58:46 GMT
From: perlguy@mailexcite.com
Subject: Re: LABOR CRISIS: Perl SW Guru NEEDED MA Intranet Start-up 80K+>+Equity
Message-Id: <6l3dpm$v7d$1@nnrp1.dejanews.com>
>Many companies, especially in my sector (government contracting),
>are wiser than that. They've played that game before (or seen it
>played), and they know it's more painful in the long run. The
>government, especially the military, is a very demanding customer.
>If you give them crap product, they don't give you any more money.
>There have been companies (so I've heard) who have been barred from
>competing on any more contracts because they perfomed miserably
>on one.
>
>There is also some truth -- as many employers know -- to the notion
>that one engineer at $60k can be worth far more than twice two
>engineers at $30k (just to pick arbitrary numbers ;-).
>
>But when the 60k guy is no more qualified than the 30k guy, why
>shouldn't I prefer the 30k guy?
I am relatively new to the *real* workforce, I spent many years in the
military.
Without mentioning names, I have seen firsthand a BIG company trying to dump
the "overpriced" people and put unqualified people into jobs that should have
gone to a person with some experience in the area.
This same company has had many people "bail out" because of better
opportunities at other companies.
One would think that they would realize that they need to start paying the IS
people more competetive wages, but instead I have seen the contrary. There
seems to be too much of a bureacracy involved in paying the IS people what
they are worth to the company so the company would rather just play "shuffle
the employees" and hope that people stop quitting.
I understand companies having to cut costs, I DON'T understand companies
creating negative impact on the product(s) and services just to save money
though.
Now, I also realize that this view may be slightly slanted to see things my
way. I would have loved one of the jobs in question. BUT, I feel that I am
clearly seeing what is going on and it doesn't make sense to me!
Thanks.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 03 Jun 1998 14:41:19 +0200
From: David Carter <david@solbors.no>
Subject: Re: Leap Year Script...
Message-Id: <3575446F.1DF2DF13@solbors.no>
Hi,
> If ($month = '4', '6', '9', '11') {
'if' not 'If'.
For time zone stuff check out the modules in CPAN.
David.
------------------------------
Date: 03 Jun 1998 00:03:18 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <m3wwaz0xxl.fsf@windlord.Stanford.EDU>
Zenin <zenin@bawdycaste.org> writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> It's less intrusive. Count the number of characters of markup per amount
>> of text. If HTML were as light-weight as POD, I doubt anyone would
>> complain about it.
> When <insert a shell newsreader here> can handle POD, sure.
No, that's my point. POD is *so* lightweight that it doesn't interfere at
all with the readability of the text. I'm not saying that B<everyone>
should I<immediately> start using POD to mark up their articles; I'm just
saying that a little POD scattered into a message really isn't at all
comperable to HTML.
Of course, if people were using =over, =item, =back lists all the time, I
may consider that a bit much, because that *is* intrusive.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 3 Jun 1998 09:29:21 +0100
From: aeb@brains.cartoon.bt.co.uk (Tony Bass)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l31h1$nb0$1@brains.cartoon.bt.co.uk>
>From article <6l1a5i$kbr$3@csnews.cs.colorado.edu>, by Tom Christiansen <tchrist@mox.perl.com>:
> [courtesy cc of this posting sent to cited author via email]
> In comp.lang.perl.misc, Tom.Grydeland@phys.uit.no (Tom Grydeland) writes:
> :The major complaint about using C<map> in void context is that it
> :creates a (possibly large) return value which is then discarded.
> No, the major complaint is backwards logic confusing people.
[...]
> I can't see why people use
>
> map { s/foo/bar/ } @list;
> grep { s/foo/bar/ } @list;
> when they could more clearly write:
> for (@list) { s/foo/bar/ }
> Put the important thing first.
For a longer pipeline such as
grep print("match($_)\n"),
grep m/c/ && length($_) >= 7 && length($_) < 12,
map scalar(reverse $_),
map m/(?=(e.*))/g,
map scalar(reverse $_),
$s =~ m/(?=(a.*))/g;
I would probably prefer this form with uniform direction of data flow,
rather than the final U turn of
foreach (grep m/c/ && length($_) >= 7 && length($_) < 12,
map scalar(reverse $_),
map m/(?=(e.*))/g,
map scalar(reverse $_),
$s =~ m/(?=(a.*))/g) {
print("match($_)\n");
}
I never use void map, whose behaviour is undocumented.
Tony Bass
--
# A E Bass Tel: (01473) 645305
# MLB 3/19, BT Laboratories e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE DO NOT e-mail to From: line
# Opinions are my own
------------------------------
Date: 3 Jun 1998 10:55:10 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <slrn6naasd.2qd.Tom.Grydeland@mitra.phys.uit.no>
On 2 Jun 1998 16:44:34 GMT,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> No, the major complaint is backwards logic confusing people.
Strong claim, considering that this is the mindset in one of the
languages which has inspired so much of Perl.
Functional programming is beautiful, simple, and there's much support
for it in Perl.
> do {{
> open(OWNER, "< $whosegot") || last;
> my $lockee = <OWNER>;
> chomp($lockee);
> printf STDERR "%s $0\[$$]: lock on %s held by %s\n",
> scalar(localtime), $pathname, $lockee;
> close OWNER;
> }} if $Debug;
Why bring this rather ugly example here? I didn't suggest writing
*everything* backwards, did I? Looks to me like a straw man argument.
> I can't see why people use
>
> map { s/foo/bar/ } @list;
> grep { s/foo/bar/ } @list;
>
> when they could more clearly write:
>
> for (@list) { s/foo/bar/ }
>
> Put the important thing first.
Ah, but *what* is important here?
Real life example follows:
I write a program-generating program for a real-time controller. The
generated program must be in strictly increasing time order. I have
several actions but don't know their timings when writing the program.
A job for sort, right?
Assuming T1, T2 etc are placeholders for simple expressions denoting
times, and their actions are denoted by the strings; and C<at> is the
subroutine which will output the correct statement to the generated
program. This is what I came up with:
map { at @$_ } sort { $a->[0] <=> $b->[0] }
[ T1, "action 1a, action 1b, action 1c"],
[ T2, "action 2a, action 2b, action 2c"],
[ T3, "action 3a, action 3b, action 3c"],
[ T4, "action 4a, action 4b, action 4c"],
[ T5, "action 5a, action 5b, action 5c"];
In my book, this is concise, simple and readable. The corresponding
foreach is
foreach ( sort { $a->[0] <=> $b->[0] }
[ T1, "action 1a, action 1b, action 1c"],
[ T2, "action 2a, action 2b, action 2c"],
[ T3, "action 3a, action 3b, action 3c"],
[ T4, "action 4a, action 4b, action 4c"],
[ T5, "action 5a, action 5b, action 5c"]) {
at @$_;
}
You might prefer this, but *I* don't. To me this is ugly. There's
too much "gravity" in the literal list, while the action is too tiny.
Indentation, as you can see, is also a pain. I do *not* wish to use a
temporary @array for this case.
As for backwards logic, everywhere else I use C<at>, it's written as
at Tn, "action n";
so having the C<at> *before* the time/action tuples seem to be the right
order. By the same token, the C<foreach> seems to be the backwards one.
Go ahead, condemn me for bad style.
> --tom
Just for the record, it turned out I needed this construction several
places, so I ended up hiding it in a sub:
sub timed_at { foreach (sort {$a->[0] <=> $b->[0]} @_) { at @$_ } }
timed_at
[ T1, "action 1a, action 1b, action 1c"],
[ T2, "action 2a, action 2b, action 2c"],
[ T3, "action 3a, action 3b, action 3c"],
[ T4, "action 4a, action 4b, action 4c"],
[ T5, "action 5a, action 5b, action 5c"];
where, since the literal now appears in a temporary anyway, C<foreach>
is the obvious choice. I'm no C<map> bigot, I just want to be able to
write whichever way seems natural in each particular case.
Style should not be enforced through lack of proper optimisation.
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
- Do radioactive cats have 18 half-lives? -
------------------------------
Date: Wed, 03 Jun 1998 13:39:30 GMT
From: John Porter <jdporter@min.net>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <357553BE.7DB5@min.net>
Damian Conway wrote:
> ced@bcstec.ca.boeing.com (Charles DeRykus) writes:
> > @items = map { s/foo/bar/ }; # elided RHS list defaults to LHS
> > @items = sort { $a <=> $b };
> > @items = grep(/condition/);
>
> Surely a generalization of the "binding" operator (=~) would be
> a better choice for such constructs:
>
> @items =~ map { s/foo/bar/ };
> @items =~ sort { $a <=> $b };
> @items =~ grep { /condition/ };
No, I think it otta be:
@items map= { s/foo/bar; $_ };
@items grep= { /foo/ };
@items sort= { $a <=> $b };
@items sort= by_num; # where:
sub by_num { $a <=> $b }
I.e. why aren't there any "binary assignment" operators for arrays?
John Porter
------------------------------
Date: Wed, 03 Jun 1998 13:46:51 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <pudge-0306980941110001@192.168.0.3>
In article <357553BE.7DB5@min.net>, jdporter@min.net wrote:
# No, I think it otta be:
#
# @items map= { s/foo/bar; $_ };
# @items grep= { /foo/ };
# @items sort= { $a <=> $b };
# @items sort= by_num; # where:
# sub by_num { $a <=> $b }
#
# I.e. why aren't there any "binary assignment" operators for arrays?
ewwwwwwwww.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 03 Jun 1998 13:46:36 GMT
From: John Porter <jdporter@min.net>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <35755568.18A0@min.net>
Tom Christiansen wrote:
>
> It's clear when you say
> @foo = map {} sort {} map {} @bar;
> That that map is used for its return value is clear and obvious.
> Side effects suck.
Side effects *don't* suck, as long as it's clear and obvious why
and how it's happening. As "Abigail" said: s///, print, =.
But more to the point, side effects and back-to-front pipelining
don't go hand-in-hand. First you bashed one, now you bash the
other. Is either one of them really bad? No, not really; not
intrinsically.
John Porter
------------------------------
Date: 3 Jun 1998 13:52:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l3kfj$l04$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
jdporter@min.net writes:
:I.e. why aren't there any "binary assignment" operators for arrays?
Because there aren't many infix binary operators that work
usefully on arrays.
@foo ||= @bar;
Will not make you happy.
--tom
--
Fine, let them give me the endless crap. --Andrew Hume
------------------------------
Date: 03 Jun 1998 10:40:58 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Net::Ping::Wont::Sodding::Work::Help!::
Message-Id: <isogwayj1h.fsf@godzilla.kiere.ericsson.se>
"Simmo" <simsi@hotmail.com.nospam> writes:
> Any ideas gratefully received.
Here's one: describe the problem! "Doesn't work" covers everything
from trying to run the script under Perl4 to nuclear explosions in
your computer room.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 3 Jun 1998 10:05:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: new to OO Perl
Message-Id: <6l3765$9up$1@lyra.csx.cam.ac.uk>
Zenin <zenin@bawdycaste.org> wrote:
>Larry Rosler <lr@hpl.hp.com> wrote:
> Well, it does, a little. But in really odd ways depending on just
> how one defineds the constant. I've always taken it for granted
> that sub FOO { 1 } would be more or less the same as constant FOO =>
> 1, but it's not. Not by a long shot:
[snip]
> This is in direct opposition to what perlsub says about inlining
> constant subs.
No it's not. Your subroutines don't have prototypes. From perlsub:
Constant Functions
>>>> Functions with a prototype of () are potential candidates
for inlining. If the result after optimization and constant
folding is either a constant or a lexically-scoped scalar
which has no other references, then it will be used in place
of function calls made without & or do. Calls made using &
or do are never inlined.
Mike Guy
------------------------------
Date: 3 Jun 1998 13:00:38 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: new to OO Perl
Message-Id: <896879344.125138@thrush.omix.com>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
: No it's not. Your subroutines don't have prototypes. From perlsub:
Duh... My bad. :-)
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Wed, 03 Jun 1998 09:52:36 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: oops (Re: Piping in Win32 Perl...)
Message-Id: <35750ED3.C4414173@nortel.co.uk>
print "Content-type: text/html\n\n";
that's better...
------------------------------
Date: 3 Jun 1998 10:36:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl 5.004_04 question
Message-Id: <6l38vk$atk$1@lyra.csx.cam.ac.uk>
Rick Bauman <rick@internetx.net> wrote:
>I recently installed Version 5.004_04 on a HPUX 10.20 machine, CGI
>scripts run fine, but command line scripts, including ones that
>worked before(on 5.003m), and ones provided with the perl distribution, such as
>find2perl all come up with the same 3 errors:
>
>Variable Syntax
>use: command not found
>require: command not found
Those aren't Perl error messages. So you're probably feeding the
scripts to something other than Perl (a shell perhaps). Or you're not
using the version of Perl you think you are.
Mike Guy
------------------------------
Date: Wed, 03 Jun 1998 08:02:57 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl class for newbie?
Message-Id: <35754981.ACAC7D73@mail.uca.edu>
[posted only]
(actually sticking my nose in and answering a question directed to TP)
Dan Franco wrote:
>
> > > Please remove the DONTSPAM from your email address to get email courtesy
> > copies of replies. :-)
>
> I mind checking the newsgroup for replies less than I mind deleting
> spam. :) Don't you get a lot of spam when you post in the clear?
Actually, I don't. I've been posting here and on other comp.* and sci.*
groups fairly regularly, and I get at most an email spam or two a week.
Maybe that's a lot for you, but a minor annoyance for me, outweighed
(IMHO) by the convenience to anyone who might want to correspond.
Cameron
camerond@mail.uca.edu
(To email a reply, replace @ with @ in my address.) - author unknown
------------------------------
Date: Wed, 03 Jun 1998 08:05:44 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl class for newbie?
Message-Id: <35754A28.42F11931@mail.uca.edu>
[posted only]
(actually sticking my nose in and answering a question directed to TP)
Dan Franco wrote:
>
> > > Please remove the DONTSPAM from your email address to get email courtesy
> > copies of replies. :-)
>
> I mind checking the newsgroup for replies less than I mind deleting
> spam. :) Don't you get a lot of spam when you post in the clear?
Actually, I don't. I've been posting here and on other comp.* and sci.*
groups fairly regularly, and I get at most an email spam or two a week.
Maybe that's a lot for you, but a minor annoyance for me, outweighed
(IMHO) by the convenience to anyone who might want to correspond. (now,
of course, I'm going to be flooded ;(. )
Cameron
camerond@mail.uca.edu
(To email a reply, replace @ with @ in my address.) - author unknown
------------------------------
Date: 3 Jun 1998 10:10:33 GMT
From: "Kenny Nguyen" <kenn@xuviet.org>
Subject: perl Security Mode.
Message-Id: <01bd8ed7$76c0c6a0$31fe7880@internet.internet.com>
Please help,
I'm wondering if anyone could help me with perl script. Recently my ISP
has just switched perl to run it under secure mode. It's an NT server
running Perl5.xxx with -T switch for secure mode. What I have found out is
that i need to untaint the variable I have set. But I really don't know
how to do it. I read perlsec but it didn't give much help. Please give me
some hints: Below is a sample script.
#!/usr/bin/perl
$number = "4";
$file_path = "../read/poetry/";
open (file, ">$file_path$number.html");
print file "hello";
close (file);
The above simple script won't open a blank file and write to that file. if
i specify it as:
open (file, ">../read/poetry/4.html");
print file "hello";
close (file);
then it will work. But it doesn't help me much since I need to get data
number for $number string from a text file. Please show me how to untaint
this variable or any variable that need to be untaint.
Thanks in advance,
Kenny
------------------------------
Date: 3 Jun 1998 12:44:19 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: Perl-Frage
Message-Id: <6l3gf3$ikv$1@penthesilea.Materna.DE>
In article <3574203a.7382194@news.btinternet.com>, Gellyfish@btinternet.com says...
>
>On 2 Jun 1998 06:50:11 GMT, J|rgen P|nter wrote :
>
>>[snip horrible translation]
>
>It was simply a piece of satire. I wouldnt have posted if the
>translation hadnt been quite so horrible. Lighten up.
Sadly, I have to deal with this kind of translation much too often.
Even sadder when it comes from a human who really should be able to
do better (read: an incompetent translator).
Thus my reaction invariably is: groan - jump on soapbox - rant.
Besides, satire is quite hard to spot in text-form without any
indication that it might be meant as such.
Oh well, I'll put on a <bg> and climb off the box now.
Have a nice day
Juergen Puenter
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2795
**************************************