[17148] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4560 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 9 09:10:24 2000

Date: Mon, 9 Oct 2000 06:10:13 -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: <971097013-v9-i4560@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 9 Oct 2000     Volume: 9 Number: 4560

Today's topics:
        PerlEx experience <ubl@schaffhausen.de>
    Re: PP, 3rd ed.??? mexicanmeatballs@my-deja.com
        processing a file several times <haf@autra.noXX>
    Re: processing a file several times (Clay Irving)
    Re: processing a file several times (Denis Joiret)
        SOCKS Server <petters@cns.mpg.de>
    Re: SOCKS Server (Martien Verbruggen)
    Re: string substitution <anders@wall.alweb.dk>
    Re: string substitution (Clay Irving)
    Re: Thanks, I see the (Villy Kruse)
        Totally confused <johnno@nospam.casebook.org>
    Re: Totally confused <tony-news@develop-help.com>
    Re: Totally confused <johnno@nospam.casebook.org>
    Re: Totally confused <bmb@ginger.libs.uga.edu>
    Re: variable problems <bugfixxer@yahoo.com>
        webspace for testing purposes? <tigz@ntlworld.com>
    Re: webspace for testing purposes? <ymeydotcom@hotmail.com>
    Re: Where can I find more information of perldoc HTML:: <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 09 Oct 2000 09:57:36 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: PerlEx experience
Message-Id: <39E17A6F.D8BB85AF@schaffhausen.de>

Hi,

I recently found ActiveStates's PerlEx on their website and I was
wondering
if anybody here has any experience with it's performance?
They say it would be 45 times faster than simple CGI and 2 to 30 times
faster
than any other of the web server's own api like I assume mod_perl. I
guess
those extreme numbers (30 and 45) are only true if one loads all the
standard
libraries plus half of cpan's stock into memory, but even 2 times of
fast would.
be a real advancement and certainly worth the price they charge for it
(ca. $400)

Later,

malte



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

Date: Mon, 09 Oct 2000 10:38:21 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: PP, 3rd ed.???
Message-Id: <8rs76t$ltn$1@nnrp1.deja.com>

In article <39E0B2F1.B2DD92D5@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote maliciously:
> David Steuber wrote:
> > Elaine Ashton <elaine@chaos.wustl.edu> writes:
> >  Godzilla! wrote:
> > ' > I show no mercy for those who deliberately steal a
> > ' > bit of my life to satiate their malice intent.
> > ' Oh! The Irony! LOL.
> > Isn't 'malice' a noun?  Oh, but I forget.  We in the computer
business
> > turn nouns into verbs or adjectives all day long.  That's what we
do.
> > No malice intended, 'Godzilla'. ;-)
> Right. You are a lying pile of mule manure.
> Malice is usually considered a noun. Intent is an adjective,
> intently is an adverb and, if such a word, intenting would
> be a gerund. Intent is also a noun as is intentness.
> Would you have me say "intent malice" ?

'... satiate their malicious intent'
Although, malice is all about intent anyway, so
simply 'malice' would probably be more correct.

http://www.merriam-webster.com/cgi-bin/dictionary?book=Dictionary&va=malice

--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'


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


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

Date: Mon, 09 Oct 2000 13:33:45 +0200
From: "P.Eftevik" <haf@autra.noXX>
Subject: processing a file several times
Message-Id: <39E1AD18.4771529B@autra.noXX>

I'm processing a file with

open myfile;
while (< myfile >)  {}

