[10671] in Perl-Users-Digest
Perl-Users Digest, Issue: 4263 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 20 08:07:20 1998
Date: Fri, 20 Nov 98 05:00:40 -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 Fri, 20 Nov 1998 Volume: 8 Number: 4263
Today's topics:
Re: [PLEASE HELP]: Eliminate spaces at end of string <hayati@online.no>
Re: [PLEASE HELP]: Eliminate spaces at end of string (Matthew Bafford)
Re: Beginner Book? lvirden@cas.org
Environment variables.... <ours@casema.net>
Re: file type? <rick.delaney@shaw.wave.ca>
Re: file type? <rick.delaney@shaw.wave.ca>
Re: get unixtime from year and yday rengels@my-dejanews.com
Help with a script.... dingoes@my-dejanews.com
Help:load unix ls>@array for use in cgi list box <mark.c.hamlin@bt.com>
Re: Help:load unix ls>@array for use in cgi list box <zenin@bawdycaste.org>
Re: Holy Abounding Books, Batman! lvirden@cas.org
Re: Is it possible to run a web server on Win95? (Bill Hogsett)
Re: Is it possible to run a web server on Win95? dominikl@my-dejanews.com
Re: Is it possible to run a web server on Win95? (A.J. Norman)
Re: Need HELP: PerlScript <matt@teamamiga.org_NOSPAM>
Re: Net-Whois-0.22 broken? <ben@smartservers.com>
Re: perl documentation date <xah@best.com>
Re: Smarter Web Mailer (I.J. Garlick)
Strange days have found me! <rwilliamson@uno.gers.com>
Re: Strange days have found me! <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Strange days have found me! miles33@ix.netcom.com
Thank You <rakesh_puthalath@hotmail.com>
Trouble with Perl-Postres <tester@mp.pl>
Re: Two-Part RE question (Ilya Zakharevich)
Re: using "format" instruction. <rick.delaney@shaw.wave.ca>
Re: Using PERL to FTP a file to another server <rick.delaney@shaw.wave.ca>
Re: Using PERL to FTP a file to another server <rick.delaney@shaw.wave.ca>
Re: Using PERL to FTP a file to another server <rick.delaney@shaw.wave.ca>
Re: Win16 DLL access (on NT) Help!!! <abramoa@leland.stanford.edu>
Re: Win32::AdminMisc documentation <carvdawg@patriot.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Nov 1998 12:46:16 +0100
From: Hossein Hayati Karun <hayati@online.no>
Subject: Re: [PLEASE HELP]: Eliminate spaces at end of string
Message-Id: <36540508.D141C89F@online.no>
Try this one:
Not tested:
$s =~ s/(\w)+\s+$/$1/;
this one should remove all remaining spaces untill end of string/line.
-- Hossein
------------------------------
Date: Fri, 20 Nov 1998 07:48:59 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: [PLEASE HELP]: Eliminate spaces at end of string
Message-Id: <MPG.10bf2f4676506990989724@news.scescape.net>
In article <36540508.D141C89F@online.no>, Hossein Hayati Karun
<hayati@online.no> pounded in the following:
=> Try this one:
=>
=> Not tested:
WHY Not?
WHY Not?
WHY Not?
=> $s =~ s/(\w)+\s+$/$1/;
=> this one should remove all remaining spaces untill end of string/line.
*bzzzt* Wrong answer.
Take a close look at where the ) and the + are.
perl -we '$_="Hello "; s/(\w)+\s+$/$1/; print "[$_]\n";'
And why bother capturing the word chars before the end of the line? And
what happens if the line ends with '! '?
Please, please, please test your scripts. It's not hard.
Hope This Helps,
=> -- Hossein
--Matthew
------------------------------
Date: 20 Nov 1998 08:32:01 GMT
From: lvirden@cas.org
Subject: Re: Beginner Book?
Message-Id: <7339e1$eta$1@srv38s4u.cas.org>
According to Jeff Kennedy <jeff.kennedy@natdecsys.com>:
:I need a book geared to an ABSOLUTE BEGINNER! No perl experience, no
:programming experience, no real shell scripting experience.
:
:What would I be looking for? Not something that assumes I know
:anything!
That's a good question. I've a co-worker who programmed years ago in
IBM assembler, who now has a Unix workstation on his desktop. He knows
enough shell scripting to read a shell script, but not enough to do much
original scripting. And he knows no C. However, Perl would do wonders
for him. However, when he's looked at the two O'Reilly's books, as well
as tried taking intro courses, he found too much pre-reqs on knowing
scripting and C to get thru the books/courses.
Let me know what you find. I think telling someone to become comfortable
in programming in a compiled language before learning a scripting language
seems, to me, to be the wrong approach. Hopefully someone has taken on
the topic. I know I've had the MacPerl book recommended to me. One of
these days I need to get it and see how that works out.
--
<URL:mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL:http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Fri, 20 Nov 1998 13:31:37 +0100
From: "Casema" <ours@casema.net>
Subject: Environment variables....
Message-Id: <733ni5$8k2$1@sun4000.casema.net>
Is there a way to 'read' environment variables such as:
screen resolution
installed user-name
domain names
from the $ENV????
thanks,
Michel
------------------------------
Date: Wed, 18 Nov 1998 05:16:32 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: file type?
Message-Id: <365259DB.47B73BF@shaw.wave.ca>
Tk Soh wrote:
>
> [posted to c.l.p.m and copy emailed]
>
> ycliang@hidomain.hinet.net wrote:
> >
> > Hi,
> > Under UNIX, we can get a file's type by using "file" command.
> > How can I get file's type in a Perl script? Need special modules?
> > Thanks a lot!
> >
> > Yu-Ching Liang
> > machlian@ms1.hinet.net
>
> not that I have heard of. But if you really want to, you can use the
> backticks (or qx//) to run the Unix 'file' command and capture its
> output.
Another (all Perl) way would be to open the file, read in blocks and
test for non-text characters.
sub file {
my $file = $_[0];
my $block;
my $type = 'text';
my $non_text_chars = "\x80-\xff";
my $blocksize = 8192;
open(FILE, $file) or die "Can't open $file: $!\n";
while (read(FILE, $block, $blocksize)) {
if ($block =~ /[$non_text_chars]/) {
$type = 'data';
last;
}
}
close FILE;
return $type;
}
Proper assignment of $non_text_chars and $blocksize are left to the
reader.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Wed, 18 Nov 1998 23:46:12 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: file type?
Message-Id: <36535DEF.5748B388@shaw.wave.ca>
"Ronald Gvggel" wrote:
>
> perldoc perlfunc
> expecially -e, -f, -z, ...
In this case, -T and -B would be better. Much better suggestion than my
earlier half-baked post.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Fri, 20 Nov 1998 10:31:24 GMT
From: rengels@my-dejanews.com
Subject: Re: get unixtime from year and yday
Message-Id: <733gdt$944$1@nnrp1.dejanews.com>
Thank you for this simple, elegant solution!
Regards,
Reinhard
In article <dP352.107$RQ1.210@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <7318vd$a4g$1@nnrp1.dejanews.com>,
> rengels@my-dejanews.com writes:
> > Is there any simple way of getting the time in non leap year seconds from
1970
> > if you only know:
> >
> > year day
> > year
> >
> > and set seconds, hours, minutes to 0? Sort of like a slightly different
> > "timegm"
>
> Get the seconds since epoch for that year, with everything else set to
> 0 or 1 (using Time::Local::timelocal or timegm)
>
> multiply the year day by the number of seconds per day, add that to
> the result of the previous call, and you should have what you want.
>
> use Time::Local;
>
> # For the 153rd day in 1993
> my $time = timegm(0,0,0,1,0,1993);
> print scalar gmtime($time), "\n";
>
> $time += 153 * 24 * 60 * 60;
> print scalar gmtime($time), "\n";
>
> Martien
> --
> Martien Verbruggen |
> Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
> Commercial Dynamics Pty. Ltd. | things get worse.
> NSW, Australia |
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 20 Nov 1998 08:52:15 GMT
From: dingoes@my-dejanews.com
Subject: Help with a script....
Message-Id: <733ajq$4mm$1@nnrp1.dejanews.com>
(If this is posted twice, please accept my apologies - I had a blowout on the
first attempt)
Hi all....
I am a complete novice when it comes to writing PERL, but I do know my way
around a UNIX box and am very much aware of the power of PERL. I am more at
home with graphics and other things. I have a request that I am hoping
someone from this group may be able to help with.
A friend of mine wrote a PERL script for me which will sort through a single
directory containing my graphics collection, then convert it into html
allowing me to view my collection over the web (restricted access for
protection on copyright etc..) so I can have access whether I am at home, the
office or wherever. I would now like to make the script sort through mutiple
directories so I can categorize the collection, unfortunately my friend is no
longer able to help me. I do have a second script which will do the sort, but
because of my lack of skills in this department, I do not know how to marry
the two scripts together.
Although the main file is only 17kb, I have not posted it here because it is
quite long and I do not know which parts you would need to check. If anyone
feels they may be able to help me, I can forward a copy to your email address.
Thanks kindly
Peter Hutcheon
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 20 Nov 1998 11:56:36 +0000
From: Mark Hamlin <mark.c.hamlin@bt.com>
Subject: Help:load unix ls>@array for use in cgi list box
Message-Id: <365558F3.5352ED8B@bt.com>
Hi all,
firstly - I use comminicator for my news client, are my messages still not
ideally formatted for NGs? Wordwrap - 80 (I can't seem to turn it off)with
8-bit text only.
I want to display a list of files from a directory in a html list box using a
perl cgi. This must have been done a million times by now so has anyone got
anything handy they could e-mail me to save
me the time?
You might remember I had a problem with the Shell command causing a Segmentation
Fault. I never resolved this, but got a workaround with the system function.
I'm don't know how to use system or exec to pull data into an array, exec also
seemed to prevent any further output in my cgi.
I was advised about the my function but can't figure out the basics. ie what is
the correct version of the following.
my @list = "ls $pathname"; #pull in listin of selected dir
print @mylist; #complete ls
print $mylist[1..5]; #first five files
Cheers,
Mark Hamlin
--
___....-----'---'-----....___
=========================================
___'---..._______...---'___
(___) _|_|_|_ (___)
\\____.-'_.---._'-.____//
~~~~'.__'---'__.'~~~~
~~~~~~~
'More speed'
Sisco
Work: mailto:mark.c.hamlin@bt.com
Personal: mailto:mark@dimitrinet.demon.co.uk
Please use you auto reply where possible to distribute to both mailboxes.
------------------------------
Date: 20 Nov 1998 12:19:15 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Help:load unix ls>@array for use in cgi list box
Message-Id: <911564103.127823@thrush.omix.com>
[posted & mailed]
Mark Hamlin <mark.c.hamlin@bt.com> wrote:
: firstly - I use comminicator for my news client, are my messages still not
: ideally formatted for NGs? Wordwrap - 80 (I can't seem to turn it off)with
: 8-bit text only.
Wordwrap at 80 is what you want. 8-bit text isn't, it should be
7-bit but you haven't used any "hi ascii" in your message so it's
ok. Just don't use "vcard" or html and you'll be fine.
: I'm don't know how to use system or exec to pull data into an array, exec also
: seemed to prevent any further output in my cgi.
Exec() will never return. In layman terms, it morphs your program
into the one you call, the original no longer existing.
: I was advised about the my function but can't figure out the basics. ie what is
: the correct version of the following.
:
: my @list = "ls $pathname"; #pull in listin of selected dir
: print @mylist; #complete ls
: print $mylist[1..5]; #first five files
my @list = `ls $pathname`;
Those are "back ticks" (the "`" char), not single quotes ("'").
Also take a look at the opendir() and readdir() functions in the
perlfunc man page.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 20 Nov 1998 08:39:47 GMT
From: lvirden@cas.org
Subject: Re: Holy Abounding Books, Batman!
Message-Id: <7339sj$fhf$1@srv38s4u.cas.org>
According to David Bolton <dbolton@IdeaPlace.org>:
:I'd like to learn a little cgi/perl, but after reading Amazon.com book
:My tentative plan is:
I am not certain that the little bit of cgi that you will learn after
reading those three books will be sufficient.
I've heard good things about these two but don't have personal experience
with either.
CGI Developer's Resource: Web Programming in Tcl and Perl
Authors: J.M. Ivler <URL:mailto:ivler@i-xpress.com>
Kamran Husain
WWW book information: <URL:http://www.net-quest.com/%7Eivler/cgibook/>
Cross-Platform Perl
Author: Eric F. Johnson <URL:mailto:erc@pconline.com>
Publisher: M and T Books <URL:http://www.mispress.com/>
Publication date: September 1996
ISBN: 155851483X
Pages:
Price: 34.95 US
WWW book information: <URL:http://www.pconline.com/%7Eerc/perlbook.htm>
Errata: <URL:http://www.pconline.com/%7Eerc/perlbook.htm#Errata>
--
<URL:mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL:http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Fri, 20 Nov 1998 11:31:15 GMT
From: bhogsett@apk.net (Bill Hogsett)
Subject: Re: Is it possible to run a web server on Win95?
Message-Id: <Rrc52.3065$ZP5.7155606@nntp0.detroit.mi.ameritech.net>
I want to add my endorsement of TinyWeb. I just downloaded it and in minutes
I was up and running Perl scripts from the server!
Great!
In article <3655030d.0@news.oz.net>, dana@oz.net.DELETE.CAPS (Dana Booth)
wrote:
>In article <3654E41F.BA773505@fit2print.com>
>Kris <kris@fit2print.com> wrote:
>
>> I have Apache 1.3.3 and Perl 5.0, and I'm wondering if its worth my time
>> trying to figure out how to configure them to run on Win95 (4.00.950b,
>> 96 megs RAM, Pentium 166). Looking through the documentations it seems
>
>If you're interested in only running a small time web server, let me make a
> suggestion... Try
>TinyWeb from Ritlabs. It's a freebie, the friggin' whole archive is only a 56k
> zip file, it runs
>cgi scripts, and it works just fine. Probably not for big loads, and the
> configuration is limited,
>but if you want a small web server for Windows 95, you can have it up and
> running in about
>5 minutes. If you're interested in giving it a try, it's at www.ritlabs.com
>
>---------------------------
>Dana Booth <dana[at]oz.net>
>Tacoma, Wa., USA
>---------------------------
>
------------------------------
Date: Fri, 20 Nov 1998 11:44:23 GMT
From: dominikl@my-dejanews.com
Subject: Re: Is it possible to run a web server on Win95?
Message-Id: <733kmk$cmn$1@nnrp1.dejanews.com>
> I have Apache 1.3.3 and Perl 5.0, and I'm wondering if its worth my time
> trying to figure out how to configure them to run on Win95 (4.00.950b,
> 96 megs RAM, Pentium 166). Looking through the documentations it seems
> that you can, but I wanted to get some feedback before I spend too much
> time on it. From what I can tell I don't need C++ to run it, but I
> could be mistaken. I've gotten to where I can Apache from a command
> line, but that's about it. Any tips on what to do if I can? Thanks.
does it have to be apache? there are other Webservers like xitami or omniHTTPd
whitch allow cgi's. And they are realy easy to install.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 20 Nov 1998 12:22:23 -0000
From: nja@le.ac.uk (A.J. Norman)
Subject: Re: Is it possible to run a web server on Win95?
Message-Id: <733mtv$8hd@owl.le.ac.uk>
In article <733kmk$cmn$1@nnrp1.dejanews.com>,
<dominikl@my-dejanews.com> wrote:
>
> does it have to be apache? there are other Webservers like xitami
> or omniHTTPd whitch allow cgi's. And they are realy easy to
> install.
I can second the recommendation for xitami, it takes about five minutes
to install and is easy to configure. Works fine with Activestate Perl
on NT machines, so I'd guess W95 shouldn't be too much of a problem.
--
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/
------------------------------
Date: Fri, 20 Nov 1998 08:58:32 +0000
From: Matt Sergeant <matt@teamamiga.org_NOSPAM>
Subject: Re: Need HELP: PerlScript
Message-Id: <36552F38.83AE5FCE@teamamiga.org_NOSPAM>
Vitor Varalonga wrote:
>
> Hi!!
>
>
> I've been working with Active Server Pages and
> I've been programming them with VBScript.
> A friend of mine told me about PerlScript and
> its advantages over VBScript or JScript.
> Can anyone tell me where could I grab some
> information concerning PerlScript and concerning
> possible changes/upgrades to the Internet Information
> Server.
The only upgrade you need to make is to install ActivePerl from
www.activestate.com - make sure you get the latest build, which I think
is now 507 (roam their ftp site - their web site isn't always up to
date).
For complete ASP/PerlScript docs, use my web site - it contains the
complete reference guide.
--
<Matt email="matt@teamamiga.org" />
| Fastnet Software Ltd | Perl in Active Server Pages |
| Perl Consultancy, Web Development | Database Design | XML |
| http://come.to/fastnet | Information Consolidation |
------------------------------
Date: Fri, 20 Nov 1998 05:23:55 -0400
From: Ben Duncan <ben@smartservers.com>
Subject: Re: Net-Whois-0.22 broken?
Message-Id: <3655352B.885E1DD6@smartservers.com>
> I was just wondering if anyone has had any
> success in using the Perl Module Net-Whois-0.22.
Hmm. I guess not :)
------------------------------
Date: Fri, 20 Nov 1998 03:29:04 -0800
From: "Xah" <xah@best.com>
Subject: Re: perl documentation date
Message-Id: <36555286$0$12768@nntp1.ba.best.com>
In article <Zc352.90$RQ1.235@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>Hmm. On my system, perldoc also produces that line.
You are correct and I didn't realize that before.
Here's a more precise description of why I missed the date stamp:
I always used the command 'perldoc -t' to access on-line docs, often within
emacs (e.g. M-! perldoc -t perlre). When using the '-t' option, the date
stamp isn't displayed.
Apparently, the date stamp is added on the fly in the process a pod
file is converted to the man format. (I don't know the details) Perhaps
someone can explain how exactly the date and version/release info
got attached. (one can open the pod file and verify that the file content
contains no date info.)
In MacPerl, the standard way of reading pod files is through the Shuck
application, and it doesn't add date info on the fly.
Here's another question: does anyone know how to display pod files as
formatted text (with bold font) in emacs? For example,
if I do 'M-! perldoc perlre', I'll get garbage characters. This is why
I developed a habit of using the -t option as in 'M-! perldoc -t perlre'.
Xah, xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
perl5 -e'print "just another fantastically ^@%#&^}@&(!% obfuscated Perl hacker.\n"'
------------------------------
Date: Fri, 20 Nov 1998 09:55:36 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
To: Leon Brocard <l.brocard@elsevier.nl>
Subject: Re: Smarter Web Mailer
Message-Id: <F2pswp.2G6@csc.liv.ac.uk>
[Posted and mailed]
In article <3654168B.1C53AFEE@elsevier.nl>,
Leon Brocard <l.brocard@elsevier.nl> writes:
> "I.J. Garlick" wrote:
>
[snipped my inferior attempt :-)]
>
> Well, in *my* Web-based email client[1] I use
>
> $txt =~ s|(https?://[a-z\-0-9/~._,\#=;?&]+[a-z\-0-9/_])|<a href="$1"><tt>$1</tt></a>|igm;
> $txt =~ s|([^/>])(www\.[a-z\-0-9/~._,\#=;?&]+\.[a-z\-0-9/_]+)|$1<a href="http://$2"><tt>$2</tt></a>|igm;
> $txt =~ s|<a href="(.+?)>"><tt>(.+?)></tt></a>;|<a href="$1"><tt>$2</tt></a>>|igm;
> $txt =~ s|(ftp://[a-z\-0-9/~._,]+[a-z\-0-9/_])|<a href="$1"><tt>$1</tt></a>|igm;
> $txt =~ s|([a-z\-0-9._,]+\@[a-z.]+[a-z])|<a href="mailto:$1"><tt>$1</tt></a>|igm;
> $txt =~ s|([^\"])(mailto:[a-z\-0-9._,]+@[a-z\-0-9.]+[a-z\-0-9])|$1<a href="$2"><tt>$2</tt></a>|igm;
>
> Hmm. Betcha the above strings don't wrap around properly in the post.
No my news reader only wraps stuff cos that the size of the window. Dragged
it wider and cut and paste was easy.
Thanks very much Leon, this will make things a lot easier. It also finds
real A HREF links in html code and converts them though, but I think even I
can figure out how to stop that happening.
>
> Anyway, the above RE should catch most things, with the added
> side effect that they put the URL/MAILTO inside <TT></TT> tags.
> Note that the RE's count on this, so take them out *later* if you
> don't want them.
>
> Hope this helps, Leon
It does. Thanks again.
>
> [1] No plugs included. Well, okay, it's called 'acmemail' ;-)
> --
> $monger{Amsterdam.pm}[0] # $laptop--
--
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>
Indifference will be the downfall of mankind, but who cares?
------------------------------
Date: Thu, 19 Nov 1998 22:42:42 -0800
From: "Rusty Williamson" <rwilliamson@uno.gers.com>
Subject: Strange days have found me!
Message-Id: <e9852.349$ay.12880@news.connectnet.com>
Hi,
I'm having problems with the following code. When ypwhich works I get a
zero, if it fails I get 256. This is backwards! Does anyone see something
I don't see? The following code produces backward results!
if ( system("ypwhich 1>/dev/null 2>&1") )
{
print("ypwhich worked\n");
}
else
{
print("ypwhich did not work\n");
}
Rusty
------------------------------
Date: 20 Nov 1998 09:51:18 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Strange days have found me!
Message-Id: <83lnl6zr09.fsf@vcpc.univie.ac.at>
Re: Strange days have found me!, Rusty
<rwilliamson@uno.gers.com> said:
Rusty> Hi, I'm having problems with the following code.
Rusty> When ypwhich works I get a zero, if it fails I get
Rusty> 256. This is backwards!
You need to understand the return codes from system. It has
an elaborate example too in...
perldoc -f system
The return value is the exit status of the program as
returned by the wait() call. To get the actual exit
value divide by 256.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 20 Nov 1998 12:40:10 GMT
From: miles33@ix.netcom.com
Subject: Re: Strange days have found me!
Message-Id: <733nv8$f2u$1@nnrp1.dejanews.com>
In article <e9852.349$ay.12880@news.connectnet.com>,
"Rusty Williamson" <rwilliamson@uno.gers.com> wrote:
> Hi,
>
> I'm having problems with the following code. When ypwhich works I get a
> zero, if it fails I get 256. This is backwards! Does anyone see something
> I don't see? The following code produces backward results!
>
> if ( system("ypwhich 1>/dev/null 2>&1") )
> {
> print("ypwhich worked\n");
> }
> else
> {
> print("ypwhich did not work\n");
> }
>
> Rusty
>
>
According to thr Programming Perl book, the return value from system() is
the exit status of the program as returned by the wait() call. If you divide
by 256 you get the exit value, i.e. 1 in your case.
A 0 usually indicates success and non-zero indicates failure.
Your if statement is actually backwards.
Cheers
Chris H.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 20 Nov 1998 14:54:50 +0800
From: Rakesh Puthalath <rakesh_puthalath@hotmail.com>
Subject: Thank You
Message-Id: <36551239.9D360AE6@hotmail.com>
Thankyou for responding !.
I missed that ( list context and hence the array slice ) concept.
Rakesh
Rakesh Puthalath wrote:
> 1 @new = sort {
> 2 ($b =~ /=(\d+)/)[0] <=> ($a =~ /=(\d+)/)[0]
> 5 } @old;
>
> Can someone explain, line 2
>
> Thanks
> Rakesh
------------------------------
Date: Fri, 20 Nov 1998 13:12:04 +0100
From: "Tester" <tester@mp.pl>
Subject: Trouble with Perl-Postres
Message-Id: <733m3d$p5s$1@rekin.onet.pl>
When I'm trying to load my program which uses postgres I've got notice which
I attach below. Please help me. What should I do ? Please cc any answer to
me.
Can't load '/usr/lib/perl5/site_perl/i686-linux/auto/Postgres/Postgres.so'
for m
odule Postgres: File not found at
/usr/lib/perl5/i686-linux/5.00401/DynaLoader.p
m line 155.
at Base.pm line 8
BEGIN failed--compilation aborted at index.cgi line 8.
regards
Tester
------------------------------
Date: 20 Nov 1998 07:02:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Two-Part RE question
Message-Id: <73345q$ats$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ronald J Kimball
<rjk@coos.dartmouth.edu>],
who wrote in article <1dirpp4.ojqk5kz8e4dhN@bay2-205.quincy.ziplink.net>:
> > /\[(.+?)]/;
> > print "$&\n";
>
> Note that the latter regex can be written using greedy matching:
>
> /\[([^]]+)\]/
>
> Most of the uses of non-greedy matching posted to clpm can be rewritten
> with greedy matching, making the regex more efficient. Too many Perl
> programmers use non-greedy matching without understanding it.
Sometimes it is wise to screw efficiency for the sake of clarity.
Whether it is applicable to the case in question is debatable, though ;-).
Hope this helps,
Ilya
------------------------------
Date: Wed, 18 Nov 1998 13:34:07 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: using "format" instruction.
Message-Id: <3652CE7C.502E392E@shaw.wave.ca>
Greg Ward wrote:
>
>
> You *can* do it with Perl's formatting stuff, but it's pretty ugly.
> I'd look into the Text::Wrap module -- it's included with Perl, and
> does exactly what you want.
>
Can you please provide an example of how using Text::Wrap is less ugly
than the following? I seriously doubt that it is what the original
poster wants.
#!/usr/bin/perl -w
format STDOUT =
@<<<<<<<<: @<<<<<<<<<<<<<<<<<<
$key, $value
.
%FORM = (
Name => 'Value',
Naaaaame => 'Val',
nam => 'Vaaaaaallllluuueee',
);
while ( ($key, $value) = each %FORM ) {
write;
}
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Wed, 18 Nov 1998 04:38:54 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Using PERL to FTP a file to another server
Message-Id: <36525109.A3413624@shaw.wave.ca>
[posted & mailed]
Timothy R Lux wrote:
>
> Hi:
>
> I saw some code a while ago that I thought I would never need, but
> alas, I need it now and can't find it again.
A good place to start is always the FAQ. See perlfaq9, "How do I
fetch/put an FTP file?"
This will direct you to use Net::FTP, which I tried for the first time
just yesterday. It works like a charm.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Wed, 18 Nov 1998 04:42:11 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Using PERL to FTP a file to another server
Message-Id: <365251D0.63CF0152@shaw.wave.ca>
[posted & mailed]
Timothy R Lux wrote:
>
> Hi:
>
> I saw some code a while ago that I thought I would never need, but
> alas, I need it now and can't find it again.
A good place to start is always the FAQ. See perlfaq9, "How do I
fetch/put an FTP file?"
This will direct you to use Net::FTP, which I tried for the first time
just yesterday. It works like a charm.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Wed, 18 Nov 1998 04:40:43 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Using PERL to FTP a file to another server
Message-Id: <36525179.94352D2C@shaw.wave.ca>
[posted & mailed]
Timothy R Lux wrote:
>
> Hi:
>
> I saw some code a while ago that I thought I would never need, but
> alas, I need it now and can't find it again.
A good place to start is always the FAQ. See perlfaq9, "How do I
fetch/put an FTP file?"
This will direct you to use Net::FTP, which I tried for the first time
just yesterday. It works like a charm.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Thu, 19 Nov 1998 23:12:13 -0800
From: "Andrey L. Abramov" <abramoa@leland.stanford.edu>
Subject: Re: Win16 DLL access (on NT) Help!!!
Message-Id: <3655164D.FB677E1C@leland.stanford.edu>
Nope. I tried. Very hard. It does not load 16bit libraries.
Or do I miss something?
A.A>
Bbirthisel wrote:
> Hi Andrey:
>
> >How do I access Win16 DLLs from Perl (on Win'95 or WinNT platform) ?
> >Will Win32API do it?
>
> Yes. Make sure you get the binary which matches your perl version.
> For 5.005, the Activestate site. For 5.003/5.004, Aldo Calpini's site. Works
> on Win95, Win98 and NT.
>
> Module is "Win32::API". "Win32API" is a CPAN Namespace.
>
> -bill
>
> Making computers work in Manufacturing for over 25 years (inquiries welcome)
--
===================================================================
Andrey L. Abramov | "Try not. Do.
MBA'97, Stanford Graduate School Of Business | Or do not.
mailto:abramoa@leland.stanford.edu | There is no 'try'".
Phone: (650)947-8827 | - Yoda
=====================================================================
------------------------------
Date: Fri, 20 Nov 1998 06:10:32 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Win32::AdminMisc documentation
Message-Id: <365507D8.1FD301A0@patriot.net>
> How do I find documentation for the Win32::AdminMisc module? Doing a
> recursive search for AdminMisc using perldoc comes up empty.
>
I have seen some documentation at Dave Roth's site..
http://www.roth.net
http://www.inforoute.capway.com/leberre1/
or
http://www.netaxs.com/~joc/perlwin32.html
...will have some more info.
I, too, am looking for more explicit detail in some of the documentation.
Carv
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4263
**************************************