[22783] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5004 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 06:05:45 2003

Date: Mon, 19 May 2003 03:05:12 -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           Mon, 19 May 2003     Volume: 10 Number: 5004

Today's topics:
    Re: [The/My] trouble with Perl <kevin@vaildc.net>
    Re: [The/My] trouble with Perl <simon.andrews@bbsrc.ac.uk>
    Re: Error message with perl -MCPAN -e shell <sav_me_to_nospam@hotmail.com>
    Re: full 256 ascii auto string increment? (Anno Siegel)
        Help!: Error with 'Benchmark' module (entropy123)
    Re: Help!: Error with 'Benchmark' module <kalinabears@hdc.com.au>
    Re: Help!: Error with 'Benchmark' module <REMOVEsdnCAPS@comcast.net>
    Re: How do I pop this? <mail@annuna.com>
    Re: How do I pop this? <mail@annuna.com>
    Re: Losing value in require statement <dingdongy2k@hotmail.com>
    Re: mark-symlinked-directories (Anno Siegel)
    Re: multiple sort subroutine <spam@thecouch.homeip.net>
    Re: multiple sort subroutine <bwalton@rochester.rr.com>
    Re: multiple sort subroutine <ben.goldberg@hotpop.com>
    Re: Need a Perl script (ping IP address) (Anno Siegel)
        Paths relative to a module <res1uzbe@verizon.net>
        Perl 5.8 memory leak while using shared variables (Prakash)
        Perl based shopping cart - does anyone have a recommend <kjaernsr@online.no>
    Re: perl to c <dingdongy2k@hotmail.com>
        perl to FTP ? <dingdongy2k@hotmail.com>
    Re: perl to FTP ? <bwalton@rochester.rr.com>
    Re: PHP or Perl ? <tassilo.parseval@rwth-aachen.de>
    Re: possible bug in m// ? (Villy Kruse)
    Re: ReadLine with timeout <steffen.beyer@de.bosch.com>
    Re: Why causes the "format error" when using Archive::Z <kalinabears@hdc.com.au>
    Re: Why causes the "format error" when using Archive::Z (niudou)
    Re: Why causes the "format error" when using Archive::Z (niudou)
    Re: why key is added to hash after defined ? <steffen.beyer@de.bosch.com>
        win32 perl installation perl mans? <ryanc@nci1.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 18 May 2003 22:23:15 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: [The/My] trouble with Perl
Message-Id: <kevin-844AE3.22231518052003@vienna7.his.com>

In article <3EC4F205.2050806@bbsrc.ac.uk>,
 Simon Andrews <simon.andrews@bbsrc.ac.uk> wrote:

> Henk van Bree wrote:
> > One big .exe (for the Windows boxes) is prefered. 
> 
> You will probably have to compile your own version of Perl for this to 
> work then as the ActiveState version uses shared libraries.  It's not 
> that much hassle distributing perl56.dll (or whatever) with your app 
> though.  It also means that if you're distributing several applications 
> you only have to send the dll once.

By default, Perl2Exe puts *everything* in one big file...modules, DLLs, 
whatever.  There are two options that can change this-- '-small', which 
doesn't put the Perl .dll in there, and '-tiny', which doesn't put any 
DLLs in it.  Both of these options copy the affected DLLs to the current 
directory, so you know which ones are necessary.

And this is with ActiveState's Perl, so he shouldn't need to compile his 
own.
-- 
Kevin Michael Vail | Dogbert: That's circular reasoning.
kevin@vaildc.net   | Dilbert: I prefer to think of it as no loose ends.
http://www.vaildc.net/kevin/


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

Date: Mon, 19 May 2003 10:05:19 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3EC89E4F.1070901@bbsrc.ac.uk>



Kevin Michael Vail wrote:
> In article <3EC4F205.2050806@bbsrc.ac.uk>,
>  Simon Andrews <simon.andrews@bbsrc.ac.uk> wrote:
> 
> 
>>Henk van Bree wrote:
>>
>>>One big .exe (for the Windows boxes) is prefered. 
>>
>>You will probably have to compile your own version of Perl for this to 
>>work then as the ActiveState version uses shared libraries.  It's not 
>>that much hassle distributing perl56.dll (or whatever) with your app 
>>though.  It also means that if you're distributing several applications 
>>you only have to send the dll once.
> 
> 
> By default, Perl2Exe puts *everything* in one big file...modules, DLLs, 
> whatever.  There are two options that can change this-- '-small', which 
> doesn't put the Perl .dll in there, and '-tiny', which doesn't put any 
> DLLs in it.  Both of these options copy the affected DLLs to the current 
> directory, so you know which ones are necessary.
> 
> And this is with ActiveState's Perl, so he shouldn't need to compile his 
> own.

Except I was talking about pp, not perl2exe.

If you want to go the per2exe route then you don't need a statically 
compiled perl, but you do need to pay for perl2exe.

TMTOWTDI :-)

Simon.




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