If I want to process the file once more from the start:  How do  I
"rewind"
the file pointer ?  ( I know that another 'open' statement will work,
but guess
it's slow ..... (?)  ).

PEftie
Navia Kongsberg




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

Date: 9 Oct 2000 12:16:40 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: processing a file several times
Message-Id: <slrn8u3dp8.jk8.clay@panix3.panix.com>

On Mon, 09 Oct 2000 13:33:45 +0200, P.Eftevik <haf@autra.noXX> wrote:

>I'm processing a file with
>
>open myfile;
>while (< myfile >)  {}
>
>If I want to process the file once more from the start:  How do  I
>"rewind"
>the file pointer ?  ( I know that another 'open' statement will work,
>but guess
>it's slow ..... (?)  ).

Do you want to loop?

  open MYFILE, "myfile" or die "Can not open myfile: $!\n:
  $count = 0;
  
  until ($count == 2) {
      while (<MYFILE>) {
          print "processing myfile...\n";
      }
      $count++;
  }

-- 
Clay Irving <clay@panix.com>
If you saw a heat wave, would you wave back?  
- Steven Wright 


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

Date: 9 Oct 2000 12:06:50 GMT
From: joiret@crow.inria.fr (Denis Joiret)
Subject: Re: processing a file several times
Message-Id: <8rsccq$eub$1@ites.inria.fr>

In article <39E1AD18.4771529B@autra.noXX>, "P.Eftevik" <haf@autra.noXX> writes:
|> I'm processing a file with
|> 
|> open myfile;
|> while (< myfile >)  {}
|> 
|> If I want to process the file once more from the start:  How do  I
|> "rewind"
|> the file pointer ?  ( I know that another 'open' statement will work,
|> but guess
|> it's slow ..... (?)  ).

I don't know if open is slow, but here is one method to do what you want
without re-opening the file:

open myfile;
while (not_finished) {
    while(<myfile>) {}
    # the next instruction rewinds to the beginning of the file
    seek myfile, 0, 0;
}


|> 
|> PEftie
|> Navia Kongsberg
|> 
|> 

-- 
                                      Denis Joiret
                                      Administrateur Reseaux INRIA-Rocquencourt

Email: Denis.Joiret@INRIA.Fr
Phone: +33 1 39 63 53 82     Fax: +33 1 39 63 55 96


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

Date: Mon, 09 Oct 2000 12:18:32 +0200
From: Jeannot Petters <petters@cns.mpg.de>
Subject: SOCKS Server
Message-Id: <39E19B78.16752F84@cns.mpg.de>

Hello,

How can I get Perl(http,ftp...) working with a SOCKS
Server(Proxy/Firewall).

Thanks
Jeannot


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

Date: Mon, 9 Oct 2000 21:15:56 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: SOCKS Server
Message-Id: <slrn8u36ms.2tj.mgjv@martien.heliotrope.home>

On Mon, 09 Oct 2000 12:18:32 +0200,
	Jeannot Petters <petters@cns.mpg.de> wrote:
> Hello,
> 
> How can I get Perl(http,ftp...) working with a SOCKS
> Server(Proxy/Firewall).

What I sometimes do, if I don't have a socksified perl around:

# runsocks perl script

It depends on your setup, and your socks client. And yes, you do need a
socks client library. Socks (clients) work through the capture of all
socket related calls, replacing them with calls that forward to the
server.

That said, you can have a look at Net::SOCKS, which is available from
CPAN to see if that helps. Never used it myself.

http://www.cpan.org/
http://search.cpan.org/

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | You can't have everything, where
Commercial Dynamics Pty. Ltd.   | would you put it?
NSW, Australia                  | 


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

Date: Mon, 9 Oct 2000 13:44:22 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: string substitution
Message-Id: <jdiE5.7029$u23.192085@news000.worldonline.dk>

Cameron Elliott wrote:

> |
> | it would be easier to do this with some sample input :)
> 
> well this is what I am dealing with (RTF)

So, you go to http://search.cpan.org and look for RTF...

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: 9 Oct 2000 12:17:33 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: string substitution
Message-Id: <slrn8u3dqt.jk8.clay@panix3.panix.com>

On Mon, 9 Oct 2000 13:44:22 +0200, Anders Lund <anders@wall.alweb.dk> wrote:

>> |
>> | it would be easier to do this with some sample input :)
>> 
>> well this is what I am dealing with (RTF)
>
>So, you go to http://search.cpan.org and look for RTF...

In other words, RTFM? :)

-- 
Clay Irving <clay@panix.com>
Whosoever is delighted in solitude is either a wild beast or a god. 
- Francis Bacon 


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

Date: 9 Oct 2000 09:08:10 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Thanks, I see the
Message-Id: <slrn8u32nq.bmi.vek@pharmnl.ohout.pharmapartners.nl>

On Sun, 08 Oct 2000 15:56:33 GMT, harry@drej.com <harry@drej.com> wrote:

>
>I see that my lousy IBM 4029 omitted a verticle bar, I was
>looking at the printout. Looking at the file instead I see it should be:
>
>$|++;
>



