[11159] in Perl-Users-Digest
Perl-Users Digest, Issue: 4759 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 27 09:08:26 1999
Date: Wed, 27 Jan 99 06:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 27 Jan 1999 Volume: 8 Number: 4759
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: [Perl] How to find the Perl FAQ <chomanyu@netvigator.com>
Re: Another newbie question :-) <tumtum73@yahoo.com>
CPAN dl only newest <kar@webline.dk>
Re: Deleting dupes with Perl dturley@pobox.com
Re: dupes in Perl dturley@pobox.com
Re: dupes in Perl dturley@pobox.com
Re: HELP - with redirect of STDERR and STDOUT <qdtrini@jdicms88.ericsson.se>
Re: impossible configure perl CGI on IIS4? <Steve_Kilbane@cegelecproj.co.uk>
Re: Jesus Rides a HOG(tm) : was :CONCLUSIVE PROOF: The <grendal@buffnet.net>
Re: loops (Tad McClellan)
Re: Majordomo interface dave@mag-sol.com
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Perl Threads <nuno.leitao@uk.uu.net>
please help: outputting line number to display <23_skidoo@geocities.com>
Re: Request for negative value list indexes (Bart Lateur)
Sending email info@gadnet.com
sendmail part deux <iqbal@orangenet.co.uk>
socket is not closing nsd@aitpl.com
Re: system function, Pros and Cons?? <tchrist@mox.perl.com>
WANTED: Perl Programmer (London/UK) <damian@mediaconsult.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Jan 1999 11:24:33 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage917436241.5182@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Jan 1999 20:10:54 +0800
From: Cho Man Yu <chomanyu@netvigator.com>
Subject: Re: [Perl] How to find the Perl FAQ
Message-Id: <36AF024E.2FB4@netvigator.com>
Tom Phoenix wrote:
>
> Archive-name: perl-faq/finding-perl-faq
> Posting-Frequency: weekly
> Last-modified: 10 Sep 1998
>
> [ That "Last-modified:" date above refers to this document, not to the
> Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
> 1998; of course, ongoing updates are made as needed. ]
>
> For most people, this URL should be all you need in order to find Perl's
> Frequently Asked Questions (and answers).
>
> http://cpan.perl.org/doc/FAQs/
>
> Please look over (but never overlook!) the FAQ and related docs before
> posting anything to the comp.lang.perl.* family of newsgroups.
>
> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
>
> Beginning with Perl version 5.004, the Perl distribution itself includes
> the Perl FAQ. If everything is pro-Perl-y installed on your system, the
> FAQ will be stored alongside the rest of Perl's documentation, and one
> of these commands (or your local equivalents) should let you read the FAQ.
>
> perldoc perlfaq
> man perlfaq
>
> If a recent version of Perl is not properly installed on your system,
> you should ask your system administrator or local expert to help. If you
> find that a recent Perl distribution is lacking the FAQ or other important
> documentation, be sure to complain to that distribution's author.
>
> If you have a web connection, the first and foremost source for all things
> Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
> CPAN also includes the Perl source code, pre-compiled binaries for many
> platforms, and a large collection of freely usable modules, among its
> 560_986_526 bytes (give or take a little) of super-cool (give or take
> a little) Perl resources.
>
> http://cpan.perl.org/
> http://www.perl.com/CPAN/
> http://cpan.perl.org/doc/FAQs/FAQ/html/
> http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
>
> You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
> you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
> selected FTP sites is especially good for you, a full list of CPAN sites
> is in the SITES file within CPAN.)
>
> California ftp://ftp.cdrom.com/pub/perl/CPAN/
> Texas ftp://ftp.metronet.com/pub/perl/
> South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
> Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
> Australia ftp://cpan.topend.com.au/pub/CPAN/
> Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
> Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
> Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
>
> If you have no connection to the Internet at all (so sad!) you may wish
> to purchase one of the commercial Perl distributions on CD-Rom or other
> media. Your local bookstore should be able to help you to find one.
> Another possibility is to use one of the FTP-via-email services; for
> more information on doing that, send mail to <mail-server@rtfm.mit.edu>
> (not to me!) with these lines in the body of the message, flush left:
>
> setdir usenet-by-group/news.announce.newusers
> send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
>
> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
>
> Comments and suggestions on the contents of this document
> are always welcome. Please send them to the author at
> <pfaq&finding*comments*@redcat.com>. Of course, comments on
> the docs and FAQs mentioned here should go to their respective
> maintainers.
>
> Have fun with Perl!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Is this free of charge
------------------------------
Date: Wed, 27 Jan 1999 19:04:55 -0600
From: Stephen Correia <tumtum73@yahoo.com>
To: =?iso-8859-1?Q?S=E9bastien?= Fouss <sfu@ficsgrp.com>
Subject: Re: Another newbie question :-)
Message-Id: <36AFB7B6.5CE4A973@yahoo.com>
Sibastien Fouss wrote:
> Hi all,
>
> Here is my question:
> 1. If I use a very simple Perl Script:
>
> #!c:/perl/bin/perl
> use strict;
> print "Content-type: text/html\n\n" ;
> print "blah blah\n ";
> exit;
>
> it works ok, either in command line or if the script is put in the
> cgi-bin directory of my Apache server, and the request is made by a
> client.
>
> Now, if I add one of these lines after 'use strict;' :
>
> use LWP::UserAgent;
> use HTTP::Request::Common;
>
> (I have to use this for an http connection), the script can still run in
> command line mode, but I get an Internal Server Error from Apache (in
> the log file from Apache: Premature end of script headers).
>
> Where is the problem ?
>
> Thanks in advance,
> Sibastien
I believe the problem might be permissions. When you run the script from
the command line, you run it as you (whatever you have permissions to).
When you run it from a web browser, you are running it as 'nobody'. This
userid must have access to whatever you need the program to do.
------------------------------
Date: Wed, 27 Jan 1999 12:30:11 +0100
From: Kaare Rasmussen <kar@webline.dk>
Subject: CPAN dl only newest
Message-Id: <36AEF8C3.9A26EEA@webline.dk>
I'm looking for a way to just download the newest version of all the
modules at CPAN(?)
------------------------------
Date: Wed, 27 Jan 1999 12:44:27 GMT
From: dturley@pobox.com
Subject: Re: Deleting dupes with Perl
Message-Id: <78n1na$qfb$1@nnrp1.dejanews.com>
In article <MPG.1117d4c3c66bf94b9899cb@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> This also deletes entries whose value is false, such as '0', as is
> mentioned in the FAQ you copied this from. Why not simply aim the
> questioner to the FAQ (as two of us have already), so he can get the
> whole story?
>
Again, my apologies. I've gained a lot from this group. I saw a post asking
how to do exactly something I was doing, so I posted the code I was using. I
have (had) no idea where I got it, although it was probably from a newsgroups
posting.
The original poster was sorting names, guess I've missed meeting all those
people named '0'. I reset being accused of simply copying part of a FAQ,
thereby purposefully misleading someone.
Another responder accused me of answering FAQ with my own code "again." I am
not aware of doing so, please let me know where this happened and I will
apologize to the FAQ authors for unknowingly stealing thier ideas.
Well, anyway, I'm back to ignoring topmind.
--
____________________________________
David Turley
dturley@pobox.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 27 Jan 1999 12:36:32 GMT
From: dturley@pobox.com
Subject: Re: dupes in Perl
Message-Id: <78n18f$qah$1@nnrp1.dejanews.com>
In article <36AE76E7.4D8E263B@ngb.se>,
Staffan Liljas <staffan@ngb.se> wrote:
> Let's not resort to namecalling, we're all better than topmind, aren't
> we? (And he didn't even use 'dickhead', as far as I recall)
Well, you've got me there. I might have no idea what PLONK! means (not good
I'm sure :-) but being put in the same sentance as topmind hurts. My
aplogies.
--
____________________________________
David Turley
dturley@pobox.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 27 Jan 1999 12:48:23 GMT
From: dturley@pobox.com
Subject: Re: dupes in Perl
Message-Id: <78n1ul$qq3$1@nnrp1.dejanews.com>
In article <36AE7AC9.15BBE22F@home.com>,
Rick Delaney <rick.delaney@home.com> wrote:
> Why are you answering FAQs with your own code again?
Again? Please point out where I did this. I know I have never purposefully
answered a FAQ with my own code. I'd be very pleased to see where I managed to
repeat a FAQ off the top of my head.
--
____________________________________
David Turley
dturley@pobox.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 27 Jan 1999 10:22:17 +0100
From: Richard Nilsson <qdtrini@jdicms88.ericsson.se>
Subject: Re: HELP - with redirect of STDERR and STDOUT
Message-Id: <36AEDAC8.27F11BBD@jdicms88.ericsson.se>
> The definition of the function (method) should be:
>
> (out, err, ret) = execute_mycmd($params),
>
> Where:
>
> out is the output printed on STDOUT
> err is the output from STDERR
> ret is a return code from the function
>
I just checked if someone answered the question, and saw my own bug. The
usuage
of the function should of course be:
($out, $err, $ret) = execute_mycmd($params);
But you already knew that...
------------------------------
Date: 27 Jan 1999 11:23:15 GMT
From: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>
Subject: Re: impossible configure perl CGI on IIS4?
Message-Id: <78msv3$51r$1@news.cegelecproj.co.uk>
In article <78kv20$4rl$1@nnrp1.dejanews.com>, foobar678@my-dejanews.com writes:
> *The folder it's in is marked executable.
In the MMC, I assume, rather than via Windows NT Explorer?
> *The "Application Settings"|Configuation contains the
> correct mappings for .pl files.
And with %s %s, as mentioned by another responder?
> print "Content-Type: text/plain\n\n";
> print "Hello, Perl world!\n";
>
> And ever time you click on the file,
Click on the file? Generally speaking, you want directory indexing
turned off for CGI directories. Safer that way. So, I take it you
mean clicking on the URL to the script, yes?
> for a millisecond a console
> window flashes and the "you have chosen to download a file" box
> also flashes. Then Nothing.
Actually, this might all be working fine - if your browser isn't
configured to display "text/plain", unlikely though that is. Does the
file you save contain the Perl script or just the "Hello, Perl world!" string?
The console window worries me, though. That happens on Windows 95,
but not on NT - at least, I haven't _seen_ it on NT.
--
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
IIS4+Perl5 FAQ: http://www.whitecrow.demon.co.uk/steve/iis4.html
------------------------------
Date: Wed, 27 Jan 1999 05:41:42 -0500
From: grendal <grendal@buffnet.net>
Subject: Re: Jesus Rides a HOG(tm) : was :CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <36AEED60.EAC2CC5B@buffnet.net>
Take sci.astro.amateur out of your list...or start posting something related.
Astro and riding aren't that far apart, unless you're a dip shit.
My 21 year old rebuilt honda cb 750 will tool you insignificant fuckers anyway.
Not saying I don't want a harley, but what am I supposed to do, kill
one of you? (Easier done then said, but you can't see the stars from
jail.) You probably don't ride anyway. If you want to debate the facts,
email me, you bloated jackass. (Or even better...
actually, I like this NG too much to go on.) Always good to have
my theory proven, genetics are in fact working in reverse.
Ears wrote:
>
> On Wed, 27 Jan 1999 03:11:43 GMT,
> Spider Fighter <spiderfighter@REMOVETHISTOEMAILMEhotmail.com> wrote:
>
> >Well, _that_ was interesting.
> >Please don't post this thread to the rec.games.video.nintendo newsgroup any more.
>
> OK, consider it done. No longer crossposting there.
>
> BTW, did John Lennon ride a Harley ? Or any other bike, for that matter ?
>
> I'll bet if Harleys were around when Jesus was, he, and all his apostles
> would've ridden. Well, they did say he could see the future....
>
> BTW, this thread is no longer being posted to rec.games.video.nintendo.
> If you don't want this posted to your newsgroup either, reply to us here
> at rec.motorcycles.harley, and we will be glad to take it out of the
> header for you. Unless of course, you're smart enough to do it yourself
> before you repost.
>
> This thread is currently being maintained by bonafide Harley riders now.
>
> --
> *Ears* 98 XL 1200 Custom
> kd4zkw@amsat.org
> http://www.dialisdn.net/user/cdlevin
------------------------------
Date: Tue, 26 Jan 1999 23:47:22 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: loops
Message-Id: <a99m87.th3.ln@magna.metronet.com>
Ying Hu (yhu@mail.nih.gov) wrote:
: Do you know the answer? I did not think so!
I do not even know the _question_.
Your specification is a good attempt, but has ambiguities.
What output would you want if @stuff = (0, 1, 2, 3);
???
I'm not sure I can fill in your ...s with what you want.
So you fill them in with what you want.
Four elements doesnt' seem too bad.
If you are after some sort of series, then _specify_ the series.
Examples with gaps in them are not a specification.
A _complete_ example (or even two examples saw with n=3 and n=5)
might help if you can't give a mathematical description.
Type them in. Maybe somebody will help you with it.
: Alastair wrote:
: > Ying Hu <yhu@mail.nih.gov> wrote:
: > >How to use loops to print an array (@stuff) as the following:
: > >$stuff[0]
: > >$stuff[1]
: > >$stuff[2]
: >
: > Almost too basic to answer. You should try and learn a little more. Look for
: > 'foreach'.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 27 Jan 1999 11:13:44 GMT
From: dave@mag-sol.com
Subject: Re: Majordomo interface
Message-Id: <78msd4$mi7$1@nnrp1.dejanews.com>
In article <36ae178c$0$16664@nntp1.ba.best.com>,
"Greg Hassan" <greg@hassan.com> wrote:
> Its really not useful anymore. Go to:
>
> http://www.egroups.com/
>
> You can create your own email groups
> for free. Plus, it saves all messages in
> a searchable newsgroup style.
London.pm used to run a mailing list on egroups. We stopped when they started
sending us non-standard HTML mail and didn't seem to understand our objections
to it when I emailed them about it.
Dave...
--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Jan 1999 13:32:07 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn7au5am.ivr.dformosa@godzilla.zeta.org.au>
In article <78lpql$r94$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <78kim7$pi1$1@nnrp1.dejanews.com>,
> droby@copyright.com wrote:
[...]
>> The problem with our junior language designer's concept here is that if you
>> lose the short-circuit for this neat trick, you lose the optimization that
>> led to its availability.
>
>Insults like this do not cover the fact that they are unnecessary,
>and therefore not worth the readability risk.
However optimisations like this have a magour impact in code running
time and useablity. if ($a != 0 and $b/$a>10) { is not something that
I can do without. Indeed I would argue that given that these are
quite commen in most langages most programers will be expecting them
and therefore a lanague without them would be more confising.
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: Wed, 27 Jan 1999 12:04:36 +0000
From: Nuno Leitao <nuno.leitao@uk.uu.net>
Subject: Perl Threads
Message-Id: <36AF00D4.AD43A811@uk.uu.net>
Hello,
as anyone used multithreading in Perl 5.005 in a serious way ?
How stabe is it ? Also, is there a way to do thread cancelation ?
Thanks.
PS: Could you please reply to e-mail to ?
--Nuno.
------------------------------
Date: Wed, 27 Jan 1999 12:15:16 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: please help: outputting line number to display
Message-Id: <36AF0350.6700@geocities.com>
hi,
i'm trying to write debugging lines into a large script, to help myself
out on open commands i'm using the following:
open (UPDATE, ">$datafile") || print "can't open $datafile line
476<br>";
this is fine until i change something higher up in the script then the
line numbers in the printout no longer match.
is there a way to get perl to output the line number it is executing at
any given point so i don't have to change these by hand?
thanks for any help or sugegstions
-23
------------------------------
Date: Wed, 27 Jan 1999 10:44:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Request for negative value list indexes
Message-Id: <36aeec75.11220408@news.skynet.be>
Ben Smith wrote:
>Wouldn't it be nice to be able to reference a list element from the end
>as well as from the begining.. $array[-1] would be equivalent to
>$array[$#array] and $array[-2] would be equivalent to
>$array[$#array-1].
It works alright. The only annoying thing, because it doesn't work, is
the combination of positive and negative subindices, as in:
@ary = qw(A B C D E)
$first = $ary[0];
@rest = @ary[2 .. -1]; # does NOT work, because -1 < 2
Note that the subindices in the second statement actually form an array,
which turns out empty. By contrast, the next does work:
@sub = @ary[-3 .. -1];
because the subindices range expands to the array (-3,-2,-1).
Perl really ought to DWIM. IMO.
Bart.
------------------------------
Date: Wed, 27 Jan 1999 13:37:17 GMT
From: info@gadnet.com
Subject: Sending email
Message-Id: <36af1488.2056306@news.newsguy.com>
What's wrong with ths:
while (<MEMBERS>)
{
chomp;
open (MEMBER, "+<$bpdata/$_.txt");
@member = <MEMBER>;
close (MEMBER);
chomp $member[1];
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "To: $member[1]\n";
print MAIL "From: $myemail\n";
print MAIL "Subject: $title\n\n";
print MAIL "$email\n\n";
close MAIL;
}
close (MEMBERS);
When I run the script that contains this I get a Server Error message.
It sends three emails correctly, but then fails on the fourth. The
fourth email address in the MEMBERS file is invalid, but I would
expect it to send the email anyway. How can I change this so that it
will work whether the email address of the recipient is valid or not?
Drummond Miles
------------------------------
Date: Wed, 27 Jan 1999 11:38:38 +0000
From: iqbal <iqbal@orangenet.co.uk>
Subject: sendmail part deux
Message-Id: <36AEFABE.E8B80F58@orangenet.co.uk>
Hi
I have a shell command which works fine
`$mailprog who@ever.com <message` #where mailprog is /usr/sbin/sendmail
Now I want to do this in perl, but am not getting very far.
open(MAIL, "|$mailprog who@ever.com");
*see below;
close(MAIL)
* this is the part where I am stuck, do I need to read in the message
and print each line out to the MAIL filehandle, or can i just put the
entire thing in (this i would prefer).
Thanks
Iqbal
PS just in case anyone is wondering why, well its because I have a perl
script which runs fine, with a call to the shell, but when I put it in
crontab /usr/bin/perl /path/to/program.pl it fails if I put a \@ in the
email address
eg
`$mailprog who\@ever.com <message`
but with it removed the perl script fails , cause you need to escape it.
------------------------------
Date: Wed, 27 Jan 1999 13:01:48 GMT
From: nsd@aitpl.com
Subject: socket is not closing
Message-Id: <78n2no$ra2$1@nnrp1.dejanews.com>
i am facing problem to close a socket.i am opening a socket to server,after
connection i am just closing it,but it's closing on client-side only on
server telnet process is still there(i checked this by 'netstat'),i am
confused where is problem,here is the code i am using:- #!/usr/sisisbin/perl
-w use Socket; $server="localhost"; $port=23; $|=1;
socket(SOCKET,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2]); print"socket
is created\n";
connect(SOCKET,pack('Sna4x8',AF_INET,$port,(gethostbyname($server))[4])) or
die" can't connect\n"; #send(SOCKET,$R,0); #recv(SOCKET,$R,500,0);
print"$R\n"; close(SOCKET) || die "close error:$!"; print"$r\n";
------------------------------------------- the result of this code is:perl
script closes on client-side,but netstat shows that telnet is still running.
please tell me where is problem,Thanks in advance.. Narayan singh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Jan 1999 04:30:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: system function, Pros and Cons??
Message-Id: <36aef8cc@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Jeff Hester <jeff@toad.net> writes:
:I have just recently begun my perl education. My first task was a
:formatter for the output from "prex -k" in Solaris 2.6. also a little
:hexadecimal conversion thingy (that's not quite working yet :)).
:
:A coworker of mine (who is a much more experienced perl person than
:myself) Took a look at it and informed me that I "Should never use
:system()". I called allot of unix commands through this and they seemed
:to work just fine. Unfortunately he couldn't give me a good reason why
:I shouldn't use that function.
:
:Does anyone know if "system" is faulty in some way? why would you not
:want to use it???
There's nothing -- ABSOLUTELY NOTHING -- `wrong' with system(). Why do
you think Larry put it there? Remember that Perl is a glue language
designed to get a job done. Part of its job is to interact with the
system, and that means gluing things together in various ways. One of
those ways is sometimes to do so shellishly using backticks, pipe opens(),
and system().
Of course, "prex" is not a command that you'll find on all possible
systems, but big deal. What one is? Answer: nothing, save perhaps Perl,
in a Descartian kind of way. If using system() is good enough because
that's what suits *your* needs, then that's what counts. Rejoice in
the simplicity and power of the interchangeable toolbox approach that
draws upon existing technology, and just do what it takes to get your
job done so that you get to go home to your family and friends before
the cock crows. Let no man tell you otherwise!
Plus, doing it this way doesn't require the obscene rigamarole that you
would need to include proper support for multi-threaded, object-oriented,
persistent, distributed, platform-independent, and language-neutral (i18n)
support in your module, complete with transparent access via Java RMI
and as a COM object -- the way the frothing fanantics keep espousing.
These poor deluded folks constitute a cult of complexity, one whose
credo breeds fragile overengineering and inscrutable overabstraction.
Please don't encourage them.
Now, there is a small issue with system(SCALAR) vs system(LIST), which
might have been what your colleague was alluding to. But that's there
by design, intended to make it easier to use Perl as a glue language.
Just just need to understand the difference (whether the shell might
be called or not). You might check the definitions and descriptions of
system() and exec() in the perlfunc and perlsec manpages regarding this.
Keep it simple, keep it sane.
--tom
--
echo "I can't find the O_* constant definitions! You got problems."
--The Configure script from the perl distribution
------------------------------
Date: 27 Jan 1999 12:32:11 +0000
From: Christof Damian <damian@mediaconsult.com>
Subject: WANTED: Perl Programmer (London/UK)
Message-Id: <m3ww28c2wk.fsf@tb303.mediaconsult.com>
Internet Programmer (Unix, Perl, SQL) permanent London/UK
Job Title: Internet Programmer (Unix, Perl, SQL)
Location: London UK (Highgate)
Duration: permanent
mediaconsult ltd. is a internet consulting company based in london
(uk) and cologne (germany). For a new project we are looking for
programmers.
We are a looking for programmers with experience in developing
internet application in a unix enviroment. The project will be the
development of databases with an internet frontend.
Skills required are: Perl, HTML, SQL and Unix administration.
Desireable skills are knowledge of Linux, Apache, Java, C++ and MySQL.
mediaconsult ltd.
33 Greenwood Place
London NW5 1LB
jobs@mediaconsult.com
http://mediaconsult.com/
--
Christof Damian [ we are looking for perl and linux
Technical Director programmers, more information @
http://mediaconsult.com/ http://mediaconsult.com/wanted.html ]
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4759
**************************************