[9185] in Perl-Users-Digest
Perl-Users Digest, Issue: 2802 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 3 21:07:18 1998
Date: Wed, 3 Jun 98 18:00:27 -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: 2802
Today's topics:
Re: A problem with [\d]+ (Shaun Sides)
Re: Batch files? (Jonathan Stowe)
Re: CGI/Perl Department Head (David Adler)
Re: Fun with two arrays (Kevin Reid)
Re: HELP! Parsing text files for tables (Jonathan Stowe)
Re: How to set timezone via cgi using perl (Jonathan Stowe)
Re: How to set timezone via cgi using perl (Ilya Zakharevich)
Re: map in void context regarded as evil - suggestion (Kevin Reid)
Re: map in void context regarded as evil - suggestion (Kevin Reid)
Re: map in void context regarded as evil - suggestion (Kevin Reid)
Re: map in void context regarded as evil - suggestion (Michael J Gebis)
Re: map in void context regarded as evil - suggestion <tchrist@mox.perl.com>
mystified by interaction between \Q and @ in pattern (Rahul Dhesi)
Re: Negative values from Win32::GetTickCount? (Raymond Chen)
Net::Ping problem (Paul Farber)
Re: newbie: trying to remove unwanted data from an arra (Kevin Reid)
Re: newbie: trying to remove unwanted data from an arra (Shaun Sides)
Re: newbie: trying to remove unwanted data from an arra (Larry Rosler)
Re: Perl module for doing a unix 'which'? <tchrist@mox.perl.com>
Re: Seeking on a pipe <tchrist@mox.perl.com>
Re: setting a uid <rootbeer@teleport.com>
Re: Spider programms in PERL (Abigail)
Re: Success of call to open() or system() ? <rootbeer@teleport.com>
Re: Success of call to open() or system() ? (Jonathan Stowe)
Re: Use of HTML, POD, etc in Usenet (was: Re: map in vo <zenin@bawdycaste.org>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Jun 1998 23:05:56 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: A problem with [\d]+
Message-Id: <slrn6nb3j2.8l0.arch@abts.net>
Original message by: Tad McClellan <tadmc@flash.net>
Date: Wed, 3 Jun 1998 07:42:44 -0500
Subject: Re: A problem with [\d]+
> \d matches digit characters
>
> \D matches non-digit characters...
>
>
> I can't see why you would wrap it in a character class for either case.
Well, true enough. I have an easier time at this juncture remembering
the 'match' metas than I do the 'don't match' ones. ;-)
--
==============================================================================
Shaun L. Sides | Hey! CyberGold | arch@abts.net
Free Randal Schwartz and Ric Flair! | wastes yer time | arch@sara.mmlc.nwu.edu
==============================================================================
The time for desperation is upon us. Let's play.
First Wizard Zeddicus Zu'l Zorander
==============================================================================
------------------------------
Date: Wed, 03 Jun 1998 23:01:55 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Batch files?
Message-Id: <3575d18a.19576203@news.btinternet.com>
On Wed, 03 Jun 1998 14:17:17 -0700, Douglas Nusbaum wrote :
>Is it possible to run a batch file from a perl script?
>If so, could someone send me some sample code.
>
>Code.
>more code(file.bat)
>more code
>
You might find it useful to examine the perlfunc document which should
have come with your Perl distribution. A good thing to search for
would be "execute".
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 3 Jun 1998 23:23:37 GMT
From: dha@panix.com (David Adler)
Subject: Re: CGI/Perl Department Head
Message-Id: <6l4ltp$r5b@news1.panix.com>
On Wed, 03 Jun 1998 13:44:50 GMT, Chris Nandor <pudge@pobox.com> wrote:
>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.
Um, actually, don't do it even if you *don't* value your rep.
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Got Perl? <www.perl.com>
Got a Perl User Group? <www.pm.org>
------------------------------
Date: Wed, 3 Jun 1998 19:35:05 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Fun with two arrays
Message-Id: <1da276r.az8245ezfz8iN@slip166-72-108-222.ny.us.ibm.net>
John Porter <jdporter@min.net> wrote:
> Daniel wrote:
> >
> > Given:
> >
> > my @first = qw( one two three four );
> > my @second = qw( mon tue wed thr );
> >
> > What is the quickest way to produce a thrid
> > array such that it contains
> > "one mon two tue three wed four thr"?
> >
> > my @third = ????
>
> my @third = qw( one mon two tue three wed four thr );
>
> But that might be a little hard-coded for most purposes.
>
> If I can assume that @first and @second always have the
> same number of elements, then:
>
> my @third = map { ( $first[$_], $second[$_] ) } 0..$#first;
Also:
$i = -1;
push @third, $first[$i], $second[$i] while $i++ < $#first;
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 03 Jun 1998 23:01:57 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: HELP! Parsing text files for tables
Message-Id: <3575d36b.19922121@news.btinternet.com>
On Wed, 03 Jun 1998 20:42:41 GMT, sfynn@my-dejanews.com wrote :
>I need to parse news releases (formatted text files) which sometimes have
>tabular data in them. I need to place this data into a Foxpro database, which
>is no problem, except that there is no normal format for these tables. Some
>are delineated by spaces, some tabs, some made pretty with ASCII.. So my
>problem is that I can't detect when data is actually a table or not.
>
If you want to do this then you *will* need to discover some attribute
of your input data that distinguish it. Perl can do some pretty neat
stuff but automagically determining the purpose and layout of some
input is not one of them.
If you can abstract some small samples and some code that you have
tried you might get a bit more
>If anyone could direct me to resources or products that would help with this
>situation, it would be much appreciated.
>
I hate to say this but you might find it easier to use something like
Monarch but of course that has nothing to do with Perl.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Wed, 03 Jun 1998 23:26:07 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How to set timezone via cgi using perl
Message-Id: <3575d7b3.21004473@news.btinternet.com>
On Wed, 3 Jun 1998 15:47:05 -0700, Larry Rosler wrote :
>You can determine the timezone of the processor on which the program is
>executing without looking at the TZ environment variable. Some systems
>(such as Windows/DOS) don't have such a variable, yet they know the
>localtime. [Believe it or not, Unix guys. The existence of $ENV{TZ} is
>a reliable differentiator between Unix and WinDOS. $^O is not
>implemented in older perls such as 5.002, and $^O needs to be parsed in
>any case.]
>
Actually that might need a little qualification:
Microsoft(R) MS-DOS(R) Version 6.22
(C)Copyright Microsoft Corp 1981-1994.
C:\WINDOWS>set
COMSPEC=C:\COMMAND.COM
SOUND16=C:\DIAMOND\
BLASTER=A220 I5 D1 T4
PATH=.;C:\DEVELOP\BIN;C:\OPENDOS;C:\BIN;C:\WINDOWS;C:\DIAMOND;C:\WATCOM\BINW;C:\
;C:\BTINTNET
PCTCP=C:\BTINTNET\pctcp.ini
TZ=GMT + 0BST
PROMPT=$p$g
TEMP=C:\TMP
TMP=C:\TMP
...
In the case of this setup the TZ variable is being used by PCTCP
software. However I guess this is not that common nowadays..
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 4 Jun 1998 00:56:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to set timezone via cgi using perl
Message-Id: <6l4rb8$kp0$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.fdf72479e074fb5989693@hplntx.hpl.hp.com>:
> In article <6l4fvo$hfc$1@nnrp1.dejanews.com>, bthak@bascom.com says...
> > I did search on dejanews for that subject and it wasnt much help. If someone
> > can help me out it would be greatly appreciated.
> >
> > I want to be able to set timezone via web interface. Not sure how to.
> > the args in localtime don't seem to have TZ. Thanks in advance.
> ...
>
> You can determine the timezone of the processor on which the program is
> executing without looking at the TZ environment variable. Some systems
> (such as Windows/DOS) don't have such a variable, yet they know the
> localtime.
Nonsense. They know localtime only because of the stupid initial
decision to run system clock in local time (with all the evil
consequences people on DOSISH systems will).
Thus they know localtime, but not globaltime (Win* may be different).
> [Believe it or not, Unix guys. The existence of $ENV{TZ} is
> a reliable differentiator between Unix and WinDOS. $^O is not
> implemented in older perls such as 5.002, and $^O needs to be parsed in
> any case.]
Another bullshit. Anybody may (and should - to run programs such as
perl which care) set TZ on DOSISH machine as well.
Ilya
------------------------------
Date: Wed, 3 Jun 1998 19:34:59 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <1da1h6x.1c9djcn95r7ceN@slip166-72-108-222.ny.us.ibm.net>
Damian Conway <damian@cs.monash.edu.au> wrote:
> 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/ };
Good idea. @ary = sort @ary bugs me because it feels like it is doing an
unnecessary copy (whether it is or not I don't know).
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 3 Jun 1998 19:35:10 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <1da0l8b.1qq6bs11vu6k3kN@slip166-72-108-222.ny.us.ibm.net>
Abigail <abigail@fnx.com> wrote:
> ++ Side effects suck.
>
> s///, print and = are mainly used for their side effects.
++ and --, too.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 3 Jun 1998 19:35:11 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <1da2b6m.1z0guwp177xngaN@slip166-72-108-222.ny.us.ibm.net>
<chris+usenet@netmonger.net> wrote:
> That's one of the reasons the next version of Perl will have
>
> s/foo/bar/ for @list;
>
> which is a rather logical extension of the syntax. Yay Chip.
Will this addition also allow this:
@list[$i] =~ s/foo/bar/ for ($i = 0; $i < $#list; $i++);
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: 3 Jun 1998 23:34:47 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l4min$4u8@mozo.cc.purdue.edu>
abigail@fnx.com (Abigail) writes:
}Michael J Gebis (gebis@albrecht.ecn.purdue.edu) wrote on MDCCXXXVII
}September MCMXCIII in <URL: news:6l4en8$1pm@mozo.cc.purdue.edu>:
}++ abigail@fnx.com (Abigail) writes:
}++ }If only HTML was designed by a committee. BLINK, FONT, BGCOLOR, etc, are
}++ }all "inventions" from the evil empire - Netscape Communication Corporation.
}++ }And they don't believe in standards.
}++
}++ I guess you're probably mad that we're not all still using gopher+ and
}++ that somebody came up with the <IMG> tag.
}You couldn't be more wrong.
IMG was invented by some of the same people who developed BLINK,
FONT, BGCOLOR, etc. Worse still, IMG was added ad hoc, sans committee,
in violation of standards.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 4 Jun 1998 00:34:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <6l4q2m$g8o$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, kpreid@ibm.net (Kevin Reid) writes:
:Will this addition also allow this:
:@list[$i] =~ s/foo/bar/ for ($i = 0; $i < $#list; $i++);
^
^
^ use -w or die;
--tom
--
I think I'm likely to be certified before Perl is... :-)
--Larry Wall in <1995Feb12.061604.6008@netlabs.com>
------------------------------
Date: 4 Jun 1998 00:41:12 GMT
From: c.c.eiftj@83.usenet.us.com (Rahul Dhesi)
Subject: mystified by interaction between \Q and @ in pattern
Message-Id: <6l4qf8$f59$1@samba.rahul.net>
Once in a while I want to match a sequence of fixed characters inside a
perl pattern. In theory one can use \Q ... \E to quote these, but in
practice I have found this not very useful. Are there any better ways
of doing this?
My example program begins as follows:
#! /usr/bin/perl5.003 -w
use strict;
my $str = 'aaaa dhesi@rahul.net bbb';
Now let's try a match:
if ($str =~ /\Qdhesi@rahul.net\E/) {
print "match\n";
}
The above fails because of a compile-time error saying I am using an
unquoted @ character. Ok, let's quote it:
if ($str =~ /\Qdhesi\@rahul.net\E/) {
print "match\n";
}
The above fragment compiles just fine, but does not match, because
(presumably) the embedded backslash is converted to a literal backslash
due to the \Q .. \E. We have to make the \@ be outside the \Q .. \E,
like this:
if ($str =~ /\Qdhesi\E\@\Qrahul.net\E/) {
print "match\n";
}
The above matches, but is too complicated, and defeats the idea behind
using \Q .. \E, which was to keep things simple.
Any better methods that I don't know about, other than putting the
desired literal characters into a variable?
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: Wed, 03 Jun 1998 23:57:42 GMT
From: raymondc.---@microsoft.com (Raymond Chen)
Subject: Re: Negative values from Win32::GetTickCount?
Message-Id: <3575e2ac.180506754@news.alt.net>
On Wed, 3 Jun 1998 09:51:00 -0400, "Chris Brown"
<cbrown_<NoSpam>@erols.com> wrote:
>When using Win32::GetTickCount on a NT machine that has been up for 32 days
>I receive a negative value. This negative value is basically trash when
>determining how long a machine has been running.
15 days = 2^31 milliseconds.
$tick = Win32::GetTickCount();
$tick += 2**32 if $tick < 0;
Whoever wrote Win32::GetTickCount forgot to tell perl that the
resulting 32-bit value was unsigned, not signed.
--
(My return address is intentionally invalid; delete ".---" to get my real address.
My responses are not to be considered official technical support or advice.)
------------------------------
Date: Wed, 03 Jun 1998 23:08:45 GMT
From: farber@f-tech.net (Paul Farber)
Subject: Net::Ping problem
Message-Id: <3575d612.43260269@news.f-tech.net>
Hello all
I'm trying to set up a simple script that pings a machine then ends.
The code I am using is straight out of perldoc Net::Ping (the first 4
lines of code).
The error msg is:Bad arg length for Socket::unpack_sockaddr_in, length
0, should be 16 at /usr/lib/perl5/i486-linux/5.004/Socket.pm line 249.
the script is:
#!/usr/bin/perl
use Net::Ping;
$host="admin.f-tech.net";
$p = Net::Ping->new();
print "$host is alive\n" if $p->ping($host);
$p->close();
Services has echo port enabled ( i tried the script with differnet
Net::Ping() options. But all errored out.
Thanks
Paul
------------------------------
Date: Wed, 3 Jun 1998 19:35:07 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <1da27zd.n0g1lx1pyg400N@slip166-72-108-222.ny.us.ibm.net>
Bob Trieger <sowmaster@juicepigs.com> wrote:
> foreach (@rawoutput) {
> next if !/SUB-TOTAL/i;
> push @output,$_;
> }
>
> it's definately a 1 liner using the map function but I don't wanna embarass
> myself trying to do it.
Larry Rosler posted a solution using grep; here's the equivalent in map:
@output = map { /SUB-TOTAL:/ ? $_ : () } @rawoutput;
(grep-map equivalence copied straight from page 179 of "Programming
Perl".)
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: 3 Jun 1998 23:40:30 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <slrn6nb5b5.8l0.arch@abts.net>
Original message by: Steve Neuharth <steven@mail.dhc.com>
Date: Wed, 03 Jun 1998 21:33:03 GMT
Subject: newbie: trying to remove unwanted data from an array....
> O.k. I KNOW there's an easy answer to this.... I can't seem to find it
> anywhere....
> I've got an array (@rawoutput). I only need the lines that contain
> "SUB-TOTAL:".... I'm trying some thing like this.....
> $x=0;
> for ($y=0;$y <= @rawoutput; $y++){
> if (@rawoutput[$y] =~ /SUB-TOTAL:/) {
> @output[$x] = @rawoutput[$y];
> $x++;
> }
> }
> @output never seems to populate with data (not sure why).
>
> I was thinking there should be a way to do it something like this (?).......
> @output = (@rawoutput =~ /SUB-TOTAL:/);
Ummm.
foreach (@rawoutput) {
push(@output, $_) if /SUBTOTAL:/;
}
See if that helps. ;-)
--
==============================================================================
Shaun L. Sides | Hey! CyberGold | arch@abts.net
Free Randal Schwartz and Ric Flair! | wastes yer time | arch@sara.mmlc.nwu.edu
==============================================================================
The time for desperation is upon us. Let's play.
First Wizard Zeddicus Zu'l Zorander
==============================================================================
------------------------------
Date: Wed, 3 Jun 1998 17:26:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <MPG.fdf89a1e0df4f53989694@hplntx.hpl.hp.com>
In article <1da27zd.n0g1lx1pyg400N@slip166-72-108-222.ny.us.ibm.net>,
kpreid@ibm.net says...
...
> Larry Rosler posted a solution using grep; here's the equivalent in map:
>
> @output = map { /SUB-TOTAL:/ ? $_ : () } @rawoutput;
>
> (grep-map equivalence copied straight from page 179 of "Programming
> Perl".)
Benchmarks show 'map' as much as 40% FASTER than 'grep'; 'map' gets
relatively faster as the output list gets smaller (fewer matches).
I am astounded. YAFI -- Yet Another Failed Intuition.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 4 Jun 1998 00:33:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl module for doing a unix 'which'?
Message-Id: <6l4q0m$g8o$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Justin Vallon <vallon@bear.com> writes: :Why chdir? What about?
: next unless -f "$dir/$_";
Because I don't want to spend so much time in namei(), of course.
--tom
--
All language designers are arrogant. Goes with the territory... :-)
--Larry Wall in <1991Jul13.010945.19157@netlabs.com>
------------------------------
Date: 4 Jun 1998 00:37:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Seeking on a pipe
Message-Id: <6l4q7n$g8o$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, herkimer@cs.wisc.edu writes:
:Does anyone have any suggestions for doing what I want to?
Yeah, don't seek on pipes. Who told you to do that?
Certainly not these people:
The Unix Programming Environment
by Kernighan and Pike; Prentiss-Hall.
POSIX Programmer's Guide
by Donald Lewine; O'Reilly (1991)
Advanced Programming in the UNIX Environment
by W. Richard Stevens; Addison-Wesley (1992)
The Elements of Programming Style
by Kernighan and Plauger; Prentiss-Hall.
--tom
--
"The road to hell is paved with melting snowballs."
--Larry Wall in <1992Jul2.222039.26476@netlabs.com>
------------------------------
Date: Wed, 03 Jun 1998 22:41:01 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: setting a uid
Message-Id: <Pine.GSO.3.96.980603154011.13600U-100000@user2.teleport.com>
On Wed, 3 Jun 1998, Jeremy Hill wrote:
> Does anyone know how I could conveniently
> change uid's in a script that runs as root,
The special $< variable (and related ones) are documented in perlvar. Hope
this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 3 Jun 1998 22:56:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Spider programms in PERL
Message-Id: <6l4kbi$6sg$2@client3.news.psi.net>
Leonid A.Arcadiev (arcadiev@usa.net) wrote on MDCCXXXVII September
MCMXCIII in <URL: news:01bd8f26$fa78ec80$e8854018@dundas>:
++ Can anybody advice how to write a spider in perl, that would check on a
++ website and read through its contents. If the responce has been received,
++ everything is fine, if no responce, generate an error message.
use LWP;
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Wed, 03 Jun 1998 22:46:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Success of call to open() or system() ?
Message-Id: <Pine.GSO.3.96.980603154207.13600V-100000@user2.teleport.com>
On Wed, 3 Jun 1998, Derry Cannon wrote:
> I can't seem to figure out how to determine if the mail command was
> successful.
> open (MAIL, "|mail -s \"Website Feedback - $in{Name}\"
> \"$mailto{$in{To}}\"");
Eek! It is (almost) always very bad to pass an email address on the
command line. An email address may contain shell metacharacters that will
make bad things happen! (Yes, it can have shell metacharacters and still
be a valid address.)
In fact, the mail program on many systems is not meant for this sort of
thing; you should probably use sendmail or another safe method.
Having said all that: When you close the filehandle, Perl will wait for
the process to exit. At that point, the exitstatus is in the special $?
variable. If that's non-zero, something went wrong.
Of course, if that value is zero, that's no guarantee that the mail was
delivered.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 03 Jun 1998 23:01:53 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Success of call to open() or system() ?
Message-Id: <3575cd8c.18949839@news.btinternet.com>
On Wed, 03 Jun 1998 15:15:00 -0500, Derry Cannon wrote :
>Hey, there!
>
> I've got a form parser that emails the form content to me. However,
>I can't seem to figure out how to determine if the mail command was
>successful. The code follows:
>
> open (MAIL, "|mail -s \"Website Feedback - $in{Name}\"
>\"$mailto{$in{To}}\"");
> print MAIL "Name: $in{Name}\n";
> print MAIL "Company: $in{Company}\n";
> print MAIL "Email: $in{Email}\n";
> print MAIL "Phone: $in{Phone}\n";
> print MAIL "Topic: $topic{$in{To}}\n\n";
> print MAIL "$in{Comments}\n\n\n";
> close (MAIL);
>
The close here will cause $? (aka $CHILD_ERROR) to be set to the
status value of the command executing in the pipeline here - you will
need to check the value of it.
>Obviously, if I get the email it works. ; ) My problem is that I want
>to post a confirmation screen saying the email was unsuccessful if the
>mail command doesn't work (eg-if the email address is invalid). Setting
>$success = open (.......) just tells me that the open() was successful,
>not if the mail command it's piping to was. Same problem trying to
>track the success of a call using system():
>
> $var = system("mv", "file1", "file2");
>
>$var receives a value of zero, regardless of whether or not file1
>exists. Any help would be greatly appreciated.
>
If I do the same it returns 256 in $var and $? . The actual return
value is this value divided by 256 - thus 1. Is this possibly
something peculiar about your mv/shell/whatever (or mine)?
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 3 Jun 1998 23:02:10 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Use of HTML, POD, etc in Usenet (was: Re: map in void context regarded as evil - suggestion)
Message-Id: <896915435.549707@thrush.omix.com>
Chris Nandor <pudge@pobox.com> wrote:
: Huh? I have never seen a POD reader built-in to a newsreader. Hence, POD
: in a post will look the same to everyone, necessarily.
If you're using a format other then text/plain, by RFC 1036 it must
be declared as such. Therefor, the reader would try to run whatever
it had mapped to handle type text/x-pod, if it had such a tool
available.
--
-Zenin
zenin@archive.rhps.org
------------------------------
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 2802
**************************************