[30609] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1852 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 13 00:09:47 2008

Date: Fri, 12 Sep 2008 21:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 12 Sep 2008     Volume: 11 Number: 1852

Today's topics:
        -I switches on shebang line xhoster@gmail.com
    Re: -I switches on shebang line <ben@morrow.me.uk>
    Re: binmode blues <ben@morrow.me.uk>
    Re: binmode blues <someone@example.com>
    Re: Extract Numeric values from string <glennj@ncf.ca>
    Re: Extract Numeric values from string <jurgenex@hotmail.com>
        Illegal cp wisenecrosisfp@gmail.com
        illegal pedo wisenecrosisfp@gmail.com
        illegal young teen free illegal young very young illega wisenecrosisfp@gmail.com
        lolitaz - Free Video wisenecrosisfp@gmail.com
        ls bbs - Free preteen pics and video ~~~~~ ls bbs porta rrblockrenal@gmail.com
    Re: OK to delete hash pairs while iterating through it? <whynot@pozharski.name>
        prelolitas - FREE VIDEO wisenecrosisfp@gmail.com
        Requiring Lexical $_ / Obliterating Global $_? (Tim McDaniel)
        russian woman - FREE VIDEO wisenecrosisfp@gmail.com
        shylolita - Free Video rrblockrenal@gmail.com
        young bbs free bbs ls bbs www bbs bbs board bbs pic dar rrblockrenal@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 12 Sep 2008 14:53:47 GMT
From: xhoster@gmail.com
Subject: -I switches on shebang line
Message-Id: <20080912105348.616$G7@newsreader.com>

I'm sure something in perldoc perlrun is relevant to my question, but
I can't figure out what.  Please give me a kick in the pants.

$ cat foo.pl
#!/home/xho/perl_10/bin/perl -Ifoo -Ibar -l
print foreach @INC;
__END__

$ ./foo.pl
foo -Ibar -l
/home/xho/perl_10/lib/5.10.0/x86_64-linux-thread-multi
/home/xho/perl_10/lib/5.10.0
/home/xho/perl_10/lib/site_perl/5.10.0/x86_64-linux-thread-multi
/home/xho/perl_10/lib/site_perl/5.10.0
 .
foo
bar

So, why are foo and bar put at the end of @INC, instead of at the beginning
where perlrun says they should?

And why is "foo -Ibar -l" put at the front of @INC, as if all of the
shebang line after the first word were put in quotes?

This behavior doesn't seem specific to 5.10.0, it is seen in various 5.8
as well.  If invoked like "perl foo.pl" then the foo and bar still
go at the end, rather than beginning, but the weird first entry is omitted.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Fri, 12 Sep 2008 17:13:20 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: -I switches on shebang line
Message-Id: <02hqp5-tbs.ln1@osiris.mauzo.dyndns.org>


Quoth xhoster@gmail.com:
> I'm sure something in perldoc perlrun is relevant to my question, but
> I can't figure out what.  Please give me a kick in the pants.
> 
> $ cat foo.pl
> #!/home/xho/perl_10/bin/perl -Ifoo -Ibar -l
> print foreach @INC;
> __END__
> 
> $ ./foo.pl
> foo -Ibar -l
> /home/xho/perl_10/lib/5.10.0/x86_64-linux-thread-multi
> /home/xho/perl_10/lib/5.10.0
> /home/xho/perl_10/lib/site_perl/5.10.0/x86_64-linux-thread-multi
> /home/xho/perl_10/lib/site_perl/5.10.0
> .
> foo
> bar
> 
> So, why are foo and bar put at the end of @INC, instead of at the beginning
> where perlrun says they should?
> 
> And why is "foo -Ibar -l" put at the front of @INC, as if all of the
> shebang line after the first word were put in quotes?
> 
> This behavior doesn't seem specific to 5.10.0, it is seen in various 5.8
> as well.  If invoked like "perl foo.pl" then the foo and bar still
> go at the end, rather than beginning, but the weird first entry is omitted.

This is all to do with the way #! lines are parsed by the OS, and by
perl. The OS treats everything after the first space as a single
argument (to avoid needing to parse quoting in the kernel), and
effectively invokes perl as

    /home/xho/perl_10/bin/perl "-Ifoo -Ibar -l" foo.pl

perl prepends "foo -Ibar -l" to @INC, as documented, then constructs its
default @INC. Then it finds the #! line itself, parses it for more
options, and any -I found then go at the *end* of @INC. I don't know if
this is documented anywhere, but it happens at least as far back as 5.6.

In simple terms: #! parsing is highly dodgy, and perl's efforts to make
it less so don't always help. I would 'use lib', instead.

