[19006] in Perl-Users-Digest
Perl-Users Digest, Issue: 1201 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 27 00:05:38 2001
Date: Tue, 26 Jun 2001 21:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <993614709-v10-i1201@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 26 Jun 2001 Volume: 10 Number: 1201
Today's topics:
Can't spawn-NOWAIT: (Darin Drewrey)
cgi posting to another cgi (rmhta)
Re: cgi posting to another cgi <godzilla@stomp.stomp.tokyo>
Re: Checking for duplicates before appending to file <troyr@vicnet.net.au>
Re: command line news posting tools <sun_tong@users.sourceforge.net>
DBI:Mysql exporting <nospam@newsranger.com>
Re: DBI:Mysql exporting (isterin)
from linux to WinNT4 Ms Sql <subscriber@novastar.dtdns.net>
Re: Grabbing a web page? <derail.REMOVE@this.routergod.com>
Re: How do I cope with pound (currency) sign? <SEE_MY_SIG@nospam.demon.co.uk>
How to call rsh to remotely run a program <dontuspamme@nospammers.com>
Re: How to call rsh to remotely run a program <stevea@wrq.com>
Re: How to determine stack depth? (Clinton A. Pierce)
How to manually set crontabs? (blue)
Re: How to manually set crontabs? (blue)
Re: How to manually set crontabs? <boa@aaanet.ru>
image resampling <sfm15@columbia.edu>
image resampling <sfm15@columbia.edu>
Interacting prompts with perl <nospam@newsranger.com>
Re: Interacting prompts with perl (isterin)
ISA versioning <mcarthur@dstc.edu.au>
Re: Merging two scripts (cd)
Re: NT Cookie problem, PLEASE HELP, this could be one f (Clinton A. Pierce)
Re: Perl *is* strongly typed (was Re: Perl description) <skilchen@swissonline.ch>
Re: Perl *is* strongly typed (was Re: Perl description) <joe+usenet@sunstarsys.com>
Re: Perl on Win32. <adsouza@globix.net>
Re: Perl on Win32. (isterin)
Re: Perl variable <troyr@vicnet.net.au>
Re: Perl variable <troyr@vicnet.net.au>
sorting a hash <troyr@vicnet.net.au>
Three-argument form of open() and I/O disciplines <monty@primenet.com>
Re: Upgrading a File Lock (What do you think this is, a ctcgag@hotmail.com
Re: using strict (Eric Bohlman)
Where I can find BINMODE, any examples ??? <rig01@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jun 2001 17:01:36 -0700
From: ddrewrey@extensis.com (Darin Drewrey)
Subject: Can't spawn-NOWAIT:
Message-Id: <76ce08a4.0106261601.43cad21d@posting.google.com>
I'm receiving an error every so often while accessing a Cybercash
library (CCMckDirectLib3_2.pm) with ActivePerl 5.6.1.626 for Windows
2000 Server.
open2: IO::Pipe: Can't spawn-NOWAIT: Resource temporarily unavailable
at CCMckDirectLib3_2.pl line 432.
I saw that another use had this problem with Win98 but didn't see a
fix. Any ideas?
Thanks in advance.
------------------------------
Date: 26 Jun 2001 20:21:58 -0700
From: rmhta@hotmail.com (rmhta)
Subject: cgi posting to another cgi
Message-Id: <b3865d91.0106261921.4cc822ff@posting.google.com>
Howdy.
I need a cgi to post to another cgi on a different server. What I'm
trying to accomplish is this:
A cgi is posted to from a html form;
This cgi sends an email;
This cgi "passes" whatever data was posted to it, to another cgi on a
different server.
Is there a straight-forward way of accomplishing this?
Thanks.
rmhta
------------------------------
Date: Tue, 26 Jun 2001 20:34:44 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: cgi posting to another cgi
Message-Id: <3B395454.FB291B03@stomp.stomp.tokyo>
rmhta wrote:
> I need a cgi to post to another cgi on a different server. What I'm
> trying to accomplish is this:
> A cgi is posted to from a html form;
> This cgi sends an email;
> This cgi "passes" whatever data was posted to it, to another cgi on a
> different server.
> Is there a straight-forward way of accomplishing this?
Yes. Write a cgi script which will attain your stated goals.
Godzilla!
--
@ø=(a .. z);@Ø=qw(6 14 3 25 8 11 11 0 17 14 2 10 18);
$§="\n";$ß="\b";undef$©;print$§x($Ø[4]/2);
for($¡=0;$¡<=$Ø[2];$¡++){foreach$¶(@Ø){
$ø[$¶]=~tr/A-Z/a-z/;if(($¡==1)||($¡==$Ø[2]))
{$ø[$¶]=~tr/a-z/A-Z/;}print$ø[$¶];if($¶==0)
{print" ";}if($¶==$Ø[12]){print" !";}&D;}
print$ßx($Ø[4]*2);}print$§x($Ø[10]*2);
sub D{select$©,$©,$©,.25;}exit;
------------------------------
Date: Wed, 27 Jun 2001 09:46:13 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: Checking for duplicates before appending to file
Message-Id: <%a9_6.12272$qJ4.500559@ozemail.com.au>
"Sweth Chandramouli" <sweth+perl@gwu.edu> wrote in message
news:iYKZ6.11296$Ga.1848364@news1.rdc1.md.home.com...
> In article <tjdlpk38ueon8d@corp.supernews.co.uk>,
> David Soming <davsoming@lineone.net> wrote:
> >Hi,
> >I would like to check for duplicates in my database before appending:
> What is making use of the database? If it's another Perl
> app, or if your app persists (I suspect the latter isn't true, though,
> given the HTML in your example--I presume that this is for some CGI
> app), it would probably be a lot easier and more efficient to use a tied
> hash of some sort. If you need to store the info in flat files, then
> (depending on the number of records you anticipate having), you might
> want to consider hashing your addresses into separate files by the first
> character or two, so that you don't have to grep through the entire list
> every time.
>
Or you can use the DBD::CSV module to create your dbase and just use SQL
commands to find out if the address is already in your database
------------------------------
Date: 27 Jun 2001 00:55:14 -0300
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Re: command line news posting tools
Message-Id: <sa8ofrak259.fsf@suntong.personal.users.sourceforge.net>
Hi,
bear with me to cross posting again, 'cause the code is not working.
Benjamin Goldberg <goldbb2@earthlink.net> writes:
> > Thanks Philip Newton for sharing his code with me. Here is my
> > shell-script solution: (Oh, programming in Perl is just fun)
> >
> > perl -e '
> > use strict;
> > use Net::NNTP;
> >
> > my $n = Net::NNTP->new("news");
> > my @article = <>;
> > $n->post(\@article) or die "Post error: $!";
> > $n->quit;' ${1+"$@"}
> >
> > Tested and worked perfectly.
> >
> > Note from Phil, This just blasts the pipe content (which must be a
> > complete news article, with Newsgroups:, From:, Subject:,
> > etc. headers) to the news server mentioned.
>
> First off, -Mmodule might be prefered to "use" if your doing shell stuff
> like this, second, most shells support a here-document syntax...
> perl -Mstrict -MNet::NNTP <<__END__ ${1+"$@"}
> my $n = Net::NNTP->new("news");
> my @article = <>;
> $n->post(\@article) or die "Post error: $!";
> $n->quit;
> __END__
>
> Note, this is untested.
Good points! I tested it right away and found some problem:
- It will cause Perl compile error unless the __END__ is quoted like
this: '__END__'
- I test with a pipe command but it didn't work
cat file | nntppost
and neither is:
cat file | nntppost -
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
- All free contribution & collection
------------------------------
Date: Tue, 26 Jun 2001 10:34:26 GMT
From: rich <nospam@newsranger.com>
Subject: DBI:Mysql exporting
Message-Id: <SyZZ6.1997$eu4.10452@www.newsranger.com>
Hi, i'm trying to export some rows from a MySQL db where the user chooses which
rows to export. Please could someone tell me why the following is not working?
$SQLstr="FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\' LINES
TERMINATED BY \"\\n\"";
$success = $dbh->do("SELECT * INTO OUTFILE $export $SQLstr from table01 where
po_num=$export");
Thanks in advance,
Rich
------------------------------
Date: 26 Jun 2001 21:01:57 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: DBI:Mysql exporting
Message-Id: <db67a7f3.0106262001.5ad1f767@posting.google.com>
rich <nospam@newsranger.com> wrote in message news:<SyZZ6.1997$eu4.10452@www.newsranger.com>...
> Hi, i'm trying to export some rows from a MySQL db where the user chooses which
Export to where???
> rows to export. Please could someone tell me why the following is not working?
>
>
> $SQLstr="FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\' LINES
> TERMINATED BY \"\\n\"";
>
> $success = $dbh->do("SELECT * INTO OUTFILE $export $SQLstr from table01 where
> po_num=$export");
Ohhh. I know. It's because it doesn't like you:-) Just a guess.
You need to be more clear on what the problem is. What error message
are you getting? Have you tried running through mysql command prompt
first to see if your query is supported?
Ilya
>
> Thanks in advance,
> Rich
------------------------------
Date: Wed, 27 Jun 2001 01:25:45 +0300
From: "novastar" <subscriber@novastar.dtdns.net>
Subject: from linux to WinNT4 Ms Sql
Message-Id: <9hb24d$ltm$1@usenet.otenet.gr>
Can you tell me please what module do I have to use to connect and query a
Microsoft SQL installed on a Windows NT4 box from a linux one ? I have found
several modules for mysql but I do not think they are going to do the job.
Tia
------------------------------
Date: Tue, 26 Jun 2001 17:13:24 -0700
From: "Darryl H. Thomas" <derail.REMOVE@this.routergod.com>
Subject: Re: Grabbing a web page?
Message-Id: <20010626.171317.760737236.5749@dhthomaslnx.mcafee.com>
In article <48dc5908.0106220104.656193f7@posting.google.com>, "cmavroudis"
<costas@othermedia.com> wrote:
> What is the best way for me to grab the source of a web page and put it
> into a single variable?
There's a number of ways to do this, but perhaps one of the cleanest goes
something like this....
----CODE----
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request('GET', $url);
my $res = $ua->request($req);
if ($res->is_success) {
$single_scalar = $res->content; ## Here's where you get the goods.
}
----END CODE----
perldoc LWP
perldoc Request
perldoc Response
Darryl H. Thomas
------------------------------
Date: Tue, 26 Jun 2001 22:11:29 +0100
From: James Taylor <SEE_MY_SIG@nospam.demon.co.uk>
Subject: Re: How do I cope with pound (currency) sign?
Message-Id: <ant262129ab5fNdQ@oakseed.demon.co.uk>
In article <Pine.LNX.4.30.0106261332420.6364-100000@lxplus013.cern.ch>,
Alan J. Flavell <URL:mailto:flavell@mail.cern.ch> wrote:
>
> On Tue, 26 Jun 2001, James Taylor wrote:
> >
> > If you just put it in a regex directly in the
> > program source (like this /£/) it is still
> > non-portable between different coding systems.
>
> I can't agree. Perl source code is text, and as such deserves to be
> transcoded at the character stream level when transferred between
> systems which use different character storage codings.
Ah, that's what I hadn't appreciated. Thanks.
--
James Taylor <james (at) oakseed demon co uk>
Based in Southam, Cheltenham, UK.
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: Tue, 26 Jun 2001 16:11:13 -0700
From: "kalasend at YAHOO dot COM" <dontuspamme@nospammers.com>
Subject: How to call rsh to remotely run a program
Message-Id: <YA8_6.1$m93.203@chrome-fe.eng.netapp.com>
This may not be the best place to ask, but since I didn't get an answer from
the Unix newsgroups, I think I should ask here.
I am writing a script that needs to run some programs on a remote host. I
found out that there are some machines that I can do:
rsh -l root run this program
WITHOUT typing passwords. And then there are some machines that ask for
password for exactly the same command.
I have looked through /etc/inetd.conf, /etc/hosts, /etc/hosts.allow,
/etc/hosts.deny, and have no clue what the differences are....Is there any
other thing that I missed?
thanks,
- ben
------------------------------
Date: Tue, 26 Jun 2001 23:52:21 GMT
From: Steve Allan <stevea@wrq.com>
Subject: Re: How to call rsh to remotely run a program
Message-Id: <uu212ztn5.fsf@wrq.com>
"kalasend at YAHOO dot COM" <dontuspamme@nospammers.com> writes:
>This may not be the best place to ask, but since I didn't get an answer from
>the Unix newsgroups, I think I should ask here.
>
>I am writing a script that needs to run some programs on a remote host. I
>found out that there are some machines that I can do:
> rsh -l root run this program
>WITHOUT typing passwords. And then there are some machines that ask for
>password for exactly the same command.
>
>I have looked through /etc/inetd.conf, /etc/hosts, /etc/hosts.allow,
>/etc/hosts.deny, and have no clue what the differences are....Is there any
>other thing that I missed?
Look for the file ~/.rhosts on those machines that run rsh without a
password prompt and create a similar file on those hosts that prompt
for a password.
I'm not a security expert, but something about allowing a user to rsh
a command as root just doesn't seem right to me, but this is the wrong
newsgroup for that discussion...actually it's the wrong ng for all of
this discussion :)
HTH
--
-- Steve __
------------------------------
Date: Wed, 27 Jun 2001 03:08:09 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: How to determine stack depth?
Message-Id: <t6c_6.131356$DG1.21774480@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <Nh7_6.17393$Ga.2427112@news1.rdc1.md.home.com>,
sweth+perl@gwu.edu (Sweth Chandramouli) writes:
> Is there an easy way to determine how deep in the
> stack a particular call is? The only way I can see to do it is to
> keep calling caller with increasing arguments until it fails to
> return true, which doesn't seem very efficient.
Just how deep can this stack get? :)
If this is something that's recursing, you might just want to keep a
variable around to keep track of your depth. If you honestly and
truly don't know how deep you're in things, try searching back through
the stack using sort of an incremental search. Go back 1 frame, then 2,
then 4, 8, 16 etc...until you get to the end and search between the last
two points.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Tue, 26 Jun 2001 23:51:43 GMT
From: lynton@iname.com (blue)
Subject: How to manually set crontabs?
Message-Id: <3b391f1c.37048937@news1.on.sympatico.ca>
I am making a script to enable users to set their crontabs thru the
web browser.
Should /var/cron/tabs/$username be modified or is there a safer way?
If /var/cron/tabs/$username is to be modified directly is anything
else need done to activate the new settings?
------------------------------
Date: Wed, 27 Jun 2001 00:07:29 GMT
From: lynton@iname.com (blue)
Subject: Re: How to manually set crontabs?
Message-Id: <3b3923aa.38214517@news1.on.sympatico.ca>
PLEASE IGNORE THIS MESSAGE, I POSTED TO WRONG NG
On Tue, 26 Jun 2001 23:51:43 GMT, lynton@iname.com (blue) wrote:
>I am making a script to enable users to set their crontabs thru the
>web browser.
>Should /var/cron/tabs/$username be modified or is there a safer way?
>If /var/cron/tabs/$username is to be modified directly is anything
>else need done to activate the new settings?
------------------------------
Date: Wed, 27 Jun 2001 04:15:40 +0400
From: "Oleg Bakiev" <boa@aaanet.ru>
Subject: Re: How to manually set crontabs?
Message-Id: <9hb8s4$13r3$1@pa.aaanet.ru>
"blue" <lynton@iname.com> news:3b391f1c.37048937@news1.on.sympatico.ca...
> I am making a script to enable users to set their crontabs thru the
> web browser.
> Should /var/cron/tabs/$username be modified or is there a safer way?
The most safe way is to run 'crontab' command.
> If /var/cron/tabs/$username is to be modified directly is anything
> else need done to activate the new settings?
------------------------------
Date: Tue, 26 Jun 2001 22:06:20 -0400
From: "S. Frank Miller" <sfm15@columbia.edu>
Subject: image resampling
Message-Id: <Pine.GSO.4.10.10106262202480.2994-100000@aloha.cc.columbia.edu>
Hi,
I'm trying to make a cgi thumbnail script and I'm having problems getting
my thumbnails to look good. My problem is that my site is remotely hosted
and the host doesn't have a module like PerlMagick installed on the
server and GD only has has image resizing without resampling. Does anyone
out there know of a way (preferrably an easy way) to resize and resample
an image into a thumbnail without it looking like crap?
Thanks for any help,
Steve
------------------------------
Date: Tue, 26 Jun 2001 22:06:20 -0400
From: "S. Frank Miller" <sfm15@columbia.edu>
Subject: image resampling
Message-Id: <Pine.GSO.4.10.1010626I202480.2994-100000@aloha.cc.columbia.edu>
Hi,
I'm trying to make a cgi thumbnail script and I'm having problems getting
my thumbnails to look good. My problem is that my site is remotely hosted
and the host doesn't have a module like PerlMagick installed on the
server and GD only has has image resizing without resampling. Does anyone
out there know of a way (preferrably an easy way) to resize and resample
an image into a thumbnail without it looking like crap?
Thanks for any help,
Steve
------------------------------
Date: Tue, 26 Jun 2001 14:37:32 GMT
From: Drew Myers <nospam@newsranger.com>
Subject: Interacting prompts with perl
Message-Id: <M61_6.2097$eu4.10554@www.newsranger.com>
Hi.
I'm working on a perl program, that will automate ejecting tapes via the
Omniback backup utility by HP.
The Omniback program uses a CLI (well, that's what I want to use) to eject the
tapes via an interactive prompt, similar to FTP. The shell equivalent of what I
want to do is:
/opt/omni/lbin/uma -ioctl /dev/scsi/robot -barcode <<EOF >$CAP_SILO_SCAN
stat x
stat s
exit
EOF
This is the working perl code I have so far:
#!/opt/perl5/bin/perl -w
use strict;
# Determine day of week (Monday has several tape batches, Tues-Fri have 1 batch)
my $dayofweek = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat") [(localtime)[6]];
# Get list of tapes to be ejected
open (TAPES,"/opt/omni/bin/omnirpt -report used_media -timeframe 24 24 |") ||
die "Can't open omnireport: $!\n";
my %tapecap;
while (<TAPES>) {
if (/(R\D\d+).*:\s+(\d+)/gm) {
$tapecap{$2}=$1;
}
}
open(SILO,"/opt/omni/lbin/uma -ioctl /dev/scsi/robot -barcode |") ||
die "Can't open SILO: $!\n";
chomp(my @silo = <SILO>);
close(SILO) || die "Can't close SILO: $!\n";
The /opt/omni/lbin/uma line opens a prompt, where I can interact with the Tape
Library, but I don't know how to do that via Perl.
Any ideas?
Thanks in advance.
------------------------------
Date: 26 Jun 2001 21:04:59 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Interacting prompts with perl
Message-Id: <db67a7f3.0106262004.3b8398c@posting.google.com>
Drew Myers <nospam@newsranger.com> wrote in message news:<M61_6.2097$eu4.10554@www.newsranger.com>...
> Hi.
>
> I'm working on a perl program, that will automate ejecting tapes via the
> Omniback backup utility by HP.
>
> The Omniback program uses a CLI (well, that's what I want to use) to eject the
> tapes via an interactive prompt, similar to FTP. The shell equivalent of what I
> want to do is:
>
> /opt/omni/lbin/uma -ioctl /dev/scsi/robot -barcode <<EOF >$CAP_SILO_SCAN
> stat x
> stat s
> exit
> EOF
>
> This is the working perl code I have so far:
> #!/opt/perl5/bin/perl -w
> use strict;
>
> # Determine day of week (Monday has several tape batches, Tues-Fri have 1 batch)
> my $dayofweek = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat") [(localtime)[6]];
>
> # Get list of tapes to be ejected
> open (TAPES,"/opt/omni/bin/omnirpt -report used_media -timeframe 24 24 |") ||
open (TAPES,"|/opt/omni/bin/omnirpt -report used_media -timeframe 24 24")
open pipe to the program.
Then
print TAPES ".....";
feeds commands to it.
Ilya
> die "Can't open omnireport: $!\n";
> my %tapecap;
> while (<TAPES>) {
> if (/(R\D\d+).*:\s+(\d+)/gm) {
> $tapecap{$2}=$1;
> }
> }
> open(SILO,"/opt/omni/lbin/uma -ioctl /dev/scsi/robot -barcode |") ||
> die "Can't open SILO: $!\n";
> chomp(my @silo = <SILO>);
> close(SILO) || die "Can't close SILO: $!\n";
>
>
>
> The /opt/omni/lbin/uma line opens a prompt, where I can interact with the Tape
> Library, but I don't know how to do that via Perl.
>
> Any ideas?
>
> Thanks in advance.
------------------------------
Date: Wed, 27 Jun 2001 13:04:23 +1000
From: Robert McArthur <mcarthur@dstc.edu.au>
Subject: ISA versioning
Message-Id: <3B394D37.554160BF@dstc.edu.au>
When use'ing a package you can tell the system what version you'd like
as a minimum. What about when inheriting via ISA? It'd like to tell
it to inherit from version 2 rather than version 1 (both are in the
path).
Any ideas?
Thanks
Robert
------------------------------
Date: Wed, 27 Jun 2001 02:09:39 GMT
From: cd001@telus.net (cd)
Subject: Re: Merging two scripts
Message-Id: <3b39e877.11447049@news.telus.net>
On Mon, 25 Jun 2001 14:52:20 GMT, Gary <gamtci@mpinet.net> wrote:
>One silly but perhaps effective way would be to have the first
>script call the other using the command line (or a temp file)
>to pass the database info to the second script. Then using
>system(perl.exe -w secondscript.pl) call the second script.
>When it returns, check its return value (for errors or other
>info you might return as an integer) and continue.
I thought about something like that... now I'm trying a bit different
tack. The main script is set up to email one person. I can get that to
work, but I want it to read the email address of the second person
from the information on the form... I'm having some trouble with that
one....
Any idea what I should be looking for? It doesn' seem to be passing
the info to the right place in the right format...
I'm such a rookie.....
Thanks.........
------------------------------
Date: Wed, 27 Jun 2001 03:12:31 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: NT Cookie problem, PLEASE HELP, this could be one for the pro's.
Message-Id: <zac_6.131376$DG1.21779031@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <20010626165631.14365.00000975@ng-ck1.aol.com>,
cperl520335@aol.com (CPERL520335) writes:
> This works and sets the cookie. But the problem appears to be with setting a
> cookie then a location header. It all works fine in Unix but no matter what I
> try the cookie just wont set with a location header.
That's because you're looking in the wrong place and confusing all kinds of
terminology. This is not an NT/Unix problem. It is an IIS issue.
Specifically, you can't set a cookie and redirect in a normal CGI script
under IIS.
What you need to do is use an nph- (nonparsed header) script on the IIS
machine. This will let both the cookie and the redirect work.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 27 Jun 2001 01:04:10 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Perl *is* strongly typed (was Re: Perl description)
Message-Id: <9hb4q5$cvhl0$1@ID-13368.news.dfncis.de>
"Joe Schaefer" <joe+usenet@sunstarsys.com> schrieb im Newsbeitrag
news:m33d8nrxj5.fsf@mumonkan.sunstarsys.com...
> David Coppit <newspost@coppit.org> writes:
>
> > How many decimal places before a difference becomes "meaningful"?
> > Perl thinks my original example is "meaningful", and that's good
> > enough for me:
>
> No. Perl "stringifies" doubles according to your platform's precision,
> which is usually around 15 decimal places on a 32 bit OS.
This is probably unrelated to the 32-bitness of the OS. The meaning of
the 64 bits of doubles is usually defined according to the IEEE-754
standard. There you have 53 bits of precision. The usual
"#define DBL_DIG 15" in float.h is a reasonnable approximation
for the number of decimal places but it is not enough to make the
stringification reversible.
In Perl it is not guaranteed that
$a == eval "$a"
On IEEE-754 machines
$a == eval sprintf("%.17g", $a)
is true for all floating-point numbers.
------------------------------
Date: 26 Jun 2001 21:54:13 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Perl *is* strongly typed (was Re: Perl description)
Message-Id: <m3k81yr8l6.fsf@mumonkan.sunstarsys.com>
"Samuel Kilchenmann" <skilchen@swissonline.ch> writes:
> "Joe Schaefer" <joe+usenet@sunstarsys.com> schrieb im Newsbeitrag
> news:m33d8nrxj5.fsf@mumonkan.sunstarsys.com...
> > No. Perl "stringifies" doubles according to your platform's precision,
> > which is usually around 15 decimal places on a 32 bit OS.
>
> This is probably unrelated to the 32-bitness of the OS. The meaning of
> the 64 bits of doubles is usually defined according to the IEEE-754
> standard. There you have 53 bits of precision. The usual
> "#define DBL_DIG 15" in float.h is a reasonnable approximation
> for the number of decimal places but it is not enough to make the
> stringification reversible.
You're right- thanks for the correction.
--
Joe Schaefer "The difference between the right word and the almost right word
is the difference between lightning and the lightning bug."
--Mark Twain
------------------------------
Date: Tue, 26 Jun 2001 18:48:21 -0400
From: "Anthony" <adsouza@globix.net>
Subject: Re: Perl on Win32.
Message-Id: <fg8_6.1$112.778@news.nyc.globix.net>
Actually yes they do. I have a copy if you wish me to email/ftp it to
you.... It works great! Maybe search www.google.com for a programs called:
for "ActivePerl-5.6.0.623-MSWin32-x86-multi-thread". I have it installed
and run scripts on my Win2k server with it. Sorry, but i can not remember
where I got it from.
-A
"Philip Newton" <pne-news-20010618@newton.digitalspace.net> wrote in message
news:5jrritg3rninu0p5790or7sea9ir96oovo@4ax.com...
> On Mon, 18 Jun 2001 11:54:40 GMT, "Fred dubru" <f_dubru@yahoo.com>
> wrote:
>
> > I am new on MS Win32 and I am looking for tools and scripting tools to
work
> > with it. Does Perl privide built in functions to mimic Unix commands
(such
> > as grep, wc, ls etc...)
>
> Not directly, though you can write scripts in Perl that do similar
> things. The Perl Power Tools project ( http://language.perl.com/ppt/ )
> aims to produce pure-Perl replacements of such Unix tools; sadly, I
> believe it is very slow to be updated.
>
> According to http://language.perl.com/ppt/what.html , there are already
> implementations for grep, wc, and ls.
>
> Another option might be to download Cygwin, which provides ports of Unix
> utilities to the Win32 environment, so you'd have a grep.exe, wc.exe,
> and so on.
>
> Cheers,
> Philip
> --
> Philip Newton <nospam.newton@gmx.li>
> Yes, that really is my address; no need to remove anything to reply.
> If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 26 Jun 2001 20:57:54 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Perl on Win32.
Message-Id: <db67a7f3.0106261957.3306e15a@posting.google.com>
"Anthony" <adsouza@globix.net> wrote in message news:<fg8_6.1$112.778@news.nyc.globix.net>...
> Actually yes they do. I have a copy if you wish me to email/ftp it to
> you.... It works great! Maybe search www.google.com for a programs called:
> for "ActivePerl-5.6.0.623-MSWin32-x86-multi-thread". I have it installed
> and run scripts on my Win2k server with it. Sorry, but i can not remember
> where I got it from.
You gotta be kidding:-) www.activestate.com
Also grep() is a perl function, I hope everyone new that, since about
every third thread here involved this function for the past couple of
days.
Ilya
>
> -A
>
> "Philip Newton" <pne-news-20010618@newton.digitalspace.net> wrote in message
> news:5jrritg3rninu0p5790or7sea9ir96oovo@4ax.com...
> > On Mon, 18 Jun 2001 11:54:40 GMT, "Fred dubru" <f_dubru@yahoo.com>
> > wrote:
> >
> > > I am new on MS Win32 and I am looking for tools and scripting tools to
> work
> > > with it. Does Perl privide built in functions to mimic Unix commands
> (such
> > > as grep, wc, ls etc...)
> >
> > Not directly, though you can write scripts in Perl that do similar
> > things. The Perl Power Tools project ( http://language.perl.com/ppt/ )
> > aims to produce pure-Perl replacements of such Unix tools; sadly, I
> > believe it is very slow to be updated.
> >
> > According to http://language.perl.com/ppt/what.html , there are already
> > implementations for grep, wc, and ls.
> >
> > Another option might be to download Cygwin, which provides ports of Unix
> > utilities to the Win32 environment, so you'd have a grep.exe, wc.exe,
> > and so on.
> >
> > Cheers,
> > Philip
> > --
> > Philip Newton <nospam.newton@gmx.li>
> > Yes, that really is my address; no need to remove anything to reply.
> > If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 27 Jun 2001 09:55:14 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: Perl variable
Message-Id: <tj9_6.12275$qJ4.500962@ozemail.com.au>
> As fas as I'm aware, system() only returns the ex it status of the call
> to system(). You probably want to use backticks.
Speakin of the differences between system() & backticks is there a perldoc
that i can look at to outline the advantages & disadvantges of using one
over the other?
------------------------------
Date: Wed, 27 Jun 2001 09:57:19 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: Perl variable
Message-Id: <ql9_6.12277$qJ4.500919@ozemail.com.au>
"Troy Boy" <troyr@vicnet.net.au> wrote in message
news:tj9_6.12275$qJ4.500962@ozemail.com.au...
> > As fas as I'm aware, system() only returns the ex it status of the call
> > to system(). You probably want to use backticks.
>
> Speakin of the differences between system() & backticks is there a perldoc
> that i can look at to outline the advantages & disadvantges of using one
> over the other?
oh cool i read the following post & got the answer
Cheers
------------------------------
Date: Wed, 27 Jun 2001 13:11:30 +1000
From: "tez" <troyr@vicnet.net.au>
Subject: sorting a hash
Message-Id: <sbc_6.12345$qJ4.503668@ozemail.com.au>
Hi there,
I'm sure ppl have discussed this one here but i can't remember
the result of the discussion...
I'm trying to sort by either 'name' or 'hits'
my %test;
$test{1}{name}="a group";
$test{2}{name}="b group";
$test{3}{name}="c group";
$test{1}{hits}=20;
$test{2}{hits}=4;
$test{3}{hits}=14;
is this possible to achieve via the sort command? ....checked perldoc -f
sort but didn't get far
ie...so would the index #'s 1,2,3 be rearranged or the values within those
indexes be rearranged
Thanks in advance
------------------------------
Date: 27 Jun 2001 00:15:59 GMT
From: Jim Monty <monty@primenet.com>
Subject: Three-argument form of open() and I/O disciplines
Message-Id: <9hb8jv$6tv$1@nnrp1.phx.gblx.net>
Perl v5.6.1 is telling me it doesn't know the open modes '<:raw',
':raw', ':crlf', etc.:
C:/>touch foo.bar
C:/>perl -we 'use strict; open FH, "<:raw", "foo.bar" or die; <FH>;'
Unknown open() mode '<:raw' at -e line 1.
C:/>perl -we 'use strict; open FH, ":raw", "foo.bar" or die; <FH>;'
Unknown open() mode ':raw' at -e line 1.
C:/>perl -we 'use strict; open FH, ":crlf", "foo.bar" or die; <FH>;'
Unknown open() mode ':crlf' at -e line 1.
C:/>perl -v | head -8
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 626 provided by ActiveState Tool Corp.
Built 01:31:15 May 2 2001
C:/>
What am I missing? Or doing wrong?
(I've reduced the problem to a simple command-line example, but
it's not working in my real script either.)
--
Jim Monty
monty@primenet.com
Tempe, Arizona USA
------------------------------
Date: 26 Jun 2001 23:11:50 GMT
From: ctcgag@hotmail.com
Subject: Re: Upgrading a File Lock (What do you think this is, a Holiday Inn?)
Message-Id: <20010626191150.261$mA@newsreader.com>
"Oleg Bakiev" <boa@aaanet.ru> wrote:
> "Miko O'Sullivan" <miko@idocs.com> :
> news:db27ea77.0106261237.4a10857d@posting.google.com...
> >
> > So what to do? Can I "upgrade" the lock from shared to exclusive, sort
> > of like upgrading from a room to a suite at the Holiday Inn?
> >
> You could use an additional file as a semaphore. Say you need to change
> shared lock to exclusive. You lock exclusively /tmp/semaphore(1), unlock
> your main file(2), lock it exclusively(3), unlock /tmp/semaphore(4). If
> your programs will use this protocol, different instances could't lock
> the main file at the moment between (2) and (3).
However, you can hit deadlock by this method. One process has
the semaphore EXlocked, releases its main SH, and is now waiting for
everything else to release their main SH. A second process is holding
a mainSH hostage, waiting on a semaphore EX. thump.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet for the Web
------------------------------
Date: 26 Jun 2001 22:49:29 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: using strict
Message-Id: <9hb3hp$qhr$1@bob.news.rcn.net>
Tramm Hudson <hudson@swcp.com> wrote:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote (in part):
>> ... Strictures only change the compile-time behavior, at run-time
>> there is no difference.
> That's not true. strict also has the run-time effect of disallowing
> symbolic references, among other things:
However, that's implemented in the run-time code for handling symbolic
references, which is of course never executed if your program doesn't use
them (and the check still needs to be performed even if you aren't using
strict, so there's zero effect on run-time performance in any case).
------------------------------
Date: Tue, 26 Jun 2001 21:54:21 -0700
From: Peter <rig01@yahoo.com>
Subject: Where I can find BINMODE, any examples ???
Message-Id: <9lpijtcjrvsj1bg0691j4hjqemh6lanajf@4ax.com>
Hi :
Please I need your Help :
Where I can find BINMODE, any examples ???
Thanks
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1201
***************************************