[17005] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4417 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 24 11:08:26 2000

Date: Sun, 24 Sep 2000 08:05:07 -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: <969807906-v9-i4417@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 24 Sep 2000     Volume: 9 Number: 4417

Today's topics:
    Re: "not in string" - how to do it? <ren.maddox@tivoli.com>
    Re: - For this type of use (see msg), should I favor Pe <bart.lateur@skynet.be>
    Re: - For this type of use (see msg), should I favor Pe <bart.lateur@skynet.be>
    Re: - For this type of use (see msg), should I favor Pe <flavell@mail.cern.ch>
        adding ".."(parent dir) to @INC <news@#nospam#althepal.com>
    Re: adding ".."(parent dir) to @INC (Tony L. Svanstrom)
    Re: adding ".."(parent dir) to @INC (Martien Verbruggen)
    Re: Candidates for the top ten illiteracy list [OFF TOP <amonotod@netscape.net>
    Re: convert from windows to linux (TrainsCan)
    Re: convert from windows to linux <mauldin@netstorm.net>
    Re: Gunzip at Prohosting (BUCK NAKED1)
        How to contatenate $1 with digits in s/// <flavell@mail.cern.ch>
    Re: How to contatenate $1 with digits in s/// <mauldin@netstorm.net>
    Re: How to contatenate $1 with digits in s/// (Tony L. Svanstrom)
    Re: How to contatenate $1 with digits in s/// (Maurice E. Jarrell)
    Re: How to contatenate $1 with digits in s/// <flavell@mail.cern.ch>
    Re: How to contatenate $1 with digits in s/// <tony_curtis32@yahoo.com>
    Re: How to contatenate $1 with digits in s/// <mauldin@netstorm.net>
        Newbie question about perl <fail00@hotmail.com>
    Re: Newbie question about perl <ddorward@hotmail.com>
    Re: Perl, Unix and printers <amonotod@netscape.net>
    Re: References and local (Martien Verbruggen)
    Re: References and local <mauldin@netstorm.net>
    Re: Regular Expression for matching with email addresse ohhhhhhme@my-deja.com
    Re: Regular Expression for matching with email addresse <jeffp@crusoe.net>
    Re: vertical text renderer <amonotod@netscape.net>
    Re: vertical text renderer <uri@sysarch.com>
    Re: vertical text renderer <godzilla@stomp.stomp.tokyo>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 23 Sep 2000 23:25:27 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: "not in string" - how to do it?
Message-Id: <m31yyabemg.fsf@dhcp11-177.support.tivoli.com>

nospam@hairball.cup.hp.com (Richard J. Rauenzahn) writes:

> Jeff Zucker <jeff@vpservices.com> writes:
> >Kurt Schmidt wrote:
> >> 
> >> I want to match all strings EXCEPT those that have one or more d in it.
> >
> >while (<DATA>) {
> >    print unless /d/;
> >}
> 
> Ummm, no...
> 
> while(<DATA>) {
>    print unless(tr/d// > 1)
> }

OK, that's the third response I've seen (including my own) where the
responder misread "one or more" as "more than one".  Is this some mild
form of dyslexia?

-- 
Ren Maddox
ren@tivoli.com


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

Date: Sun, 24 Sep 2000 08:15:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <mvdrssgqmri6rhtb9jcorou6h9vr0r7148@4ax.com>

Christopher M. Jones wrote:

>Oh puh-leaze, you're running a server on a 486 (a 66MHz no less)
>and you're complaining about the speed?  Hmmm, lemme try to
>troubleshoot where the speed drain might be.  It's either the
>OS, Perl, Apache, the 10baseT network, or your funky old-ass
>server hardware.

No I'm not complaining about the speed. I'm complaining about the speed
DIFFERENCE, between serving static files, and CGI generated files.

Even with a 100x faster computer, I expect this speed ratio to remain
the same. Therefore, it is relevant.

-- 
	Bart.


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

Date: Sun, 24 Sep 2000 08:37:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <d2frss4eeo0eq0psq60p08ej6icssrt0fh@4ax.com>

Uri Guttman wrote:

>starting up perl itself is very slow and memory intensive. try using
>fastcgi or speedy cgi and you will see a major improvement in speed.

I've header of FastCGI, but SpeedyCGI is new to me. ... Ah, I found  the
home page, I think.

	<http://daemoninc.com/speedycgi/>

I sure have to try this, one day.  ;-)

-- 
	Bart.


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

Date: Sun, 24 Sep 2000 10:54:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <Pine.GHP.4.21.0009241046480.3246-100000@hpplus03.cern.ch>

On Sat, 23 Sep 2000, Christopher M. Jones wrote:

[to Bart Lateur]
> Oh puh-leaze, you're running a server on a 486 (a 66MHz no less)

I'm running a perfectly fine two-interface multicast router on an
ancient 25MHz 486 with FreeBSD.  The world doesn't run entirely on
bloatware, in spite of the impression created by the masses.

When I need a cluster of 800MHz CPUs I use one, but that doesn't mean
I need one even to help me blow my nose.

> and you're complaining about the speed?  Hmmm, lemme try to
> troubleshoot where the speed drain might be.  It's either the
> OS, Perl, Apache, the 10baseT network, or your funky old-ass
> server hardware.   

[and more of the same]

I'd say Bart came out of that exchange ahead of the field, and you
just made yourself look silly.  IMHO, of course.



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

Date: Sun, 24 Sep 2000 10:25:52 GMT
From: Alex Hart <news@#nospam#althepal.com>
Subject: adding ".."(parent dir) to @INC
Message-Id: <QEkz5.10618$T6.464739@typhoon2.ba-dsg.net>

I want to include a module that is either in a the parent directory of
the script or in the same directory. I do not want to hard code any
directory.

How can I add ".." to my @INC for only some scripts?  Thanks already.

- Alex



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

Date: Sun, 24 Sep 2000 12:50:15 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: adding ".."(parent dir) to @INC
Message-Id: <1ehgrmm.z0yh0c4i6ivqN%tony@svanstrom.com>

Alex Hart <news@#nospam#althepal.com> wrote:

> I want to include a module that is either in a the parent directory of
> the script or in the same directory. I do not want to hard code any
> directory.
> 
> How can I add ".." to my @INC for only some scripts?  Thanks already.

Take a look at push, and then just add that to the scripts in question.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Sun, 24 Sep 2000 22:49:09 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: adding ".."(parent dir) to @INC
Message-Id: <slrn8srqhl.jr6.mgjv@martien.heliotrope.home>

On Sun, 24 Sep 2000 12:50:15 +0200,
	Tony L. Svanstrom <tony@svanstrom.com> wrote:
> Alex Hart <news@#nospam#althepal.com> wrote:
> 
> > I want to include a module that is either in a the parent directory of
> > the script or in the same directory. I do not want to hard code any
> > directory.
> > 
> > How can I add ".." to my @INC for only some scripts?  Thanks already.
> 
> Take a look at push, and then just add that to the scripts in question.

I wouldn't advise modification of @INC without mentioning that it has to
be done inside of a BEGIN block. But I'd rather refer people to the lib
pragma:

# perldoc lib

Or maybe to the perl FAQ

# perldoc perlfaq8
[snip]
               How do I keep my own module/library directory?
[snip]

which refers to the same thing.

use lib '..'; # works just fine

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd.   | reflects this.
NSW, Australia                  | 


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

Date: Sun, 24 Sep 2000 07:30:13 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Candidates for the top ten illiteracy list [OFF TOPIC]
Message-Id: <8qkai5$u95$1@nnrp1.deja.com>

In article <39CC43B0.26A3D4DE@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Lots of blathering blithering idiots within newsgroups.

To thine own self, be true.

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 24 Sep 2000 12:35:04 GMT
From: tcg@TrainsCan.com (TrainsCan)
Subject: Re: convert from windows to linux
Message-Id: <39cdf2a7.2059931@news.maxim.ca>

On Sun, 24 Sep 2000 04:30:06 -0000, Joseph Cohen
<yosef_hacohen@yahoo.com> wrote:

>ive been working on a lot of perl scripts on windows, and they work fine
>when i upload them to perl hosts, i get a 500 error
>i think its because of the different newlines
>i tried writing a script to do it, but it didnt work
>does anyone know of any software that will do it?

If you are using ftp to upload the script to the host, upload it as a
text (or ASCII, not binary) file.  That will fix the line endings.
There should be an option somewhere to do this in your ftp program.

I have a related problem.  I had perl CGI scripts running fine under
W98 (AcitvePerl, Xitami web server) but they bombed under Linux.
Finally discovered that placement of the opening brackets on
subroutines was the problem:

sub xxx
{
    stuff here, works fine under W98 but not under Linux
}

sub yyy {
     stuff here, works fine under both W98 and Linux
}

I sort of thought that perl was supposed to be white space neutral...



######    |\^/|    Timothy C. Green, CD, PEng, MEng
###### _|\|   |/|_  tcg@TrainsCan.com
###### >         <  TrainsCan, RailWeb, TCG PEng
######  >_./|\._<  http://www.TrainsCan.com


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

Date: Sun, 24 Sep 2000 13:36:06 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: convert from windows to linux
Message-Id: <39CE0315.BEC8669C@netstorm.net>

Joseph Cohen wrote:
> 
> ive been working on a lot of perl scripts on windows, and they work fine
> when i upload them to perl hosts, i get a 500 error
> i think its because of the different newlines
> i tried writing a script to do it, but it didnt work
> does anyone know of any software that will do it?
> 

An easy way to solve the newline problem is to get Progammer's File
Editor (PFE) at http://www.lancs.ac.uk/people/cpaap/pfe/ and save your
Windows programs in Unix format (which works fine under Windows, BTW). 
A great editor, too, even though "development has come to an end."

-- Jim


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

Date: Sun, 24 Sep 2000 02:41:57 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Gunzip at Prohosting
Message-Id: <2239-39CDB045-118@storefull-242.iap.bryant.webtv.net>

Thanks, but I couldn't get any of those suggestions to work, so I went
back to trying it with modules. Having no access to server logs,
CGI::Carp 'fatalsToBrowser' just tells me "inflation failed." Did I make
a mistake in my coding below?

#!/usr/bin/perl
use CGI::Carp 'fatalsToBrowser'; 
use Compress::Zlib; 
use Archive::Tar;
$! = 1;
    $x = inflateInit() 
       or die "Cannot create a inflation stream\n"; 
    $input = 'lwp.tar.gz';
while (read(STDIN, $input, 4096)) 
    { 
       ($output, $status) = $x->inflate(\$input); 
        print $output 
       if $status == Z_OK or $status == Z_STREAM_END; 
        last if $status != Z_OK; 
    }    
       die "inflation failed\n" 
        unless $status == Z_STREAM_END;



Thanks again,
Dennis



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

Date: Sun, 24 Sep 2000 15:21:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: How to contatenate $1 with digits in s///
Message-Id: <Pine.GHP.4.21.0009241506530.10314-100000@hpplus03.cern.ch>


I have a substitution in which I want to concatenate the resulting
match string $1 with a string of digits, say e.g 20.

But if I write (the actual match pattern is of no importance here)
something like s/foo(...)baz/$120/ then I get "Use of uninitialized
value".  

Of course, something like s/foo(...)baz/$1_20/ does what it says
it does, but then there's an extra underscore in the result, that I
don't want.

I'm sure I'm missing something obvious.  Clue-stick, anyone, please?

This is 5.005_03, if it matters.



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

Date: Sun, 24 Sep 2000 13:58:52 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <39CE086A.A215878E@netstorm.net>

"Alan J. Flavell" wrote:
> 
> I have a substitution in which I want to concatenate the resulting
> match string $1 with a string of digits, say e.g 20.
> 
> But if I write (the actual match pattern is of no importance here)
> something like s/foo(...)baz/$120/ then I get "Use of uninitialized
> value".
> 

As stated, the regex is looking for a variable named $120 on the replace
side. This variable is uninitialized, hence the error.  Use braces to
isolate the variable from the adjacent number, like so:

s/foo(...)baz/${1}20/;

-- Jim


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

Date: Sun, 24 Sep 2000 15:58:59 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <1ehh0b8.1qcmsre87gmlcN%tony@svanstrom.com>

Alan J. Flavell <flavell@mail.cern.ch> wrote:

> I have a substitution in which I want to concatenate the resulting
> match string $1 with a string of digits, say e.g 20.
> 
> But if I write (the actual match pattern is of no importance here)
> something like s/foo(...)baz/$120/ then I get "Use of uninitialized
> value".  
> 
> Of course, something like s/foo(...)baz/$1_20/ does what it says
> it does, but then there's an extra underscore in the result, that I
> don't want.
> 
> I'm sure I'm missing something obvious.  Clue-stick, anyone, please?

Might not be as beautiful as you might want it to be, but if you just
need to solve a problem while you're waiting for that clue-stick to
arrive you could use: $1\00020


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Sun, 24 Sep 2000 14:05:12 GMT
From: mejarrell@worldnet.att.net (Maurice E. Jarrell)
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <m3hf76fbll.fsf@localhost.localdomain>

"Alan J. Flavell" <flavell@mail.cern.ch> writes:

> I have a substitution in which I want to concatenate the resulting
> match string $1 with a string of digits, say e.g 20.
> 
> But if I write (the actual match pattern is of no importance here)
> something like s/foo(...)baz/$120/ then I get "Use of uninitialized
> value".  
> 
> Of course, something like s/foo(...)baz/$1_20/ does what it says
> it does, but then there's an extra underscore in the result, that I
> don't want.
> 

I read up on the /e modifier in Friedl's _Mastering Regular
Expressions_ and it seems to do what you need:

#!/usr/bin/perl -w

use strict;

my( $var ) = 'Alabama';
my( $result );

if ( $var =~ s/(ama)/$1 . '123'/e ) {
    print $1 . "\n" . $var . "\n";
}
__END__

The output is:

ama
Alabama123

From p257: ( paraphrased ) The /e causes the replacement operand to be
evaluated as with eval and the result substituted for the matched
text.

HTH,

Mo


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

Date: Sun, 24 Sep 2000 16:14:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <Pine.GHP.4.21.0009241604330.10314-100000@hpplus03.cern.ch>

On Sun, 24 Sep 2000, Jim Mauldin wrote:

> s/foo(...)baz/${1}20/;

Braces!  That's the ticket.

Thanks.  Now that you mention it, I _did_ know that once, but couldn't
put my finger on it when I needed it.  And even now that you've
reminded me, and I've looked-over the documentation again, I'm not
sure that I would know how to look it up there.

cheers



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

Date: 24 Sep 2000 09:58:44 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <87lmwhq1jv.fsf@limey.hpcc.uh.edu>

>> On Sun, 24 Sep 2000 16:14:00 +0200,
>> "Alan J. Flavell" <flavell@mail.cern.ch> said:

> On Sun, 24 Sep 2000, Jim Mauldin wrote:
>> s/foo(...)baz/${1}20/;

> Braces!  That's the ticket.

> Thanks.  Now that you mention it, I _did_ know that
> once, but couldn't put my finger on it when I needed it.
> And even now that you've reminded me, and I've
> looked-over the documentation again, I'm not sure that I
> would know how to look it up there.

I found something pertinent in perldata:

       Scalar value constructors
       ...
       As in some shells, you can enclose the variable name in
       braces to disambiguate it from following alphanumerics.
       ...
           $who = "Larry";
           print PASSWD "${who}::0:0:Superuser:/:/bin/perl\n";
           print "We use ${who}speak when ${who}'s here.\n";

Actually, the "bang on a colon at the end" was the first
thing that sprang to mind when I read this article, but
that comes from shcripts of course.

(Since perl "inherits" from shcripts, I suppose it's valid
for the brace syntax to be documented in "man sh" :-)

hth
t
-- 
Namaste!
And an "oogabooga" to you too!
                                         -- Homer Simpson


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

Date: Sun, 24 Sep 2000 14:59:32 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: How to contatenate $1 with digits in s///
Message-Id: <39CE16A2.FF8FBB43@netstorm.net>

"Alan J. Flavell" wrote:
> 
> On Sun, 24 Sep 2000, Jim Mauldin wrote:
> 
> > s/foo(...)baz/${1}20/;
> 
> Braces!  That's the ticket.
> 
> Thanks.  Now that you mention it, I _did_ know that once, but couldn't
> put my finger on it when I needed it.  And even now that you've
> reminded me, and I've looked-over the documentation again, I'm not
> sure that I would know how to look it up there.
> 

perldoc perldata

Also page 62 of "Programming Perl" 3rd Edition.

-- Jim


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

Date: Sun, 24 Sep 2000 20:20:53 +1200
From: "fail006" <fail00@hotmail.com>
Subject: Newbie question about perl
Message-Id: <8qkdv0$i0l$1@news.ihug.co.nz>

Hi I would like to know how can write a perl script that will telnet into a
router?
I have just started using perl. I am using perl that came with redhat 6.2.
can anyone please give me some hints or point me in the right direction.


Thanks alot






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

Date: Sun, 24 Sep 2000 13:41:48 +0100
From: David Dorward <ddorward@hotmail.com>
Subject: Re: Newbie question about perl
Message-Id: <39CDF68C.F62E51B6@hotmail.com>

fail006 wrote:
> 
> Hi I would like to know how can write a perl script that will telnet into a
> router?
> I have just started using perl. I am using perl that came with redhat 6.2.
> can anyone please give me some hints or point me in the right direction.
> 
> Thanks alot

There is a telnet module at CPAN:

http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?search=telnet&new=Search&filetype=+module+name+or+description&join=and&arrange=file&download=auto&stem=no&case=clike&site=ftp.funet.fi&age=
-- 
David Dorward
http://www.dorward.co.uk/


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

Date: Sun, 24 Sep 2000 07:36:37 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Perl, Unix and printers
Message-Id: <8qkau3$uir$1@nnrp1.deja.com>

In article <39CCF174.CB751246@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> vivekvp wrote:
> > I want to write a script that would disable printer
> > queues then reenable them with a perl script.
<snip>
> Do you want to clear printer queues or
> disable printers? You cannot disable
> then enable a printer queue. You can
> disable and enable a printer.
<snip>

Before you consider taking any server administration advice from
Moronzilla, I urge to read one of its provious posts:

http://x57.deja.com/getdoc.xp?AN=671025894&CONTEXT=969780828.1348272155&
hitnum=4

Now, think to yourself: "How can a memory leak be caused be a faulty
modem?"

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 24 Sep 2000 18:38:26 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: References and local
Message-Id: <slrn8srbri.jr6.mgjv@martien.heliotrope.home>

On 24 Sep 2000 06:23:56 GMT,
	Abigail <abigail@foad.org> wrote:
> 
> The perlsub manpage says:
> 
>     A `local' just gives temporary values to global (meaning package)
>     variables. It does not create a _local_ variable.
> 
> The perlref manpage says:
> 
>     By using the backslash operator on a variable, subroutine, or
>     value.  (This works much like the & (addressof) operator in C.)
>     This typically creates another reference to a variable, because
>     there's already a reference to the variable in the symbol table.

Providing some historical context to this pice of documentation:

[First three man pages reproduced unformatted, but rewrappd, because my
nroff macro packages don't work correctly with them]

Perl 1.000: From perl.man.1

There are no local variables\*(--everything is a global variable.

Perl 2.000: From perl.man.2

 .Ip "local(LIST)" 8 4

Declares the listed (scalar) variables to be local to the enclosing
block, subroutine or eval.  (The "do 'filename';" operator also counts
as an eval.) This operator works by saving the current values of those
variables in LIST on a hidden stack and restoring them upon exiting the
block, subroutine or eval.  The LIST may be assigned to if desired,
which allows you to initialize your local variables.

Perl 3.01: From perl.man.2

 .Ip "local(LIST)" 8 4

Declares the listed variables to be local to the enclosing block,
subroutine, eval or \*(L"do\*(R".  All the listed elements must be legal
lvalues.  This operator works by saving the current values of those
variables in LIST on a hidden stack and restoring them upon exiting the
block, subroutine or eval.  This means that called subroutines can also
reference the local variable, but not the global one.  The LIST may be
assigned to if desired, which allows you to initialize your local
variables.

Perl 4.036: From perl.man

       local(LIST)
               Declares the listed variables to be local  to  the
               enclosing  block,  subroutine,  eval or "do".  All
               the listed elements must be legal  lvalues.   This
               operator  works  by  saving  the current values of
               those variables in LIST  on  a  hidden  stack  and
               restoring  them upon exiting the block, subroutine
               or eval.  This means that called  subroutines  can
               also  reference  the  local  variable, but not the
               global one.   The  LIST  may  be  assigned  to  if
               desired, which allows you to initialize your local
               variables.

> So, I would think that the following program:
> 
>     $var = "foo";
>     $ref = \$var;
>     local $var = "baz";
>     print $$ref;
> 
> would print 'baz'. After all, $ref is a reference to $var, and the local
> makes $var get a local _value_. Without the local, the program prints
> 'baz', but with the local, the program prints 'foo', as if local produces
> the new variable, instead of a new value.

Like you, I'd expect 'baz', after reading the documentation.

> I asked about this on IRC, and uri gave me an explaination from the
> implementation side; how it works with SVs and such. But I don't
> find that acceptable, as SVs don't exist on the language level; they
> are implementation details, and a next version of Perl might do it
> differently.
> 
> I think that one of the following is true:
> 
>     1)  This behaviour is explained in the manual, and I just don't
>         understand the manual.
>     2)  The documentation is incomplete.
>     2a) The documentation is wrong.
>     3)  It's a bug.
>     3a) It's a bug and will be fixed in the next release.
>     4)  Yeah, it's a case of the implementation surfacing on the
>         language level, but we don't really care.
>     5)  We are Larry. Resistance is futile. You will be assimilated.

Well, seeing that the documentation, starting at 2.000, consistently
(implicitly) states that the variable is the same, and (explicitly
states that) the value gets saved and restored, I would say that it's 3)
and hopefully 3a). How this is implemented should be irrelevant to the
matter, not? The documentation states what the _intent_ of the way this
operation is. Before perl 5, this probably was never a problem, because
there was only one way to get to these values,and that was through the
name. With the coming of references, as you demonstrate, there are ways
around this. What surprises me is that this hasn't been uncovered
before.  The problem exists in 5.004_05, 5.005_03 and 5.6.0.

Yeah, I know that the authoritative documentation of the way Perl works
is perl itself (which would imply 2a, _not_ 2), but I can hardly believe
that something of which the intent has been documented so clearly in a
certain way is allowed to work differently.

> I really hope for 3a), as that will make my 'deferred_interpolation'
> module much more useful. ;-)

I think it can be useful enough on its own, in the current situation.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In the fight between you and the
Commercial Dynamics Pty. Ltd.   | world, back the world - Franz Kafka
NSW, Australia                  | 


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

Date: Sun, 24 Sep 2000 13:23:31 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: References and local
Message-Id: <39CE0020.9EA1C716@netstorm.net>

Abigail wrote:
> 
> The perlsub manpage says:
> 
>     A `local' just gives temporary values to global (meaning package)
>     variables. It does not create a _local_ variable.
> 
> The perlref manpage says:
> 
>     By using the backslash operator on a variable, subroutine, or
>     value.  (This works much like the & (addressof) operator in C.)
>     This typically creates another reference to a variable, because
>     there's already a reference to the variable in the symbol table.
> 
> So, I would think that the following program:
> 
>     $var = "foo";
>     $ref = \$var;
>     local $var = "baz";
>     print $$ref;
> 
> would print 'baz'. 

"Programming Perl" says:
      This operator does not create a local variable ...

      This operator works by saving the current values of the specified
      variables on a hidden stack and restoring them upon exiting the
      block, subroutine, eval, or file.

But that's clearly not what is happening

$var = 'foo';
print \$var, "\n";       # prints SCALAR(0x87651b8)
{
   local $var;
   print \$var, "\n";    # prints SCALAR(0x876f160) - another variable
}
print \$var, "\n";       # prints SCALAR(0x87651b8)

-- Jim


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

Date: Sun, 24 Sep 2000 11:06:28 GMT
From: ohhhhhhme@my-deja.com
Subject: Re: Regular Expression for matching with email addresses
Message-Id: <8qkn7g$adj$1@nnrp1.deja.com>

Best e-mail regex I ever seen is by Jim Smyser
and looks like this:

m@.*[=|:|>|<|"|\s|(]([\w\-]+\@.*?\w.*?\..*?)
[:|>|<|"|\s|\?|\&|,|)]@

Hope this helps!

In article <8ptd4b$t1q$1@nnrp1.deja.com>,
  James Adams <james_adams@yahoo.com> wrote:
> I want to verify that strings conform to a
typical email address
> format.  I have some code which can use Perl
regular expressions as
> verification masks, but I'm not the world's
best at Perl regular
> expressions so I'm hoping that someone can
provide me with some example
> Perl regular expressions that I could use for
this verification mask.
>
> I want to match with something like
> my.address_is-ugly@some.place.com (dashes,
underscores, and digits are
> ok, only one @ sign, etc.)
> and fail to match with garbage such as this:
bad%*)addres@isp@isp2.it
>
> Many thanks in advance for any suggestions.
>
> -James
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 24 Sep 2000 07:49:24 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Regular Expression for matching with email addresses
Message-Id: <Pine.GSO.4.21.0009240747540.5957-100000@crusoe.crusoe.net>

On Sep 24, ohhhhhhme@my-deja.com said:

>Best e-mail regex I ever seen is by Jim Smyser
>and looks like this:
>
>m@.*[=|:|>|<|"|\s|(]([\w\-]+\@.*?\w.*?\..*?)
>[:|>|<|"|\s|\?|\&|,|)]@
>
>Hope this helps!

Probably not.  That regex is quite hideous, really.  There are |'s in
character classes where there shouldn't be.  And it doesn't match email
addresses like fred&barney@stonehenge.com (and the ilk).

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: Sun, 24 Sep 2000 07:17:45 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: vertical text renderer
Message-Id: <8qk9qi$sd8$1@nnrp1.deja.com>

In article <39CD9610.CCF04118@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Richard Ireland wrote:
> > Does anyone know of a perl script that can accept a query string
> > with a text field and retrun a content-type: image/gif with the text
> > rendered vertically.
<snip>
> Oh? Why would you use a module for this? Writing your
> own script is easy and more imaginative. You can do
> 'things' with your own script, modules cannot even
> begin to do.
>
> Modules are for Obessive Techno-Geekster Perl 5
> Cargo Cultists Copy & Paste Specialists who don't
> have a clue how to write a program.
>
> Look over my five minute test script and you will note
> a high potential to do whatever you wish, not what some
> Cargo Cult module forces you to do.
>
> Godzilla!
> --
> Androids And More
>   http://la.znet.com/~callgirl/android.html
>

Once again, you reply to a post with content that is completely and
irrefutably disconnected from the original post.  He didn't ask for HTML
formatting help, you brainless git, so if you can't answer the question,
shut the hell up.

Now, unless you're willing to come up with a script that takes a text
string, renders it as an vertical aligned image file, and spits it back
at the client, you have nothing to say, and should not have replied to
the OP.

It is no longer "go, go, godzilla!,"
now its "shut up moronzilla!"

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 24 Sep 2000 08:19:09 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: vertical text renderer
Message-Id: <x7n1gyb3sz.fsf@home.sysarch.com>

>>>>> "a" == amonotod  <amonotod@netscape.net> writes:

  a> Once again, you reply to a post with content that is completely and
  a> irrefutably disconnected from the original post.  He didn't ask for
  a> HTML formatting help, you brainless git, so if you can't answer the
  a> question, shut the hell up.

it's her Piled on Higher and Deeper in english comprehension from the
mail order degree catalog that enables her to respond so well and on
target.

  a> now its "shut up moronzilla!"

it's always been that. i just wish more of us would get it.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sun, 24 Sep 2000 06:52:08 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: vertical text renderer
Message-Id: <39CE0708.13BDDC2F@stomp.stomp.tokyo>

Uri Guttman wrote:
 
> >>>>> "a" == amonotod  <amonotod@netscape.net> writes:
 
>   a> Once again, you reply to a post with content that is completely and
>   a> irrefutably disconnected from the original post.  He didn't ask for
>   a> HTML formatting help, you brainless git, so if you can't answer the
>   a> question, shut the hell up.
 
> it's her Piled on Higher and Deeper in english comprehension from the
> mail order degree catalog that enables her to respond so well and on
> target.
 
>   a> now its "shut up moronzilla!"
 
> it's always been that. i just wish more of us would get it.




Oh look! It's Beavis and Butthead.

Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4417
**************************************


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