Ben

-- 
I touch the fire and it freezes me,                      [ben@morrow.me.uk]
I look into it and it's black.
Why can't I feel? My skin should crack and peel---
I want the fire back...                     BtVS, 'Once More With Feeling'


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

Date: Fri, 12 Sep 2008 15:30:22 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: binmode blues
Message-Id: <u0bqp5-3a2.ln1@osiris.mauzo.dyndns.org>


Quoth jidanni@jidanni.org:
> bdf> This one is reading from ARGV. What happens when you bin mode that
> bdf> filehandle too?
> 
> I see. OK, so what should I write instead of just
> > binmode STDIN, ":utf8"; binmode STDOUT, ":utf8";
> so that it will work no matter if my program is called with any of
> $ myprogram < file1
> $ myprogram file1
> $ myprogram file1 file2 file3 ...
> $ myprogram file1 file2 file3 < file4
> Ah, for(STDIN,STDOUT,@ARGV){binmode $_, ":utf8"}... shot down real fast:
> Bareword "STDIN" not allowed while "strict subs"... as we see, yes I don't
> know what I'm doing.

Global filehandles are a little odd in Perl. You want

    for (\*STDIN, \*STDOUT, \*ARGV) {
        binmode $_, ":utf8";
    }

except you *really* don't want to be using the :utf8 layer. Use
:encoding(utf8) instead: it's much safer in te face of invalid data.

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces mollit animos, tristesque mentes erigit.   |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |


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

Date: Fri, 12 Sep 2008 08:16:23 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: binmode blues
Message-Id: <aJvyk.7333$cr4.1236@newsfe02.iad>

Ben Morrow wrote:
> Quoth jidanni@jidanni.org:
>> bdf> This one is reading from ARGV. What happens when you bin mode that
>> bdf> filehandle too?
>>
>> I see. OK, so what should I write instead of just
>>> binmode STDIN, ":utf8"; binmode STDOUT, ":utf8";
>> so that it will work no matter if my program is called with any of
>> $ myprogram < file1
>> $ myprogram file1
>> $ myprogram file1 file2 file3 ...
>> $ myprogram file1 file2 file3 < file4
>> Ah, for(STDIN,STDOUT,@ARGV){binmode $_, ":utf8"}... shot down real fast:
>> Bareword "STDIN" not allowed while "strict subs"... as we see, yes I don't
>> know what I'm doing.
> 
> Global filehandles are a little odd in Perl. You want
> 
>     for (\*STDIN, \*STDOUT, \*ARGV) {
>         binmode $_, ":utf8";
>     }

And you may want to also include ARGVOUT in there?  Of course you 
*could* do it like this instead:

use open qw/:std :utf8/;


> except you *really* don't want to be using the :utf8 layer. Use
> :encoding(utf8) instead: it's much safer in te face of invalid data.

use open qw/:std :encoding(utf8)/;



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: 12 Sep 2008 15:00:16 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Extract Numeric values from string
Message-Id: <slrngcl101.qud.glennj@smeagol.ncf.ca>

At 2008-09-12 12:43AM, "Jürgen Exner" wrote:
>  Vishal G <v3gupta@gmail.com> wrote:
[...]  
>  Now, if you set the INPUT RECORD SEPARATOR $/ to the space character,
>  then as far as Perl is concerned each number becomes its own line.
>  
>  Now you can read your file line by line (i.e. number by number) and Perl
>  conveniently even keeps a record of which line you just read in the
>  variable INPUT_LINE_NUMBER $. . 
>  
>  To e.g. print $n numbers, starting with number $start becomes something
>  like (sketch only, untested):
>  
>  $. = ' ';

Above should be:  $/ = ' ';

>  while ($. < $start) {
>  	$dummy = <IN>; #read line (=number) and throw it away
>  }
[...]

-- 
Glenn Jackman
    Write a wise saying and your name will live forever. -- Anonymous


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

Date: Fri, 12 Sep 2008 08:36:34 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Extract Numeric values from string
Message-Id: <033lc45bo9fo83dlf3c1q8fqj8t3plsfn6@4ax.com>

Glenn Jackman <glennj@ncf.ca> wrote:
>At 2008-09-12 12:43AM, "Jürgen Exner" wrote:
>>  Vishal G <v3gupta@gmail.com> wrote:
>[...]  
>>  Now, if you set the INPUT RECORD SEPARATOR $/ to the space character,
>>  then as far as Perl is concerned each number becomes its own line.
>>  
>>  Now you can read your file line by line (i.e. number by number) and Perl
>>  conveniently even keeps a record of which line you just read in the
>>  variable INPUT_LINE_NUMBER $. . 
>>  
>>  To e.g. print $n numbers, starting with number $start becomes something
>>  like (sketch only, untested):
>>  
>>  $. = ' ';
>
>Above should be:  $/ = ' ';