Date: Mon, 19 May 2003 15:40:05 +1000
From: "leeper" <sav_me_to_nospam@hotmail.com>
Subject: Re: Error message with perl -MCPAN -e shell
Message-Id: <ba9qnm$qf$1@perki.connect.com.au>

kill -9 1142 maybe?

"Alan" <waty-spam@powerup.com.au> wrote in message
news:ExVxa.452$po1.31860@nnrp1.ozemail.com.au...
> Hello,
>
> I am new to CPAN so please forgive (possibly) the obvious question... When
I
> initially configured CPAN I must have done something wrong. I am trying to
> reconfigure but when I enter:
>
> perl -MCPAN -e shell
>
> I get the message:
>
> Use of uninitialized value at (eval 3) line 16, <TERMCAP> chunk 1.
>
> There seems to be running another CPAN process (1142
> ). Contacting...
> Other job not responding. Shall I overwrite the lockfile? (Y/N) [y]
>
> If I select Yes or No nothing happens, even if I wait for a long period.
>
> Thanks,
>
> Alan
>
>




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

Date: 19 May 2003 07:24:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: full 256 ascii auto string increment?
Message-Id: <baa0rg$flf$1@mamenchi.zrz.TU-Berlin.DE>

LBX10 <no.spam@spam.com> wrote in comp.lang.perl.misc:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:ba2cg1$mi6$1@mamenchi.zrz.TU-Berlin.DE...
> > LBX10 <no.spam@spam.com> wrote in comp.lang.perl.misc:
> > > What is the best way to go about incrementing a string so as to use all
> 256
> > > chars (ASCII) instead of just [A-Za-z0-9] ?
> > >
> > > So I can cycle al the way from \0x00 all the way to
> > > \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
> > > (that is, those hex values are really characters just not printable ones
> but
> > > define the full range.)
> >
> > You will have to do that yourself, the magical string increment keeps
> > characters in printing range.  This seems to do it, but needs more
> > testing:
> >
> >     sub inc_str {
> >         my $n = length $_[ 0];
> >         while ( $n-- ) {
> >             last if ++ vec( $_[ 0], $n, 8);
> >         }
> >         $_[ 0] = chr( 1) . $_[ 0] unless vec( $_[ 0], 0, 8);
> >     }
> >
> > If you need it to be extremely fast, consider Bit::Vector.
> >
> > Anno
> 
> Thanks, but it doesnt seem to grow strings (length wise)after the first or
> 2nd growth.

It takes increasingly longer to grow, but it still grows.  On an average
machine, you'll run out of steam before an empty string has grown to
length four.

>              And how would one make it only use 0-255 characters? Yours goes
> a lot furthur then 255.

It uses exactly 255 characters in each position.

Anno


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

Date: 18 May 2003 19:56:46 -0700
From: email_entropy123@yahoo.com (entropy123)
Subject: Help!: Error with 'Benchmark' module
Message-Id: <90cdce37.0305181856.6ecefee0@posting.google.com>

Hey all,

Just installed the latest version of Perl on a fresh install of Linux
(extra partition) and am attempting to learn how to use modules and
the like without all the hassles of a work admin...

Anyway I keep getting this error:

Benchmark: timing 10000 iterations of bruteforce, quadratic...
Undefined subroutine &main::forloop called at (eval 3) line 1 (#1)
    (F) The subroutine indicated hasn't been defined, or if it was, it
has
    since been undefined.

Uncaught exception from user code:
        Undefined subroutine &main::forloop called at (eval 3) line 1.
        Benchmark::__ANON__ called at
/usr/lib/perl5/5.8.0/Benchmark.pm line 535
        Benchmark::runloop(10000,'forloop(0, 1)') called at
/usr/lib/perl5/5.8.0/Benchmark.pm line 559       
Benchmark::timeit(10000,'forloop(0, 1)') called at
/usr/lib/perl5/5.8.0/Benchmark.pm line 659
        Benchmark::timethis(10000,'forloop(0, 1)','bruteforce','')
called at /usr/lib/perl5/5.8.0/Benchmark.pm line 709
        Benchmark::timethese(10000,'HASH(0x804c014)') called at
 ./spacetime.pl line 22
[root@localhost spacetime]# emacs spacetime.pl

I am pretty sure this is telling me that the 'Benchmark' module is not
installed. How do I tell which modules are actually installed? If I
don't have the 'Benchmark' routine then where do I get it? (The
routines on CPAN seem more specific than the one mentioned in the
'Algorithms with Perl' book I'm working through....

Thanks!

entropy


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

Date: Mon, 19 May 2003 13:18:43 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Help!: Error with 'Benchmark' module
Message-Id: <3ec84e1f$0$19048@echo-01.iinet.net.au>


"entropy123" <email_entropy123@yahoo.com> wrote in message
news:90cdce37.0305181856.6ecefee0@posting.google.com...
> Hey all,
>
> Just installed the latest version of Perl on a fresh install of Linux
> (extra partition) and am attempting to learn how to use modules and
> the like without all the hassles of a work admin...
>
> Anyway I keep getting this error:
>
> Benchmark: timing 10000 iterations of bruteforce, quadratic...
> Undefined subroutine &main::forloop called at (eval 3) line 1 (#1)
>     (F) The subroutine indicated hasn't been defined, or if it was, it
> has
>     since been undefined.
>
> Uncaught exception from user code:
>         Undefined subroutine &main::forloop called at (eval 3) line 1.
>         Benchmark::__ANON__ called at
> /usr/lib/perl5/5.8.0/Benchmark.pm line 535
>         Benchmark::runloop(10000,'forloop(0, 1)') called at
> /usr/lib/perl5/5.8.0/Benchmark.pm line 559
> Benchmark::timeit(10000,'forloop(0, 1)') called at
> /usr/lib/perl5/5.8.0/Benchmark.pm line 659
>         Benchmark::timethis(10000,'forloop(0, 1)','bruteforce','')
> called at /usr/lib/perl5/5.8.0/Benchmark.pm line 709
>         Benchmark::timethese(10000,'HASH(0x804c014)') called at
> ./spacetime.pl line 22
> [root@localhost spacetime]# emacs spacetime.pl
>
> I am pretty sure this is telling me that the 'Benchmark' module is not
> installed.

I am pretty sure it's not :-)
It's telling you that there's something wrong with the coding of your
script.

>How do I tell which modules are actually installed?

This works fine for me (lets me know which, of the specified modules, are
missing):

use strict;
use warnings;

my @mods = qw(Bogus::Rubbish Benchmark Archive::Zip);

for (@mods) {
    $_ =~ s/::/\//g;
    eval {require "$_.pm"};
    if ($@) {print $@}
    }
__END__




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

Date: Mon, 19 May 2003 04:59:18 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Help!: Error with 'Benchmark' module
Message-Id: <Xns93803CD57B033sdn.comcast@216.166.71.239>

email_entropy123@yahoo.com (entropy123) wrote in news:90cdce37.0305181856.6ecefee0@posting.google.com:

> Anyway I keep getting this error:

READ the error:


> Benchmark: timing 10000 iterations of bruteforce, quadratic...

Benchmark is running these two labelled functions of yours...


> Undefined subroutine &main::forloop called at (eval 3) line 1 (#1)

It can't find a subroutine called "forloop".


>     (F) The subroutine indicated hasn't been defined, or if it was, it has
>     since been undefined.

More details about why it might not be able to find "forloop".

 
> Uncaught exception from user code:

This is why it died.

>         Undefined subroutine &main::forloop called at (eval 3) line 1.

This is where it died.

>         Benchmark::__ANON__ called at /usr/lib/perl5/5.8.0/Benchmark.pm line 535
>         Benchmark::runloop(10000,'forloop(0, 1)') called at /usr/lib/perl5/5.8.0/Benchmark.pm line 559       
>         Benchmark::timeit(10000,'forloop(0, 1)') called at /usr/lib/perl5/5.8.0/Benchmark.pm line 659
>         Benchmark::timethis(10000,'forloop(0, 1)','bruteforce','') called at /usr/lib/perl5/5.8.0/Benchmark.pm line 709
>         Benchmark::timethese(10000,'HASH(0x804c014)') called at ./spacetime.pl line 22

This is a callback dump of where your program crashed.  Note that
most of these functions are in the Benchmark module. 


> [root@localhost spacetime]# emacs spacetime.pl

Good heavens, you aren't really doing development as root, are you??


> I am pretty sure this is telling me that the 'Benchmark' module is not
> installed. How do I tell which modules are actually installed? If I

Unless your program has code that prints out "Benchmark: timing 10000
iterations of..." and has subroutines called Benchmark::runloop, 
Benchmark::timeit, Benchmark::timethis, and Benchmark::timethese, I
strongly suspect that you do in fact have the Benchmark module installed.

-- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;



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

Date: Sun, 18 May 2003 20:43:14 -0500
From: Joe Creaney <mail@annuna.com>
Subject: Re: How do I pop this?
Message-Id: <3EC836B2.3050207@annuna.com>

Thanks alot! you answered my question, now it works perfectly.
I muissed that one in the book.

Sam Holden wrote:
> On Sun, 18 May 2003 18:41:29 -0500, Joe Creaney <mail@annuna.com> wrote:
> 
>>I am using a 2d array in an object with syntax like this:
>>$play->{bag}->[$drp][$loop+1]
>>
>>My problem is that I want to pop off the last element in the array.
>>Is there any way I can do that?
> 
> 
> pop @{$play->{bag}[$drp]}
> 
> or
> 
> pop @{$play->{bag}[$drp][$loop+1]}
> 
> depending on what you mean...
> 



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

Date: Sun, 18 May 2003 20:43:48 -0500
From: Joe Creaney <mail@annuna.com>
Subject: Re: How do I pop this?
Message-Id: <3EC836D4.7010507@annuna.com>

Thanks alot! It works perfecty.
Missed that one in the book.


Sam Holden wrote:
> On Sun, 18 May 2003 18:41:29 -0500, Joe Creaney <mail@annuna.com> wrote:
> 
>>I am using a 2d array in an object with syntax like this:
>>$play->{bag}->[$drp][$loop+1]
>>
>>My problem is that I want to pop off the last element in the array.
>>Is there any way I can do that?
> 
> 
> pop @{$play->{bag}[$drp]}
> 
> or
> 
> pop @{$play->{bag}[$drp][$loop+1]}
> 
> depending on what you mean...
> 



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

Date: Mon, 19 May 2003 01:27:44 GMT
From: "Travis" <dingdongy2k@hotmail.com>
Subject: Re: Losing value in require statement
Message-Id: <kqWxa.4772$Io.415218@newsread2.prod.itd.earthlink.net>

I repeated the
$now = localtime($t);
in the require statement and it is ok now.

I think using $main::now;  would have been ok too, but I didn't want to
change all of the variables.

Thanks
Travis

"Travis" <dingdongy2k@hotmail.com> wrote in message
news:c_pxa.1354$rO.177980@newsread1.prod.itd.earthlink.net...
> I use this to get the time in a perl script
>
> $t = time();
> ($sec,$min,$hour,$dom,$mon,$year,$wday,$yday,$isdst) = localtime($t);
> $now = localtime($t);
>
> I use a require statement after that to execute some other lines of code.
> (ex:  require 'otherlines.pl';)
>
> That has worked fine except that I seem to lose the value in  $now
> (ex:  Sat May 17 00:08:10 2003  )
>
> The rest of the code in the require statement is executed properly.
>
> So even after the require statement is executed , and printed blanks for
> $now, the main script can still print the value correctly.
>
> Any ideas?
>
> Travis
>
>
>




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

Date: 19 May 2003 09:35:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: mark-symlinked-directories
Message-Id: <baa8gl$k3u$2@mamenchi.zrz.TU-Berlin.DE>

Pons <pons@gmx.li> wrote in comp.lang.perl.misc:
> [root@Linux bin]# perl -MCPAN -e shell
> Undefined value assigned to typeglob at (eval 13) line 15, <RC> line 11.
> Warning [/etc/inputrc line 11]:
>   Invalid variable `mark-symlinked-directories'
> 
> cpan shell -- CPAN exploration and modules installation (v1.70)
> ReadLine support enabled

/etc/inputrc is a configuration file used by readline.  Apparently
it is corrupt.

Since the CPAN shell uses readline it makes sense that the error turns
up when CPAN is activated.

Anno


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

Date: Sun, 18 May 2003 21:15:45 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: multiple sort subroutine
Message-Id: <5fWxa.7754$7B6.85884@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Dave wrote:
>>This is untested, however should work, and is fairly clean and
>>non-clumsy: 
>>
>>sub seniority {
>>     my $res;
>>     foreach (qw(SALARY AGE LAST FIRST)) {
>>          if (/^\d+$/) {
>>               $res = $a->{$_} <=> $b->{$_};
>>          }
>>          else {
>>               $res = $a->{$_} cmp $b->{$_};
>>          }
>>          return $res if $res;
>>     }
>>     return 0;
>>}
 > Thanks for the quick response! Unfortunately, I'm still missing
 > something. The subroutine seniority needs to run through each
 > iteration. i don't know how to explain it, but this would work if I knew
 > which comparision to use:
 >
 >  sub seniority {
 >      $a->{$sort1}     <=>  $b->{$sort1}
 >      or $a->{sort2}     <=>  $b->{$sort2}
 >      or $a->{$sort3}    cmp  $b->{$sort3}
 >      or $a->{$sort4}   cmp  $b->{$sort4}
 >  }

Unless I misunderstood you a second time in a row, the sorting 
subroutine I posted should do what you asked for, which is sort based on 
salary, then age, then last, then first, with each sort being the 
correct alphabetical or numerical sort.

Have you tried my routine ? did it not work ? What did it do wrong ?

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+yDBEeS99pGMif6wRAkjIAJ0aPZq9NpFjen9Jr7faYE61LDKajwCgwjee
RSeUxBCeqgeBe59acEQQWJQ=
=jT1d
-----END PGP SIGNATURE-----



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

Date: Mon, 19 May 2003 02:12:46 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: multiple sort subroutine
Message-Id: <3EC83CC8.3000301@rochester.rr.com>

Vilmos Soti wrote:

> tadmc@augustmail.com (Tad McClellan) writes:
> 
> 
>>>    $a->{"$sort1"}  <=>  $b->{"$sort1"}
>>>
>>A useless use of double quotes:
>>
>>   $a->{$sort1}  <=>  $b->{$sort1}
>>
> 
> Could you elaborate why the double quotes are useless there? I


Well, $a->{"$sort"} is exactly the same as $a->{$sort}, so why waste the 
keystrokes?  I suppose the interpreter might possibly go through a few 
more gyrations in terms of interpolating the quoted string, also, but if 
you're that interested in speed you should probably be using C or 
assembler.  Since the quotes serve no purpose in this case, they are 
useless.


> also don't use double quotes in such circumstances, but I saw way
> too many codes that do use them and sometimes I felt that I am
> the one who is wrong.


I really don't think it is so much "right" and "wrong" as it is personal 
preference.  Either way works, and if you have many other instances of 
interpolated quoted hash keys in which the interpolation is needed in 
your program, it might look prettier if even the instances where 
interpolation is not needed followed the same look.  Just be sure not to 
use apostrophes, as $a->{'$sort'} is in general entirely different 
(well, $sort could have the value '$sort', I guess).


 ....


> Thanks, Vilmos
 ...

-- 
Bob Walton



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

Date: Sun, 18 May 2003 22:41:04 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: multiple sort subroutine
Message-Id: <3EC8443F.4F857E72@hotpop.com>

Tad McClellan wrote:
[snip]
>    # untested, and likely to run very slowly
>    sub is_num { $_[0] =~ /^\d+$/ }
> 
>    sub seniority {
>        (is_num($a->{SALARY}) && is_num($b->{SALARY}))
>          ?  $a->{SALARY}     <=>  $b->{SALARY}
>          :  $a->{SALARY}     cmp  $b->{SALARY}
>        or (is_num($a->{AGE}) && is_num($b->{AGE}))
>          ?  $a->{AGE}     <=>  $b->{AGE}
>          :  $a->{AGE}     cmp  $b->{AGE}
> 
>        ...
>    }

One can avoid doing the repeated is_num() calls inside of the sortsub by
doing a bit of precomputation, which should immensly speed it up:

   sub is_num { $_[0] =~ /^\d+$/ }

   # You can use any list of keys here --
   # any length list is acceptable.
   my @keys = qw(SALARY AGE LAST FIRST);

   # Assume everything is numeric, until
   # we discover otherwise.
   my %is_num = map {;$_ => 1;} @keys;

   # If all elements of column $key are numeric,
   # then we will do numeric comparisons on that
   # column.  If even one element is non-numeric,
   # then we will do lexigraphical comparisons on
   # it.
   for my $elt (@data) {
      for my $key (@keys) {
         $is_num{$key} &&= is_num($elt->{$key});
      }
   }

   # Here's the sorting subroutine:
   my $seniority = sub {
      for my $key (@keys) {
         my $cmp = $is_num{$key} ?
            $a->{$key} <=> $b->{$key} :
            $a->{$key} cmp $b->{$key};
         return $cmp if $cmp;
      }
      0;
   };

   my @sorted = sort &$seniority @unsorted;

[untested]

To make it go even faster, the loop in the sortsub could be unrolled, by
building up a string containing the code for a subroutine, and eval()ing
it.

   # Here's a possible alternative way of doing that:
   my $seniority_str = qq[sub {\n\t];
   for my $key (@keys) {
      $seniority_str .= qq[\$a->{q[\Q$key\E]}];
      $seniority_str .= $is_num{$key} ? " <=> " : " cmp ";
      $seniority_str .= qq[\$b->{q[\Q$key\E]} or\n\t];
   }
   $seniority_str .= "0;\n}\n";
   my $seniority = eval $seniority_str or
      die "Error eval()ing string q[$seniority_str]: $@";

[untested]

Note that I can't say for certain that this is faster, since I haven't
benchmarked it.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: 19 May 2003 08:45:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Need a Perl script (ping IP address)
Message-Id: <baa5k2$k3u$1@mamenchi.zrz.TU-Berlin.DE>

dlcurrell <dlcurrell@yahoo.com> wrote in comp.lang.perl.misc:
> I need a perl script before I have the luxury of learning perl - I
> hope someone can help me and I thank you. Here's the situation:
> 
> My organization uses Tivoli Storage Manager as backup software. We
> also use a TSM monitoring tool called Servergraph. Servergraph can
> trigger an action based on what it sees in the TSM Activity log. I
> would like to stop remote clients from backing up over the WAN by
> pinging the IP address when a session is started with the server and
> if the ping exceeds 20ms, instruct Servergraph to kill the session.

You should post this in a job-brokering newsgroup.  It doesn't
look like a spare-time project.

> One major problem is that I don't know how to isolate the IP address
> string from the message.
> 
> Everytime a session is commenced, a message is generated in the TSM
> Activity log that is in this format:
> 
> ANR0406I Session session number started for node node name (client
> platform) (communication method communication address).
> 
> An example:
> 
> 05-05-2003 10:26:32 ANR0406I Session 245362 started for node
> ESTAPPLS0009804(WinNT) (Tcp/Ip 10.176.3.31 (43321)).

Here's a freebie:

    my ( $ip_addr) = m|Tcp/Ip ([.\d]+)|;

Anno


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

Date: Mon, 19 May 2003 09:41:56 GMT
From: emcee <res1uzbe@verizon.net>
Subject: Paths relative to a module
Message-Id: <EF1ya.22950$Hy3.22279@nwrddc02.gnilink.net>

I have a module that, more or less, takes the contents of a hash and 
puts into a file. It works fine, but I want it to save the file relative 
to the location of the module rather than the script, is there anyway to 
do this?



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

Date: 19 May 2003 02:17:05 -0700
From: prakashpms@hotmail.com (Prakash)
Subject: Perl 5.8 memory leak while using shared variables
Message-Id: <afc6e663.0305190117.7b4420e@posting.google.com>

I am writing a threaded application using perl 5.8. I am having a
shared array which shared between the threads. While using shared
array, it results in memory leaks. Seems like this is a known problem.
I saw from the newsgroup that Elizabeth   Mattijsen had faced the same
problem and could workaround the problem by rewriting a new module
Forks.pm which emulates threads. But, we are looking at offical patch
release kind of stuff. Is there any patch or workarcound for this?

Thanks
Best Regards
Prakash


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

Date: Mon, 19 May 2003 10:58:08 +0200
From: "Steinar Kjærnsrød" <kjaernsr@online.no>
Subject: Perl based shopping cart - does anyone have a recommendation?
Message-Id: <G01ya.13564$8g5.213590@news2.e.nsc.no>

While it might be fun to reinvent this wheel, I don't have the time, and was
wondering if anyone has recommendations on Perl based shopping
carts/shopping systems? My problem is certainly not that I can't find any,
but rather the opposite! There seem to be lots of such systems around and
it's difficult to get a grasp on the pros and cons by just reading the
announcements and basic documentation.

The system I'm looking for need not be freeware/GPL based, but should
preferrably cost no more than ~300-600$.

I'm not looking for fully fledged e-commerce systems/application servers.
The system/modules/scripts should as a minimum offer/implement this:

+ easy to interface to a product database/inventory, preferrably through DBI
or through generic interfaces
+ the same goes for the customer database
+ stateful shopping basket, tracking the customers shopping in each session
(client side code OK, i.e. Javascript ++). The shopping basket should allow
for easy adding and removal of items, changing the number of items, checkout
etc
+ HTML (Javascript ok) based GUI through templates, preferrably through the
Template TK

Any hints, tips and experiences with such software will be appreciated.
Thanks in advance,

--
Steinar Kjærnsrød kjaernsr@online.no




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

Date: Mon, 19 May 2003 01:38:51 GMT
From: "Travis" <dingdongy2k@hotmail.com>
Subject: Re: perl to c
Message-Id: <LAWxa.4798$Io.416513@newsread2.prod.itd.earthlink.net>

Will perlcompile work with perl scripts that have require statements?

If it does, then is there a way to work with
dynamicically called require statements or do statements?

Travis

"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3EC6D5C6.2060008@rochester.rr.com...
> adams wrote:
>
> > I would like to write a perl program as a prototype for a program that i
> > would eventually write in c
> > in what way i need to  alter when  i write the perl prototype
> >
> > and do perl have any feature has any feature i can use to ease the
process
> ...
>
> Check out:
>
>     perldoc perlcompile
>
> particularly the sections on "The Simple C Back End" and "The Optimized
> C Back End".  Those will write your Perl program in C for you.
>
> -- 
> Bob Walton
>
>




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

Date: Mon, 19 May 2003 01:47:04 GMT
From: "Travis" <dingdongy2k@hotmail.com>
Subject: perl to FTP ?
Message-Id: <sIWxa.4820$Io.417654@newsread2.prod.itd.earthlink.net>

Is there a way to use perl to allow a script to ftp images to the server?

Travis




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

Date: Mon, 19 May 2003 02:16:11 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: perl to FTP ?
Message-Id: <3EC83D95.6000103@rochester.rr.com>

Travis wrote:

> Is there a way to use perl to allow a script to ftp images to the server?
> 
> Travis
 ... 

Yes:

     use Net::FTP;

-- 
Bob Walton



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

Date: 19 May 2003 05:50:04 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: PHP or Perl ?
Message-Id: <ba9rac$5qp$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Dieter D'Hoker:

> "Dieter D'Hoker" <webmaster@neverseenbefore.com> wrote in message
> news:3ec6c663$0$49117$e4fe514c@news.xs4all.nl...
>> How would you advice someone who wants to start learning a programmign
>> language for developping websites ?
>> learning PHP or Perl ?
>>
>> Or maybe somethign else like Coldfusion , or java servlets , Python ?
>>
>> and why ?
> 
> Want I didn't hear yet is the support on webservers ,
> and the future of the language ,
> if you are looking for hosting ,
> has it a geater chance of supporting PHP/perl ...

There is a slight bias towards PHP on webhosts perhaps. Most of them
however have at least both of them.

> And what do you think hosts will support in the future ?

Such developments are hard to anticipate. A while back it looked as
though Tcl would be on its decay. And suddenly there seemed to be a
revival of this language when no one expected it. When it comes to
future, most bets are off.

> Is it true that Perl is an old language , was popular , is popular ,  but is
> a little bit dying now ?

Perl1 was introduced in 1987 so, yes, it is quite old. The most recent
version is 5.8.0 and there's not much that this version and 1.0 share
with each other. Perl6 is on its way and will eventually be a major
rewrite. 

The infrastructure that has evolved around Perl suggests that it is not
going to die anywhere soon. With the development of Perl5 things have
changed as to where Perl is used. It becomes less and less a
web-language in the perception of users but instead something that can
be employed almost everywhere. This was not yet the case with Perl4.
Perl6 will be another shift into this direction.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 19 May 2003 08:42:18 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: possible bug in m// ?
Message-Id: <slrnbch67a.5nv.vek@station02.ohout.pharmapartners.nl>

On 17 May 2003 10:42:50 GMT,
    Abigail <abigail@abigail.nl> wrote:


>Sara (genericax@hotmail.com) wrote on MMMDXLVI September MCMXCIII in
><URL:news:776e0325.0305162036.703542e2@posting.google.com>:
>;;  Abigail <abigail@abigail.nl> wrote in message news:<slrnbcb8lp.mth.abigail@alexandra.abigail.nl>...
>;; > dan baker (botfood@yahoo.com) wrote on MMMDXLV September MCMXCIII in
>;; > <URL:news:13685ef8.0305161231.2c4bae1d@posting.google.com>:
>;; > ;;  I am attempting to catch illegal formats for zip codes, and think I
>;; > ;;  have a bug in the "exact number of times" part of regex. the snippet
>;; > ;;  is:
>;; > ;;  
>;; > ;;  	unless ( ($MemberZip =~ m/\d{5}/) or ($MemberZip =~ m/\d{5}\-\d{
>;; > ;;  {
>;; > ;;  	$FormErrorMsg .= " \n<li> Zip must be either 5 digit, or 5+4 for
>;; > ;;  }
>;; > ;;  
>;; > ;;  What is happening is that values with more than 5 digits are passing
>;; > ;;  right thru without getting caught. Am I doing something wrong with
>;; > ;;  regex or is this a bug? Running perl 5.00503 from activestate on
>;; > ;;  windows98.
>;; > 
>;; > 
>;; > Your perception is wrong.  /\d{5}/ will match any string that contains
>;; > 5 digits in a row. A string consisting of 6 digits will contain 5 in 
>;; > a row, and hence it matches. If you want to match exactly 5 digits,
>;; > use anchors: /^\d{5}$/.
>;; > 
>;; > For zip codes, you could also use Regexp::Common:
>;; > 
>;; >     use Regexp::Common qw /zip/;
>;; > 
>;; >     unless ($MemberZip =~ /^$RE{zip}{US}$/) {
>;; >         ....
>;; >     }
>;; > 
>;; > 
>;; > Abigail
>;;  
>;;  not exactly- a12345 matches what he wants but fails your test.
>
>
>I didn't get the impression 'a12345' is ok (why would that be ok, when
>replacing the 'a' with '6' suddenly makes it wrong?).
>
>;;   /\D?\d{5}\D?/ might be more universal?
>
>
>    $ perl -wle 'print "Nope" if "123456" =~ /\D?\d{5}\D?/'
>    Nope
>
>You'd need to use something like /(?:^|\D)\d{1,5}(?:\D|$)/.
>

Besides, the non-digit would normaly be some whitespace, perhaps
punctuation for the sequence to be a valid US zipcode.  That means
that the start and end of the zipcode must be a word boundary.


Villy


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

Date: Mon, 19 May 2003 08:15:18 +0200
From: "Steffen Beyer" <steffen.beyer@de.bosch.com>
Subject: Re: ReadLine with timeout
Message-Id: <ba9spn$ohn$1@ns2.fe.internet.bosch.com>

"Da.Ta." <dt_spam@arcor.de> wrote in message =
news:slrnbccke3.47.dt_spam@snickers.dahoam...
> Sven K=F6hler wrote:
> > hi,
> >=20
> > i badly need a ReadLine-funtion that returns within a given timeout. =

> > Does anybody know such a module? or any way to do this?
>=20
> Try something like this:
>=20
> #!/usr/bin/perl
>=20
> use Term::ReadLine;
>=20
> $t =3D new Term::ReadLine 'timeout test';
>=20
> eval {
>   local $SIG{ALRM} =3D sub { die("timeout\n") };
>   alarm 10;
>   $input =3D $t->readline("Enter something within 10 seconds: ");
>   alarm 0;
> };
>=20
> print(($@=3D~/timeout/) ? "\nYou loose!\n"
>                       : "You win: $input\n");
> __END__
>=20
> perldoc -f eval
> perldoc -f alarm
>=20
> bye,
> Da.Ta

Doesn't work under Win32, though.

Ciao,
Steffen Beyer



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

Date: Mon, 19 May 2003 12:42:49 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Why causes the "format error" when using Archive::Zip?
Message-Id: <3ec845b5$0$19053@echo-01.iinet.net.au>


"niudou" <niudou@hotmail.com> wrote in message
news:324590c7.0305181658.3a547388@posting.google.com...
> Thanks, Rob!
>
> But what's your meaning for "the valid zip file"? Is there any
> standard?

I'm sure there is, but I don't know much more than that :-)
If Archive::Zip can read() it, I would assume it's a valid zip file. If
Archive::Zip can't read() it I would asume it's *not* a valid zip file.

>After reading the source code of zip.pm, I think if I want
> to unzip a zip file by Archive::Zip, I should firstly zip a file or
> files into a "valid" zip file also by Archive::Zip. My understanding
> is right?

No, Archive::Zip should be able to read any "valid" zip file.
The one I tested your code on was libwin32-0.191.zip from cpan.

Where can we find the one you are trying to read() ?

Do you have a zip utility that *can* unzip it ?

If it's one you've built yourself (or even if it's not), then perhaps the
problem is that it has not been constructed properly.

Cheers,
Rob




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

Date: 18 May 2003 23:02:32 -0700
From: niudou@hotmail.com (niudou)
Subject: Re: Why causes the "format error" when using Archive::Zip?
Message-Id: <324590c7.0305182202.69d63ea8@posting.google.com>

"Sisyphus" <kalinabears@hdc.com.au> wrote in message news:<3ec845b5$0$19053@echo-01.iinet.net.au>...
> 
> No, Archive::Zip should be able to read any "valid" zip file.
> The one I tested your code on was libwin32-0.191.zip from cpan.
> 
> Where can we find the one you are trying to read() ?
> 
> Do you have a zip utility that *can* unzip it ?
> 
> If it's one you've built yourself (or even if it's not), then perhaps the
> problem is that it has not been constructed properly.
> 
> Cheers,
> Rob

Hi, Rob!

I got it with your help.

The "not valid" zipfile is created by WINRAR which will cause that
format problem. I try another "valid" zipfile created by WINZIP, it's
OK.

Thanks again for your help!


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

Date: 18 May 2003 23:10:18 -0700
From: niudou@hotmail.com (niudou)
Subject: Re: Why causes the "format error" when using Archive::Zip?
Message-Id: <324590c7.0305182210.5c82c40b@posting.google.com>

"Sisyphus" <kalinabears@hdc.com.au> wrote in message news:<3ec845b5$0$19053@echo-01.iinet.net.au>...
> 
> No, Archive::Zip should be able to read any "valid" zip file.
> The one I tested your code on was libwin32-0.191.zip from cpan.
> 
> Where can we find the one you are trying to read() ?
> 
> Do you have a zip utility that *can* unzip it ?
> 
> If it's one you've built yourself (or even if it's not), then perhaps the
> problem is that it has not been constructed properly.
> 
> Cheers,
> Rob

Rob,

I got it with your help.

The "not valid" zipfile is created by WINRAR which causes that format
problem. I try a "valid" zipfile created by WINZIP, it's OK then.

Thanks again for your help!


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

Date: Mon, 19 May 2003 08:22:04 +0200
From: "Steffen Beyer" <steffen.beyer@de.bosch.com>
Subject: Re: why key is added to hash after defined ?
Message-Id: <ba9t6d$ot6$1@ns2.fe.internet.bosch.com>


"Matija Papec" <mpapec@yahoo.com> wrote in message =
news:or4dcvgb2eqo1atq9povmoe05956fmeuv6@4ax.com...
> veky@cromath.math.hr (Veky) wrote:
> >|It prints foo1 as key.
> >|What I want to do is just check if $hash{foo1}{foo2}, which should =
be a
> >|string has already been defined. But why it add a key in %hash ?
> >|So what's the proper way of checking undef if I don't want to add =
any extra
> >|key ?
> >
> >Test for  defined $hash{foo1} && defined $hash{foo1}{foo2} ...
> >this way, if there is no foo1 key in hash, short-circuiting of "&&" =
will
>                        ^^^^^^^^^^^^^^^^^^^
>=20
> Actually 'exists' does that, although defined is just fine most of the =
time.

Actually "exists" doesn't save you from autovivification (at least not =
on
my system, using Perl 5.8.0).

You should test

if (exists $hash{foo1} and exists $hash{foo1}{foo2}) { ... }

HTH.
Steffen



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

Date: Mon, 19 May 2003 10:03:08 GMT
From: "Ryan & Treena Carrier" <ryanc@nci1.net>
Subject: win32 perl installation perl mans?
Message-Id: <ac1c94bd16ceabec96638efbdbe77bde@TeraNews>

I'm running ActiveState's perl engine.  When a module is not available
through ppm, and I get it from CPAN, I install using the perl Makefile.PL,
nmake, nmake test, nmake install method.  Is there a way (from the command
line, maybe?) to get to the man pages (pods)?  When a module is installed
through ppm, it automagically installs the man pages within the
'documentation' web page.




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

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


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