Remember the discussion a while back wheter you should prefer

    $| = 1; 

to 

    $|++;



Villy


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

Date: Mon, 9 Oct 2000 23:15:06 +1000
From: "Johnno" <johnno@nospam.casebook.org>
Subject: Totally confused
Message-Id: <39e1b734$0$11611$7f31c96c@news01.syd.optusnet.com.au>

I am having a hell of a frustrating time trying to work out why some code
I've written to do a very simple task fails.

Can anyone tell me why I always get a "Use of uninitialized value at test.pl
line 14." when running this script?

#!/usr/bin/perl -w
use strict;
my $dir = '/tmp';
my @files = ();
opendir(I, $dir) or die("Could not open $dir: $!");
while(my $file = readdir(I)) {
    if($file =~ /(.gif|.jpg)$/) {
        push(@files, $file);
    }
}
closedir(I);
foreach(@files) {
    my $size = (stat($_))[7];
    print "$size\n"; # This never works!  :-(
    # print "$_\n"; # This does work (when uncommented)!
}

Why is it failing when trying to print $size?

My frustration is compounded further by the fact that I *know* the filenames
are being successfully pushed into my array, and moreso by the fact that
printing $size works when I hardcode the array with a bunch of filenames!

What on Earth is going on?

:-(





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

Date: Mon, 09 Oct 2000 23:59:24 +1100
From: Tony Cook <tony-news@develop-help.com>
Subject: Re: Totally confused
Message-Id: <39E1C12C.4DF9792D@develop-help.com>

Johnno wrote:
> 
> I am having a hell of a frustrating time trying to work out why some code
> I've written to do a very simple task fails.
> 
> Can anyone tell me why I always get a "Use of uninitialized value at test.pl
> line 14." when running this script?
> 
> #!/usr/bin/perl -w
> use strict;
> my $dir = '/tmp';
> my @files = ();
> opendir(I, $dir) or die("Could not open $dir: $!");
> while(my $file = readdir(I)) {
>     if($file =~ /(.gif|.jpg)$/) {
>         push(@files, $file);
>     }
> }
> closedir(I);
> foreach(@files) {
>     my $size = (stat($_))[7];
>     print "$size\n"; # This never works!  :-(
>     # print "$_\n"; # This does work (when uncommented)!
> }
> 
> Why is it failing when trying to print $size?

readdir() returns _only_ the filename - it does not return the complete
path to the file.

e.g. readdir() might return 'foo.gif' - it won't return '/tmp/foo.gif'.

If you want this to work you will need to construct the complete
filename yourself.

Note that $file =~ /(.gif|.jpg)$/ will match 'foogif', which I suspect
isn't by design.

Tony Cook


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

Date: Mon, 9 Oct 2000 23:40:43 +1000
From: "Johnno" <johnno@nospam.casebook.org>
Subject: Re: Totally confused
Message-Id: <39e1bd35$0$11614$7f31c96c@news01.syd.optusnet.com.au>

> > Can anyone tell me why I always get a "Use of uninitialized
> > value at test.pl line 14." when running this script?
> >
> > #!/usr/bin/perl -w
> > use strict;
> > my $dir = '/tmp';
> > my @files = ();
> > opendir(I, $dir) or die("Could not open $dir: $!");
> > while(my $file = readdir(I)) {
> >     if($file =~ /(.gif|.jpg)$/) {
> >         push(@files, $file);
> >     }
> > }
> > closedir(I);
> > foreach(@files) {
> >     my $size = (stat($_))[7];
> >     print "$size\n"; # This never works!  :-(
> >     # print "$_\n"; # This does work (when uncommented)!
> > }
> >
> > Why is it failing when trying to print $size?
>
> readdir() returns _only_ the filename - it does not return the complete
> path to the file.

Ah!  A very simple mistake.  And a very simple fix:

my $size = (stat("$dir/$_"))[7];

Thanks for the quick response.

> Note that $file =~ /(.gif|.jpg)$/ will match 'foogif', which I suspect
> isn't by design.

Yep, escaping those periods in the regex fixes that.

--
Johnno (johnno@nospam.casebook.org)
http://johnno.casebook.org




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

Date: Mon, 9 Oct 2000 08:46:39 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Totally confused
Message-Id: <Pine.A41.4.21.0010090845270.11514-100000@ginger.libs.uga.edu>

On Mon, 9 Oct 2000, Johnno wrote:

> I am having a hell of a frustrating time trying to work out why some code
> I've written to do a very simple task fails.
> 
> Can anyone tell me why I always get a "Use of uninitialized value at test.pl
> line 14." when running this script?
> 
> #!/usr/bin/perl -w
> use strict;
> my $dir = '/tmp';
> my @files = ();
> opendir(I, $dir) or die("Could not open $dir: $!");
> while(my $file = readdir(I)) {
>     if($file =~ /(.gif|.jpg)$/) {
>         push(@files, $file);
>     }
> }
> closedir(I);
> foreach(@files) {
>     my $size = (stat($_))[7];
>     print "$size\n"; # This never works!  :-(
>     # print "$_\n"; # This does work (when uncommented)!
> }
> 
> Why is it failing when trying to print $size?
> 
> My frustration is compounded further by the fact that I *know* the filenames
> are being successfully pushed into my array, and moreso by the fact that
> printing $size works when I hardcode the array with a bunch of filenames!
> 
> What on Earth is going on?
> 
> :-(


readdir doesn't give you the directory name with the filename, so you have
to put it there yourself:

    14      my $size = (stat("/tmp/$_"))[7];

Brad



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

Date: Mon, 9 Oct 2000 11:04:58 +0400
From: "Andrew Tkachenko" <bugfixxer@yahoo.com>
Subject: Re: variable problems
Message-Id: <8rrra2$6lp$1@arcom.rcom.spb.su>

As I understood you want to pass user throw some steps filling forms.
1. You may save parameters in a temp file
    - just printing it one by one, or
   -  using CGI module (look at CGI.pm documentation) -
        $query = new CGI;
        $query->save(FILEHANDLE);
2. you may pass parameters from previous page to next one as a hidden
fields:
    use CGI;
    $co = new CGI;
    for (@$co->param) { print $co->hidden ($_, $co->param($_))  }

IMHO, no need to use anything except Perl :-))