Thanks!

jue


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

Date: Fri, 12 Sep 2008 14:40:11 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: Illegal cp
Message-Id: <f1879fc5-ca9c-4474-957c-f02b0d00e3c6@f63g2000hsf.googlegroups.com>

Illegal cp
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/Illegal-cp
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
Illegal cp college, Large firm illegal cp It was the typical
conservative and illegal cp preconvinced The person dividing the
illegal cp on black and white. Try to illegal cp them, having sent
illegal cp it energy of love and illegal cp Exercise =C3=AC 26 illegal cp
TRAVEL TO THE illegal cp 1. "to reach the illegal cp level, me It
illegal cp necessary to count mentally blindly illegal cp from three
to one ". illegal cp address to all illegal cp in This world, illegal
cp of social and illegal cp financial position, formation, illegal cp
relation to Religions, colour illegal cp a skin, political illegal cp
and a nationality. illegal cp I have declared at illegal cp that a box
of illegal cp at My car illegal cp new, and here the generator illegal
cp knocks also it creates illegal cp picture, that the box illegal cp
speeds has failed. illegal cp can direct this energy illegal cp any
place, in any illegal cp to any person - here is illegal cp present
restrictions. Then I have given illegal cp to myself, having illegal
cp advice at last. - illegal cp calling - to illegal cp children,
especially kids. illegal cp


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

Date: Fri, 12 Sep 2008 14:41:09 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: illegal pedo
Message-Id: <ce2cdae1-0899-423d-ad81-44db648e7f65@e39g2000hsf.googlegroups.com>

illegal pedo
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/Illegal-cp
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
illegal pedo children, especially kids. illegal pedo


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

Date: Fri, 12 Sep 2008 14:38:05 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: illegal young teen free illegal young very young illegal illegal  young pics
Message-Id: <6ca06d02-ba0f-49f9-95ab-7113958ca1e4@m36g2000hse.googlegroups.com>

free illegal young
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/free-illegal-young
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
very young illegal girls
illegal pics of young
illegal young models
illegal young naked
illegal young teens
illegal young teen
free illegal young
illegal young pics
very young illegal
illegal young


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

Date: Fri, 12 Sep 2008 14:43:15 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: lolitaz - Free Video
Message-Id: <3646844b-283f-446d-9b17-d232b91b5cc7@x41g2000hsb.googlegroups.com>

lolitaz
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/lolitaz
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
lolitaz


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

Date: Fri, 12 Sep 2008 14:49:55 -0700 (PDT)
From: rrblockrenal@gmail.com
Subject: ls bbs - Free preteen pics and video ~~~~~ ls bbs portal ls island  bbs ls studio bbs ls barbie bbs ls dreams bbs ls model
Message-Id: <aeb2c707-602b-4d5e-ad29-08eef3ae9c2b@k37g2000hsf.googlegroups.com>

ls bbs
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/bbs
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
ls bbs portal ls island bbs ls studio bbs ls barbie bbs ls dreams bbs
ls model


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

Date: Fri, 12 Sep 2008 23:00:06 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: OK to delete hash pairs while iterating through it?
Message-Id: <6buqp5x40c.ln2@carpet.zombinet>

xhoster@gmail.com wrote:
*SKIP*
> But what conclusion are you drawing from this?

The first conclusion is that someone makes too much noise.  The second
is that someone has to use bigger samples if he wants meaningful
results.  That (below) clearly shows that adding keys while iterating
hash is unsafe.

perl -wle '
foreach(0 .. 25) {
$x{sprintf q|x%02i|, $_} = 1;
$y{sprintf q|y%02i|, $_} = 1; };
print scalar %x;
print scalar %y;
$m = 0;
while($z = each %x) {
print "$z => ", $m++;
$z = each %y;
defined $z or next;
$x{$z} = $y{$z}; }
' |sort
18/32
19/32
x00 => 30
x01 => 1
x02 => 0
x02 => 20
x03 => 9
x04 => 37
x05 => 12
x06 => 27
x07 => 5
x08 => 16
x09 => 18
x10 => 8
x11 => 23
x12 => 33
x13 => 7
x14 => 42
x15 => 21
x15 => 3
x16 => 14
x17 => 36
x18 => 11
x19 => 2
x20 => 13
x21 => 19
x22 => 10
x23 => 15
x24 => 28
x25 => 17
y02 => 26
y03 => 29
y04 => 34
y06 => 38
y07 => 40
y09 => 31
y10 => 39
y11 => 24
y12 => 22
y13 => 6
y17 => 25
y18 => 35
y21 => 41
y22 => 43
y23 => 4
y24 => 32

