[19616] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1811 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 25 09:05:33 2001

Date: Tue, 25 Sep 2001 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001423109-v10-i1811@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Sep 2001     Volume: 10 Number: 1811

Today's topics:
    Re: [ASK[ Perl and Windows <skj@iobox.fi>
    Re: command line file operations (Anno Siegel)
    Re: command line file operations <tintin@snowy.calculus>
    Re: Dump raw data <please@no.spam>
    Re: Getting NULLS after a lockup from using up memory (Anno Siegel)
    Re: Goto and global variables (Anno Siegel)
        Handling two lines (David Djajaputra)
    Re: Handling two lines <Thomas@Baetzler.de>
    Re: Help with reading web page from socket. <flavell@mail.cern.ch>
    Re: Help: mail script (WIN) <tintin@snowy.calculus>
    Re: How do I get a list of files in a directory using p <bill.kemp@wire2.com>
    Re: how to replace several blank lines with 1 <tamm@scotlegal.com>
    Re: installing modules in WinNT <simon.andrews@bbsrc.ac.uk>
    Re: K shell to perl translator ? <tintin@snowy.calculus>
        multipul http connections <edwin@notthis.com>
        non-persistent cookies management (ljb)
    Re: Peek and Poke on Perl? <bart.lateur@skynet.be>
    Re: Perl ROOT <tintin@snowy.calculus>
    Re: Please Help with Sockets! <oneconcept@yahoo.co.uk>
        Setting max. values (cpu/ram usage) for mod_perl script <nospaming@gmx.net>
    Re: Unusual error message... <iltzu@sci.invalid>
    Re: win32 stat in directory with 4682 files <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Sep 2001 13:14:28 +0300
From: Sami Jarvinen <skj@iobox.fi>
Subject: Re: [ASK[ Perl and Windows
Message-Id: <MPG.16196336d304f5949896bf@news.yhteys.mtv3.fi>

Bob Walton <bwalton@rochester.rr.com> wrote
> "¤ßÂÅ Dennis" wrote:
> > How can a PERL script only show at tray-icon without text-console?????
> 
> but it might.  You might also be able to write a C-language stub that
> would fire up Perl without the annoying black window.  Or if you put a
> "use Tk;" in your program, the annoying black window will show for only
> a bit.  You might also be able to create a shortcut that specifies the
> program be run minimized, and, if it is fired up via that shortcut, it
> would run minimized.  There are probably other ways, too.

Indeed there is. ActivePerl comes with a nice program called 'wperl.exe' 
which, unlike 'perl.exe', is not a console application, I.e. it won't 
create a shell window.


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

Date: 25 Sep 2001 10:46:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: command line file operations
Message-Id: <9opn9m$p4o$2@mamenchi.zrz.TU-Berlin.DE>

According to B. Caligari <bcaligari@fireforged.com>:
> 
> "Chucko" <cmerrifield@houston.rr.com> wrote in message
> news:z87r7.20$b55.36673@typhoon.austin.rr.com...
> > Does anyone know how to (from a command line) read in a file of text, keep
> > each word read, discard the duplicates then write the kept words to a
> file?
> >
> 
> perl -nle '$x{$_}++ for split; END { print for keys %x }' filename
> 
> cat filename | tr -s [:space:] "\n" | sort | uniq

Useless use of "cat".

Anno


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

Date: Tue, 25 Sep 2001 22:21:02 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: command line file operations
Message-Id: <VF_r7.21$1h3.212068@news.interact.net.au>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9opn9m$p4o$2@mamenchi.zrz.TU-Berlin.DE...
> According to B. Caligari <bcaligari@fireforged.com>:
> >
> > "Chucko" <cmerrifield@houston.rr.com> wrote in message
> > news:z87r7.20$b55.36673@typhoon.austin.rr.com...
> > > Does anyone know how to (from a command line) read in a file of text,
keep
> > > each word read, discard the duplicates then write the kept words to a
> > file?
> > >
> >
> > perl -nle '$x{$_}++ for split; END { print for keys %x }' filename
> >
> > cat filename | tr -s [:space:] "\n" | sort | uniq
>
> Useless use of "cat".

and UUOU






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

Date: Tue, 25 Sep 2001 12:22:01 GMT
From: Andrew Cady <please@no.spam>
Subject: Re: Dump raw data
Message-Id: <87ite77992.fsf@homer.cghm>

Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr> writes:

> I need to regularly dump a whole hash on disk, and reload it
> later. Is there a way to write its "raw data" on a file descriptor
> (I mean the way Perl stores it in memory) ? I'm looking for a pair
> of functions which would work that way :
> 
[...]
> 
> I'm looking for this kind of functions to save/restore hashes fastly
> and efficiently (less wasted space than ASCII files).  Any help ? Of
> course, I don't care if these functions are platform-dependent.

dbmopen and tie (both builtins) aren't quite what you're asking for
but they may work.


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

Date: 25 Sep 2001 10:44:24 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getting NULLS after a lockup from using up memory
Message-Id: <9opn68$p4o$1@mamenchi.zrz.TU-Berlin.DE>

According to Xeno Campanoli <xeno@eskimo.com>:
> 
> I'm finding that frequently, in my Perl program that I mentioned here
> before, I get a catestrophic failure at the call to waitpid (this is
> with either the zero, or the WNOHANG parameter in use) such that I
> literally get a stream of nulls of varying length output to STDERR at
> that point, at least when I'm using STDERR print statements to trace my
> progress.

Well, *what* are you printing to STDERR?  Also, what are "nulls"?

>           There seems to be no other reason for this than just running
> out of resources, and it makes sense that I fail at waitpid since I
> spend more time there when memory is getting used up (once in a while it
> fails elsewhere, but usually there at the waitpid) but it is curious
> that I get this stream of nulls.  I was wondering if you had any idea
> why this is?  Have you ever seen that?

There is no chance of answering that unless you say what data becomes
"nulls" in this situation.  However, after a memory shortage, virtually
everything can happen.  I don't think there's much use in worrying why
a program shows this or that behavior.

Anno


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

Date: 25 Sep 2001 11:11:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Goto and global variables
Message-Id: <9opooc$rj7$2@mamenchi.zrz.TU-Berlin.DE>

According to Philip Newton  <nospam.newton@gmx.li>:
 
[...]

> But you probably don't have to worry about goto &NAME, since its primary
> use AIUI is inside AUTOLOAD subroutines -- it's not something (sane)
> people use in everyday programming.

"goto &sub" is also useful in handler chaining.  When your program
wants to establish a signal handler via the %SIG hash, there is
a problem when another handler has already been installed (presumably
by an unrelated piece of software).  A common way of dealing with
this is to save the foreign handler (in $old_handler, say), and
then "goto &$old_handler" when your own handler has done its thing.
That way the previous handler is called in exactly the same
environment (including the stack frame) it would have been called
in if your handler hadn't intervened.

No, this isn't exactly everyday programming either.

Anno



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

Date: 25 Sep 2001 05:07:38 -0700
From: whatafish@hotmail.com (David Djajaputra)
Subject: Handling two lines
Message-Id: <1f57124c.0109250407.1fadd1d1@posting.google.com>

Hello all,

I'm trying to write a perl script that can help me convert my
Fortran77 programs into Fortran90. My question is about multiline
statement.

In fixed-format F77, multiline statement goes like this:

xxxxx line1 
     >line2

(Statements start on column 7, continuation line is denoted by a
non-blank column 6. Anything can be used other than blank or zero.)
xxxxx can be numbers, it's used for labeling.

In Fortran90, it doesn't care about fixed format. Continuation line
symbol is appended at the end of the *first* line, and it uses an
ampersand (&):

line1 &
line2

My question is: What's the best way to do this conversion with perl?
Perhaps a one-liner?

Much thanks for any help!

David


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

Date: Tue, 25 Sep 2001 14:30:57 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Handling two lines
Message-Id: <o5u0rt06hg56ohpg8rg0hlrgnn5b14bsof@4ax.com>

On 25 Sep 2001, whatafish@hotmail.com (David Djajaputra) wrote:
>I'm trying to write a perl script that can help me convert my
>Fortran77 programs into Fortran90. My question is about multiline
>statement.

Oh, and how far's your code progressed so far?

>My question is: What's the best way to do this conversion with perl?
>Perhaps a one-liner?

Might be a hefty one-line :-)

#!/usr/bin/perl -w

use strict;

my @linebuf;

while( defined( my $line = <DATA> ) ){
  chomp( $line );
  
  if( $line =~ m/^[\d\s]{5}\s.*/ || $line =~ m/^\s*$/ ){
    # start of a new line, so ship out pending lines
    if( @linebuf ){
      #print OUT join( " \&\n", @linebuf );
      print join( " \&\n", @linebuf ), "\n";      
      @linebuf = ();
    }
    # add new line to linebuf
    push @linebuf, $line;
  } elsif( $line =~ m/^\s{5}\S(.*)/ ){
    # push continued line to linebuf
    push @linebuf, $1;
  } else {
    # this doesn't fit the specs
    die "Offending line $.: '$line'\n";
  }
}

if( @linebuf ){
  print join( " \&\n", @linebuf );
}

__DATA__

1     foo( baz, bar,
     >boo );
      blabla
      whatever
12345 gnarf
12346 bla
     >bla
     >bla

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: Tue, 25 Sep 2001 14:11:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help with reading web page from socket.
Message-Id: <Pine.LNX.4.30.0109251405470.14773-100000@lxplus023.cern.ch>

On Sep 23, Brian Carlson jeopardized:

> That was it.

and then comprehensively quoted a couple of pages containing various
detailed suggestions.

Your posting was a complete waste of usenet: the hon Usenauts learn
practically nothing from it, it serves only to create annoyance.

> Just another example the flavors of web standards.

You haven't cited any standards.

>  This worked just fine on a couple other servers,

For some value of the term "worked".  It might just have depended on
the errors being fixed-up in a particular way.

I hope that by the time my killfile entry ages-out you'll have learned
how to do followups properly.   Probably I should have just done that
silently, cause I doubt you'll pay any attention, but at least there
may be some other readers who are willing to take the point.

bye for now.




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

Date: Tue, 25 Sep 2001 22:25:20 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Help: mail script (WIN)
Message-Id: <YJ_r7.22$RJ3.613393@news.interact.net.au>


"bill" <bill02115@hotmail.com> wrote in message
news:9oosmj$ah1$1@panix3.panix.com...
> In <9olr6j$j34$1@charity.cs.utexas.edu> logan@cs.utexas.edu (Logan Shaw)
writes:
>
> >A fairly obvious way is to connect to some SMTP server somewhere
> >and spit the mail message at it.  You can do this with Net::SMTP.
>
> The mail must come from the "usual" SMTP server (i.e. the one used by
> the usual mail program when mail is sent from the machine in
> question).  The problem is, I can't figure out what this server's
> name/domain is.  Is there a program that will reveal that information?

You either ask you administrator or ISP, and if they can't tell you, do a
lookup on the domain name for the MX records (assuming they are correct)




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

Date: Tue, 25 Sep 2001 12:01:02 +0100
From: "W K" <bill.kemp@wire2.com>
Subject: Re: How do I get a list of files in a directory using perl?
Message-Id: <2uZr7.808$t97.9415@news.uk.colt.net>

> > i am not familiar with parse_dir...is it part of a module? but anyway,
> > the standard way to read the contents of a directory with perl is with
> > opendir and readdir like this:
>
> And of course Perl offers alternative ways, too, e.g. globbing:
>
> @list = <*>;

or another way of globbing:

@list =glob ("/home/me/*.pl")






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

Date: Tue, 25 Sep 2001 12:01:47 +0100
From: "Tam McLaughlin" <tamm@scotlegal.com>
Subject: Re: how to replace several blank lines with 1
Message-Id: <ijopo9.8ij.ln@mail.scotlegal.com>

Thanks for the replies folks.
I should have been more clear and said I wante to replace multiple blank
lines
with 2 blank lines. I will try some of the perl out today.

"Ian Boreham" <ianb@ot.com.au> wrote in message
news:f02c4576.0109242018.17b60a63@posting.google.com...
> Benjamin Goldberg <goldbb2@earthlink.net> wrote in message
news:<3BAE3248.C93D7066@earthlink.net>...
> > > > perl -ni.bak -e 'print if !/^$/' file1 file2 ...
> > >
> > > That removes *all* blank lines.  Admittedly, he could have
> > > been more clear, but I *think* what he wanted was to remove
> > > only multiple adjascent blank lines, leaving one...
> > [snip]
> >
> > perl -lp00i.bak -e1 file1 file2 ...
> >
> > NB this is untested.
>
> This also removes all blank lines. The switches appear to be processed
> as follows:
>
>   l: chomp $/ (modified later to effectively /\n+/) and set $\ to the
> current value of $/ ("\n")
>
>   00: set $/ to "paragraph mode" (effectively /\n+/)
>
> ---
>
> I think you want:
>
>   perl -p00li.bak -e1 file1 file2 ...
>
>
>   00: set $/ to "paragraph mode" (effectively /\n+/)
>
>   l: chomp $/ (/\n+/) and set $\ to $/ (/\n+/, apparently treated as
> "\n\n" for output).
>
> ...which seems to work. I can't find a mention of this special
> behaviour for the combination of 00 and l, and I can't replicate it by
> trying to set $\ explicitly. And since -l appears to take only a
> single octal value, multi-character line endings can't be set this
> way, except, apparently, using the above magic.
>
> ---
>
> Alternatively, let the -e actually set $\ explicitly.
>
> Regards,
>
>
> Ian




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

Date: Tue, 25 Sep 2001 13:15:04 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: installing modules in WinNT
Message-Id: <3BB07548.36C0BEC6@bbsrc.ac.uk>

Eli the Bearded wrote:
> 
> In comp.lang.perl.misc, Steve K <skradel@mindspring.common.sense> wrote:
> > "Eli the Bearded" wrote in message news:eli$0109211222@qz.little-neck.ny.us
> > > Modules install nicely, double clicking perl scripts works, but I can't
> > > right click and 'Open With...' perl scripts. Anything simple to fix
> > > that?
> > Pick "Open With... -> Choose Program" after the right click, and specify the
> > perl interpreter.  Windows will/should/might remember that decision and,
> > thereafter, offer it on the "Open With" menu.
> 
> I meant that there is no 'Open With' in the right click menu so that
> I could override opening with perl for those times I want to edit the
> script.

You need to select the file, then *shift* right click to get the "open
with" option.

Simon


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

Date: Tue, 25 Sep 2001 22:29:42 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: K shell to perl translator ?
Message-Id: <1O_r7.23$lJ3.595087@news.interact.net.au>


"Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
news:KSSr7.650$Owe.283379712@news.frii.net...
> In article <dVqvOwkhbWLh8YBDo0qV5bOcVc+X@4ax.com>,
> Neil  <neil@thump.org> wrote:
> >I can't find any mention of this anywhere but just incase the gurus know,
has
> >anyone written a khell to perl translator ?
> >
> >Neil
> >
>
> There are three shell tool converters for perl a2p translates awk into
perl,
> s2p translates sed to perl and find2perl translates a find command line
> into a perl script.  But to my knowledge there is no general tool for
> converting a shell scripting language into an equivalent perl program.
>
> The perl FAQ contains the following advice:
>
>        How can I convert my shell script to perl?
>
>        Learn Perl and rewrite it.  Seriously, there's no simple
>        converter.  Things that are awkward to do in the shell are
>        easy to do in Perl, and this very awkwardness is what
>        would make a shell->perl converter nigh-on impossible to
>        write.  By rewriting it, you'll think about what you're
>        really trying to do, and hopefully will escape the shell's
>        pipeline datastream paradigm, which while convenient for
>        some matters, causes many inefficiencies.

I might also mention many Perl scripts that really should have been shell
scripts.

I've lost count of the number of times I seen a perl script that it a
virtual shell script, eg:

$files=`ls -l foo*`;
$cmd=`some -other -command`;

That's not to say, they should have been written as shell scripts, but often
people familar with C or shell, write their Perl code using the same logic.




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

Date: Tue, 25 Sep 2001 14:52:23 +0200
From: "Edwin B" <edwin@notthis.com>
Subject: multipul http connections
Message-Id: <9opuom$fn9j$1@reader02.wxs.nl>

I want to fetch content from the web but as it's quite a bit and
from different url's I am looking for a way to open multiple
connections.

I have looked at the fork function but I am not sure if this is
what I should use.

Can anybody help me a bit and give some pointers into
the right direction?

Edwin





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

Date: 25 Sep 2001 05:50:53 -0700
From: ljb_fr@yahoo.fr (ljb)
Subject: non-persistent cookies management
Message-Id: <a0dc8d13.0109250450.23e6e46e@posting.google.com>

Hello,

I just want to store any incoming "non-persistent" cookies and then
return the cookies with the next request like a web browser does.

If somebody has an exemple to do this  

Thank you for your responses

ljb


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

Date: Tue, 25 Sep 2001 13:03:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Peek and Poke on Perl?
Message-Id: <6001rtstacdf07oaqtgst87nlj3u5dt7e0@4ax.com>

Gary wrote:

>My (currently) limited knowledge of this tells me adding 
>embedded C wouldn't solve this problem. Using a direct 
>memory instruction should raise an exception/memory violation.
>It seems to me this code needs to be some sort of "driver" or 
>registered with the OS in some way to be permitted access to 
>a fixed address space (or I/O space for that matter).

You're right. Under DOS, it would work, perhaps even under
Windows95/98/ME, but NOT under NT. Any OS worth the name "multi-user"
has to protect itself from things like this, because this is a surefire
way to get it to crash.

For Windows, you need a driver, a VxD, I think. You could have a perl
XS-based module to interface with that driver. It still is a surefire
way to get the OS on its knees.

-- 
	Bart.


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

Date: Tue, 25 Sep 2001 22:33:31 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Perl ROOT
Message-Id: <CR_r7.24$Jh3.226437@news.interact.net.au>


"Marvin" <glodalec@yahoo.com> wrote in message
news:MPG.161a4bf73c5a59a0989706@news.siol.net...
> Hi !
>
> I installed perl on exported FS under /tools/usr/local/....
>
> Every client has mounted that directory.
> Now when Im trying to run a perl script, it looks in /usr/local/....
> structure for libraries. Is there any way I can change perl root
> directory to be /tools.
> I also tried with
> use lib "/tools/usr/local/lib/perl5/..." ;
> use lib "/tools/usr/local/lib/perl5/..." ;
> use lib "/tools/usr/local/lib/perl5/..." ;

Link /tools/usr/loca/lib/perl5 to /usr/local/lib/perl5




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

Date: Tue, 25 Sep 2001 13:10:32 +0100
From: "Raj" <oneconcept@yahoo.co.uk>
Subject: Re: Please Help with Sockets!
Message-Id: <1001419827.17660.0.nnrp-02.c2d95a2c@news.demon.co.uk>


<nobull@mail.com> wrote in message news:u9d74gwmwo.fsf@wcl-l.bham.ac.uk...
>
> >                 while (<S>) {
>
> Random shot in the dark: it may be that the protocol you are
> implementing requires that you recognise some sort of end-of-data
> signal other than an EOF on the socket.

Thank you Simon & Nobull for your help so far.  I have updated the code to
the following:

if ($reply =~ /^200\s+(.*)/) { # 200 Data follows = OK
                while (<S>) {
                        print "<P>".$_;
                        ($key, $value) = /^BILL:(.*?)=(.*)?\n/;
                        $address{$key} = $value;
                }
                close(S);
                return 1;
        } else {
                return undef;
        }

But Nobull, you're right, I need to recognise a period (".") at the end of
the data set which looks like this:

STATUS=ACTIVE

STATUS_FLAGS=

BILL_TYPE=INTERNAL

BILL:Fname=Raj

BILL:Sname=Kothary

BILL:Salutation=Mr

BILL:Addr1=66 Locket Road

BILL:City=Leicester

BILL:State=Leicestershire

BILL:Country=GB

BILL:Email=oneconcept@yahoo.com

BILL:Zip=LE13 6TR

BILL:Work=099 9999 9999

BILL:Home=999 9999 9999

BILL:Mobile=079 9999 9999

MAIL:Fname=Raj

MAIL:Sname=Kothary

MAIL:Salutation=Mr

MAIL:Addr1=66 Locket Road

MAIL:City=Leicester

MAIL:State=Leicestershire

MAIL:Country=GB

MAIL:Zip=LE13 6TR

 .

Using

    while (<S> ne ".") {

        blah...

     }

doesn't seem to work though.  Can someone please shed some light?

Thanks,

Raj





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

Date: Tue, 25 Sep 2001 14:33:19 +0200
From: EXP <nospaming@gmx.net>
Subject: Setting max. values (cpu/ram usage) for mod_perl scripts?
Message-Id: <3BB0798F.D1BC0B94@gmx.net>

Hi

I wonder, is it somehow possible to restrict the maximal cpu usage and
ram usage for apache mod_perl scripts? Either per script (script x may
use 14MB ram, script y 20MB ram), as global per script (each script may
use 15MB ram and run max. 10cpu seconds) or global mod_perl (each
mod_perl/apache instance may use max 30MB{<- this should be possible via
ulimit, or? But it would terminate the whole apache process?} and
15seconds cpu time{<- possible?}) restriction?

I think the ram usage of the apache process could be restricted via
ulimit but how can I restrict the cpu usage for mod_perl? And I don't
want to kill an apache child just because some script bloated it up.

thanks

BYe!
EXP


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

Date: 25 Sep 2001 12:35:41 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Unusual error message...
Message-Id: <1001421283.19962@itz.pp.sci.fi>

In article <3BAE5642.53FE388A@earthlink.net>, Benjamin Goldberg wrote:
>Ilmari Karonen wrote:
>[snip]
>> The "EXPR for LIST;" syntax was introduced in perl 5.005.  It
>> is exactly equivalent to "for (LIST) {EXPR}", 
>
>Not *exactly* equivilant... it doesn't introduce a new scope.

Actually, it does.  Some might argue that this is a bug.  Certainly none
of the other statement modifiers do that.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Tue, 25 Sep 2001 11:18:41 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: win32 stat in directory with 4682 files
Message-Id: <2np0rtg95b87aho314tli2havlgerr4lia@4ax.com>

Peter Korman wrote:

>It gets even curiouser than that. The combination of:
>
>open(handle, filename);
>stat(handle);
>
>is faster than:
>
>stat(filename);
>
>by itself.

Hmm... again, perl's internal mechanism for implementingstat() looks
suspicious. It looks like stat() uses a rather dumb, and slow,mechanism
for asking the OS to find the file info. By contrast, open() seems to be
using a faster method. And once open() found the file, the file info is
cached by the OS, and perl can get to it much faster.

On my computer, File::Find is roughly 60 times slower than using the
directory listing API calls through Win32::API. That a huge difference.
Too big to be acceptable. So the reason why it's so slow, should be
found out, and fixed. By someone who knows C well (thus: not me :-( ).

-- 
	Bart.


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

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


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