<j2lab@my-deja.com> ÐÉÛÅÔ × ÓÏÏÂÝÅÎÉÉ:8rrflu$4u2$1@nnrp1.deja.com...
> I'm new at perl and I'm having some problems with variables.
> Currently, I have a form that accepts your information and then opens
> up a new page.  When an item is selected on this page, I want the
> information from the first form to be used for my variables in the new
> page.
>
> I have got this to work when I keep everything on one page.  The
> problem is I don't want people to have to scroll down.  Is this
> possible?  Would this be easier to do in java?
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Mon, 9 Oct 2000 12:05:17 +0100
From: "Tigz®" <tigz@ntlworld.com>
Subject: webspace for testing purposes?
Message-Id: <7EhE5.22588$uq5.468782@news6-win.server.ntlworld.com>

Just recently my server has decided to go to sleep after a few uploads and
resuses to work for days.
So i am looking for some free webspace with perl support, i dont care what
the domain is, as i only need it for testing scripts.

anyone help?

thankx
mick




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

Date: Mon, 09 Oct 2000 07:58:48 -0400
From: YMEY <ymeydotcom@hotmail.com>
Subject: Re: webspace for testing purposes?
Message-Id: <39E1B2F8.6D082552@hotmail.com>

"Tigz®" wrote:
> 
> Just recently my server has decided to go to sleep after a few uploads and
> resuses to work for days.
> So i am looking for some free webspace with perl support, i dont care what
> the domain is, as i only need it for testing scripts.
> 
> anyone help?
> 
> thankx
> mick

http://www.virtualave.net


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

Date: Mon, 09 Oct 2000 08:01:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Where can I find more information of perldoc HTML::Parser?
Message-Id: <mnu2us08il848r4avpeoiv70e1rb808f85@4ax.com>

Carfield Yim wrote:

>After I read the perldoc of HTML::Parser, I still not get how to use
>this package, and my testing code don't work at all. Can anyone tell me
>where can I find more information of using HTML::Parser?

Perhaps take a look at HTML::TokeParser. That is HTML::Parser turned
inside out, with an interface that works in the same way like we
ordinarily get data out of files.

-- 
	Bart.


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

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


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