p.s.  Do bigger samples mean bigger noise?

-- 
Torvalds' goal for Linux is very simple: World Domination


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

Date: Fri, 12 Sep 2008 14:29:51 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: prelolitas - FREE VIDEO
Message-Id: <23a78d02-69f0-4737-aab1-8589fa16ab64@a1g2000hsb.googlegroups.com>

prelolitas
 .
 .
 .
*****************************
http://vids365.cn/prelolitas
*****************************
 .
 .
 .
 .
prelolitas


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

Date: Fri, 12 Sep 2008 16:58:14 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Requiring Lexical $_ / Obliterating Global $_?
Message-Id: <gae736$558$1@reader1.panix.com>

Currently I do
    local $_;
at the start of each sub, but it's an annoyance and it's not
fail-safe (I can forget).

Just found out about Perl 5.10.  Pretty cool.

    Lexical $_

    The default variable $_ can now be lexicalized, by declaring it
    like any other lexical variable, with a simple
        my $_;

    The operations that default on $_ will use the lexically-scoped
    version of $_ when it exists, instead of the global $_.

    In a map or a grep block, if $_ was previously my'ed, then the $_
    inside the block is lexical as well (and scoped to the block).

    In a scope where $_ has been lexicalized, you can still have
    access to the global version of $_ by using $::_, or, more simply,
    by overriding the lexical declaration with our $_. (Rafael
    Garcia-Suarez)

I like the convenience of the implicit USE of $_ in things like
"s/foo/bar/", but I've had an abhorrence of implicitly-declared
variables since FORTRAN days, and hatred of accidental variable
leakage since C.

Is there any way that I can dispose of any possibility of accidentally
using the global dynamic variable $_?  That is, where by default

    foreach (@array)

errors out (ideally at compile time), requiring that I do

    foreach my $_ (@array)

or declare it per sub or whatever I like?  

Should I look into playing with main's package symbol table (I know
nothing about the subject other than that it exists)?

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 12 Sep 2008 14:33:32 -0700 (PDT)
From: wisenecrosisfp@gmail.com
Subject: russian woman - FREE VIDEO
Message-Id: <1c0eb2d3-4c45-438d-920b-dae5e8fb5ece@k7g2000hsd.googlegroups.com>

russian woman
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/russian-woman
*****************************
 .
 .
 .
 .
russian woman


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

Date: Fri, 12 Sep 2008 14:44:12 -0700 (PDT)
From: rrblockrenal@gmail.com
Subject: shylolita - Free Video
Message-Id: <8c2e99b3-c4d8-4a1e-bc46-3bb9b8e008f6@m45g2000hsb.googlegroups.com>

shylolita
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/shylolita
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
shylolita


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

Date: Fri, 12 Sep 2008 14:49:15 -0700 (PDT)
From: rrblockrenal@gmail.com
Subject: young bbs free bbs ls bbs www bbs bbs board bbs pic dark bbs kds bbs  teen bbs
Message-Id: <690b180c-cd68-4169-9b95-8e98cb1689f0@p25g2000hsf.googlegroups.com>

shylolita
 .
 .
 .
*******CLICK HERE********
http://vids365.cn/bbs
*****************************
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
bbs international guestbook bbs bbs galleries bbs software bbs
download bbs for sale bbs pictures illegal bbs freedom bbs picture bbs
bbs tom com russian bbs bbs gallery bbs website youtube bbs windows
bbs harvard bbs vombat bbs nudist bbs models bbs teenyz bbs bbs search
bbs sports ranchi bbs ygirlz bbs little bbs bbs videos bbs system bbs
wheels online bbs elweb bbs child bbs bbs forum bbs board model bbs
girls bbs photo bbs bbs wheel bbs sites teens bbs klass bbs bbs games
white bbs black bbs video bbs naked bbs world bbs asian bbs pussy bbs
great bbs bbs radio young bbs zone bbs bbs news pedo bbs bbs game star
bbs free bbs bbs list best bbs gold bbs bbs data dark bbs bbs rims
tiny bbs teen bbs boys bbs bbs pics bbs door zeps bbs girl bbs bbs
code bbs gov bbs org web bbs lol bbs bbs tgp bbs net bbs com old bbs
pre bbs boy bbs bbs biz kds bbs bbs pic ark bbs bbs usa new bbs www
bbs sun bbs buy bbs the bbs top bbs cp bbs bbs ru bbs re mr bbs ls bbs
bbs ca bbs la bbs co


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 1852
***************************************


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