[16847] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4259 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 8 11:05:30 2000

Date: Fri, 8 Sep 2000 08:05:14 -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: <968425513-v9-i4259@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Sep 2000     Volume: 9 Number: 4259

Today's topics:
        [PREANNOUNCE] perldoc =~ s/old/new()/geewhizbang (Tom Christiansen)
        ActivePerl 617 cannot be opened by Windows-Installer <alexa@redneck.gacracker.org>
    Re: Changing ALL leading blanks to zero <jeffp@crusoe.net>
    Re: Changing ALL leading blanks to zero (Tom Christiansen)
    Re: Changing ALL leading blanks to zero (Rafael Garcia-Suarez)
    Re: Changing ALL leading blanks to zero <rmore1@my-deja.com>
    Re: Changing ALL leading blanks to zero <EUSWMCL@am1.ericsson.se>
    Re: Date question?  Can't display English style? <jeffp@crusoe.net>
    Re: Date question?  Can't display English style? <tony_curtis32@yahoo.com>
    Re: Date question?  Can't display English style? (Ivan Lee)
    Re: Date question?  Can't display English style? <tony_curtis32@yahoo.com>
        Environment variables - how to list them all? <bd83h@bedford.waii.com>
    Re: Environment variables - how to list them all? <christopher_j@uswest.net>
        file creation time ? <man@rila.bg>
    Re: file creation time ? (Tom Christiansen)
    Re: file creation time ? (Villy Kruse)
    Re: how can I tell the internet speed of visitor (Philip 'Yes, that's my address' Newton)
    Re: How to delete line #1 <yanick@babyl.sympatico.ca>
    Re: HTML::parse bug <T.Cockle@staffs.ac.uk>
    Re: London =?iso-8859-1?Q?=A330-35K?= Perl Programmers  (Gwyn Judd)
        Multiple socket <ville.mattila@nettipaa.fi>
    Re: New Perl Tutorial - www.perltutor.com (Gwyn Judd)
    Re: New Perl Tutorial - www.perltutor.com (Tom Christiansen)
        open'ing lynx doesn't work when called by cron <ralawrence@my-deja.com>
    Re: open'ing lynx doesn't work when called by cron <rmore1@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 8 Sep 2000 07:06:48 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: [PREANNOUNCE] perldoc =~ s/old/new()/geewhizbang
Message-Id: <39b8e468@cs.colorado.edu>
Keywords: Grep Ye First The Kingdom of Pod

For those who like to stand on the cutting edge of the future
(precarious though this might sound), I invite you to acquire, to
play with, and if you want, to send me feedback on the brand new and
ultracool "perldoc" replacement.  It's available from:

    http://doriath.perl.com/misc/perlman-alpha0.tar.gz

This is early but reasonably functional "alpha nought" version of
my infinitely cool perldoc rewrite.  There should be enough of it
there now to get a feel for how it works.  Even so, it's about a
gazillion more flexible, powerful, convenient, and extensible than
the legacy version was.   You can search the perl documentation at
many granularities from way up high using simple keywords to find
in headers, down to a line-by-line search using perl regexes.  You
can check in just code segments or just non-code segments.  You can
get an overview/outline of the page.  You can have it make your
breakfast for you.

Here's a small foreshadowing, run using 'perlman -t perlman'.   
(I've largely tried to follow the legacy perldoc's conventions where
sensible.  There's also a legacy mode that follows all of them even
where *not* sensible.)

NAME
    perlman - search and display Perl manpages

SYNOPSIS
    [ perlman ] [ *options* ] *perl_manpage_name* [<pattern> ...]

DESCRIPTION
    The perlman program displays selected Perl manpages, optionally
    searching for selected portions of these. If no search pattern is
    provided, the requested manpage is simply displayed in its entirety, but
    if a search pattern is requested, only those sections whose section
    header match that pattern are displayed.

    In a slightly sneaky bit of do-what-I-mean convenience, you don't even
    need to use the name perlman to run the program. Instead, you may use
    the name of the manpage itself as the command. For example, these pairs
    are all equivalent. (We hope they're also useful and interesting.)

    *   Show the perlop(1) manpage:

            $ perlman perlop
            $ perlop

    *   Show the section containing "comma" (technically, those containing
        `/\bcomma\b/i') from the perlop manpage):

            $ perlman perlop comma
            $ perlop comma

    *   Show the sections describing the `ARGV' variables from the perlvar
        manpage:

            $ perlman perlvar ARGV
            $ perlvar ARGV

    *   Show the open entry in the perlfunc manpage:

            $ perlman perlfunc open
            $ perlfunc open

    *   Explain this particular diagnostic message:

            $ perlman perldiag 'assigned to typeglob'
            $ perldiag 'assigned to typeglob'

    By default, perlman will look in the section headers of each manpage.
    However, you can change the focus of the search from the default (which
    is -S or --sections) to any of

	--paragraph, -P, -p
	--body, -B
	--lines, -L
	--code, -C
	--headers, -H

    Beyond this, you can use most of your favorite grep(1) options. See the
    OPTIONS entry elsewhere in this document.

  Other Queries

    Besides displaying some or all of a Perl manpage, perlman can also
    process Perl manpages for you in other ways.

    *docpath*
        If you would like to know where a manpage is installed, use the -l
        (--whence or --showpath) flag:

            $ perlman -l perlvar 
            $ perlvar -l 
            /usr/local/man/man1/perlvar.1
            /usr/local/lib/perl5/5.6.0/pod/perlvar.pod

        You can also use the docpath(1) program directly for this, or any of
        its cousins like podpath(1), pmpath(1), and pod2manpath(1),
        depending on which flavor you're looking for.

    *olpod*
        To look at just a section outline, you can the outline of the pod
        using the -O (--outline) flag:

            $ perlman -O perlsyn
            $ perlsyn -O 
              NAME
              DESCRIPTION
                Declarations
                Simple statements
                Compound statements
                Loop Control
                For Loops
                Foreach Loops
                Basic BLOCKs and Switch Statements
                Goto
                PODs: Embedded Documentation
                Plain Old Comments (Not!)

        You may limit the level of the outline using the --outlinelevel=*N*
        switch.

        You can also call the olpod(1) program directly, in which case you
        could indicate the indent level more simply.

            $ olpod -1 /usr/local/lib/perl5/5.6.0/pod/perlre.pod
              NAME
              DESCRIPTION
              BUGS
              SEE ALSO

    *catpod*
        If you just want to see the literal document, you can use the -u
        flag (--catpod or --pod). So this:

            $ perlman -u CGI
            $ catpod `pmpath CGI`

        Will display just the raw, unformatted pods from the CGI.pm module.
        (Yes, perlman knows about Perl modules, too.)

    *cat*
        If you're looking at a file that has both pod and nonpod in it, and
        don't want to filter out the pod, you can

            $ perlman -U CGI
            $ cat `pmpath CGI`

    Most of the options above action send their output through your pager
    unless you specify --nopager.

  Modules

    If you pass perlman the name of a module, like `CGI' or
    `File::Basename', it knows to display (or search and display) that as
    well. For example, this gives you an outlnie of the manpage for
    `File::Basename':

        $ perlman --outline File::Basename

    And this displays every paragraph containing the word "remote" from
    CGI.pm's manpage:

        $ perlman --paragraphs CGI remote

    See the next section for how to search through all module manpages
    without knowing their names.

  Metapages

    Some of the manpages that perlman knows about are really "metapages".
    These metapages expand to a list of other pages, and sometimes change
    the default search options, too. For example, "perlfaq" is really all
    the Perl FAQ manpages, not just their table of contents. This finds the
    FAQ on rounding:

        $ perlman perlfaq round
        $ perlfaq round

    The `sitemods', `stdmods', and `modpods' metapages will (slowly)
    recursively traverse your Perl module installation directories looking
    for modules. For example

        $ perlman --lines --showpath stdpods CGI

    will look through every line in every standard module's pod embedded
    documentation and show the path of those that contain the string "CGI".
    You could even list all your install modules (by pathname) if you're
    sneaky about it:

        $ perlman -Ll sitepods .

    Recursive searches are very slow, so you might at least want to add the
    -v (--debug) flag so you can trace what's going on.

    You can get a listing of the known metapages using the --whatmeta
    switch, and you can suppress metapage expansion using --ignoremetapages.

I see I forgot to mention the "perlhelp" metapage.  That's automatically
*all* the standard pods.  So you can say "perlhelp typeglobs" to
do a full grep of all the pages for that.  Or "perlhelp -Si
'typeglobs?'" to get just the section's whose headers contains that
(case insensitively).

There's a lot more, most of which remains yet to be documented.
That's why this is considered an alpha-grade snapshot.    That
doesn't mean it doesn't work.  It does.  There's just a bunch of
productizing to do, like documentation, crossplatform testing, etc.

To run these, do this:

    You must set your PERL5LIB envariable to `pwd`/lib
    You must set your PATH envariable to include `pwd`/bin

Once untarred, you cd to its directory and set some of your
environment variables to make this all run.

If a (t)csh user: 

    % cd perlman
    % setenv PERL5LIB $cwd/lib
    % set path = ($cwd/bin $path)

Or an sh user:

    $ cd perlman
    $ export PERL5LIB=`pwd`/lib PATH=`pwd`/bin:$PATH

And now you can run the things in the bin directory there.  Use
"perlman --man" to get the help page I've just here printed.

There's both more and less here than meets the eye (check the links
in the bin directory).  Some of the code is still crufty with little
commented out debugging bits.  Some is reasonably nice, or getting
that way, while some is just ancient.  And of course, everything
needs much better documentation--or even, in some cases, documentation
to start with; eg, I haven't documented the options save by example
so far.

Just please remember that this is an prototype release only--it
works for me (well, usually :-), and I hope it works for you, too.
But a live demo can be the best illustration, so that's what this
is.  It's going to be spruced up a bit in the coming weeks in time
for an integrated release, but some end-user intuitiveness testing
will help this.

Think of this way: at least now no one will ever again be able to
complain about not having a grep program. :-)

Good luck and enjoy.  

--tom

PS: I was just kidding about breakfast. :-)


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

Date: 8 Sep 2000 13:18:27 -0000
From: Alexandra Schubert <alexa@redneck.gacracker.org>
Subject: ActivePerl 617 cannot be opened by Windows-Installer
Message-Id: <20000908131827.11213.qmail@gacracker.org>

I wish to run Perl under Windows NT 4.0. In this NG ActivePerl was
recommended by several people. 
I downloaded the Windows Installer the windows version of Active Perl.

ActivePerl-5.6.0.617-MSWin32-x86-multi-thread.msi

My Windows Installer gives an error message when trying to open the
packet. I downloaded it 3 times, but still the same result.

Anyone out there who had the same problem? Solution?

-- 
Thx, Alexa




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

Date: Fri, 8 Sep 2000 09:10:14 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Changing ALL leading blanks to zero
Message-Id: <Pine.GSO.4.21.0009080909210.23350-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 8, William Cardwell said:

>$x='   ';
>$x=~s/^ +/0/;
>$y='  5';
>$y=~s/^ +/0/;
>print "$x, $y\n"; # I want: "000, 005". I'm getting "0, 05".

Randal Schwartz answered this a couple years back with:

  s/\G /0/g;

Your approach changes all leading spaces to one 0.  His replaces each
leading space with a 0.

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



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

Date: 8 Sep 2000 07:11:26 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Changing ALL leading blanks to zero
Message-Id: <39b8e57e@cs.colorado.edu>

In article <39B8E0D2.3F042077@am1.ericsson.se>,
William Cardwell  <EUSWMCL@am1.ericsson.se> wrote:
>What am I missing here?
>
>$x='   ';
>$x=~s/^ +/0/;
>$y='  5';
>$y=~s/^ +/0/;
>print "$x, $y\n"; # I want: "000, 005". I'm getting "0, 05".

From the Perl Cookbook, chapter six:

    You can also use C<\G> in your pattern to anchor it to the end
    of the previous match.  For example, if you had a number stored
    in a string with leading blanks, you could change each leading
    blank into a digit zero this way:

	$n = "   49 here";
--->	$n =~ s/\G /0/g;
	print $n;

--->    00049 here

    You can also make good use of C<\G> in a C<while> loop.  Here
    we use C<\G> to parse a comma-separated list of numbers (e.g.,
    C<"3,4,5,9,120">):

	while (/\G,?(\d+)/g) {
	    print "Found number $1\n";
	}

--tom, whose apparent presence here is merely a transitory figment


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

Date: Fri, 08 Sep 2000 13:34:41 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Changing ALL leading blanks to zero
Message-Id: <slrn8rhr35.7sr.rgarciasuarez@rafael.kazibao.net>

Jeff Pinyan wrote in comp.lang.perl.misc:
>[posted & mailed]
>
>On Sep 8, William Cardwell said:
>
>>$x='   ';
>>$x=~s/^ +/0/;
>>$y='  5';
>>$y=~s/^ +/0/;
>>print "$x, $y\n"; # I want: "000, 005". I'm getting "0, 05".
>
>Randal Schwartz answered this a couple years back with:
>
>  s/\G /0/g;
>
>Your approach changes all leading spaces to one 0.  His replaces each
>leading space with a 0.

Another approach, more specific, but useful when formatting numbers:
  $x='   ';
  $y='  5';
  printf "%03d, %03d\n",$x,$y;

-- 
Rafael Garcia-Suarez | http://rgarciasuarez.free.fr/


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

Date: Fri, 08 Sep 2000 13:38:58 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: Changing ALL leading blanks to zero
Message-Id: <8paq5f$kjs$1@nnrp1.deja.com>

In article <39B8E0D2.3F042077@am1.ericsson.se>,
  William Cardwell <EUSWMCL@am1.ericsson.se> wrote:
> What am I missing here?
>
> $x='   ';
> $x=~s/^ +/0/;
> $y='  5';
> $y=~s/^ +/0/;
> print "$x, $y\n"; # I want: "000, 005". I'm getting "0, 05".

You also could use the sprintf operator to get leading zeros...

perl -e '$x = sprintf "%03d"," 5"; print "$x\n"'
005

--
=============================
Richard More
http://www.richmore.com/


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


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

Date: Fri, 08 Sep 2000 09:43:36 -0400
From: William Cardwell <EUSWMCL@am1.ericsson.se>
To: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Changing ALL leading blanks to zero
Message-Id: <39B8ED08.DBD19637@am1.ericsson.se>



Rafael Garcia-Suarez wrote:
> 
> Jeff Pinyan wrote in comp.lang.perl.misc:
> >[posted & mailed]
> >
> >On Sep 8, William Cardwell said:
> >
> >>$x='   ';
> >>$x=~s/^ +/0/;
> >>$y='  5';
> >>$y=~s/^ +/0/;
> >>print "$x, $y\n"; # I want: "000, 005". I'm getting "0, 05".
> >
> >Randal Schwartz answered this a couple years back with:
> >
> >  s/\G /0/g;
> >
> >Your approach changes all leading spaces to one 0.  His replaces each
> >leading space with a 0.
> 
> Another approach, more specific, but useful when formatting numbers:
>   $x='   ';
>   $y='  5';
>   printf "%03d, %03d\n",$x,$y;
> 
> --
> Rafael Garcia-Suarez | http://rgarciasuarez.free.fr/

Thanks to all.

Rafael, I had not seen "%03d". I do: "%3.3d" learned from C lang.

Regards,

Will


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

Date: Fri, 8 Sep 2000 09:14:48 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Date question?  Can't display English style?
Message-Id: <Pine.GSO.4.21.0009080912520.23350-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 8, Ivan Lee said:

>#!/usr/bin/perl
>($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
>localtime(time);
># $date =  $mon+1 . "/" . $mday . "/" . $year;
>$date =  $mday . "/" . $mon+1 . "/" . $year;
>print $date;       

The . operator binds more tightly than +, so your second $date is actually

  (($mday . "/" . $mon) + 1) . "/" . $year;

If you were using -w, Perl would say that "8/8" isn't numeric.  If you did

  $mday . "/" . ($mon+1) . "/" . $year

you'd have been ok.

>the day, why is that?  moreover, in both case I display the 
>year is "100" 

YES, THE YEAR IS 100.  If you read the localtime() documentation, you'll
know why.  (How did you know that you had to add 1 to $mon?  Guess what
you have to add to the year...)

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



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

Date: 08 Sep 2000 08:18:26 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Date question?  Can't display English style?
Message-Id: <87hf7rkonx.fsf@limey.hpcc.uh.edu>

>> On Fri, 08 Sep 2000 13:52:33 GMT,
>> ginola@mailcity.com (Ivan Lee) said:

> the line start with # can display probably, but when I
> exchange the date and month, it can't display the day,
> why is that?  moreover, in both case I display the year
> is "100" is that normal?

perldoc -f localtime

See also "perldoc POSIX" for strftime() which makes
arbitrary date formatting trivial.

hth
t
-- 
WWNKD?


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

Date: Fri, 08 Sep 2000 14:49:27 GMT
From: ginola@mailcity.com (Ivan Lee)
Subject: Re: Date question?  Can't display English style?
Message-Id: <39bdfc4b.4663919@news.alphalink.com.au>

but I am using in cgi ...
so do I need to do calculation or there is other way to display 2000
>>> On Fri, 08 Sep 2000 13:52:33 GMT,
>>> ginola@mailcity.com (Ivan Lee) said:
>
>> the line start with # can display probably, but when I
>> exchange the date and month, it can't display the day,
>> why is that?  moreover, in both case I display the year
>> is "100" is that normal?
>
>perldoc -f localtime
>
>See also "perldoc POSIX" for strftime() which makes
>arbitrary date formatting trivial.
>
>hth
>t


**************************************
¯u ¸ô ®³ Ivan Lee
http://www.geocities.com/ginola79/
http://www.geocities.com/ivanlee79/


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

Date: 08 Sep 2000 09:05:35 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Date question?  Can't display English style?
Message-Id: <87em2vkmhc.fsf@limey.hpcc.uh.edu>

>> On Fri, 08 Sep 2000 14:49:27 GMT,
>> ginola@mailcity.com (Ivan Lee) said:

>>>> On Fri, 08 Sep 2000 13:52:33 GMT, ginola@mailcity.com
>>>> (Ivan Lee) said:
>>  the line start with # can display probably, but when I
>> exchange the date and month, it can't display the day,
>> why is that?  moreover, in both case I display the year
>> is "100" is that normal?
>> 
>> perldoc -f localtime
>> 
>> See also "perldoc POSIX" for strftime() which makes
>> arbitrary date formatting trivial.
>> 
>> hth t

[rearranged for legibility ]

> but I am using in cgi ...  so do I need to do
> calculation or there is other way to display 2000

Completely irrelevant.  The date doesn't magically change
just because you're using the web (although time does
often seem to flow at a different speed).

    print "2000\n";

will display 2000 :-)

strftime() really is the simplest solution:

    use POSIX 'strftime';
    my $datestr = strftime('%Y-%m-%d %T', localtime);

    print "$datestr\n";

        2000-09-08 09:05:08

hth
t
-- 
WWNKD?


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

Date: Fri, 8 Sep 2000 14:47:58 +0100
From: Steve Drewell <bd83h@bedford.waii.com>
Subject: Environment variables - how to list them all?
Message-Id: <1000908144212.29022I-100000@bisv3.bedford.waii.com>

I'm new to perl and would like to know how to get a list of ALL
environment variables and their values from within a perl script.
Something equivalent to the "env" command in a c-shell is what
I'm after.

Any help will be appreciated.

Cheers,
Steve

Western Geophysical, Bedford, UK
Tel: +44 (0) 1234 224404
Fax: +44 (0) 1234 224517



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

Date: Fri, 8 Sep 2000 07:04:14 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: Environment variables - how to list them all?
Message-Id: <ol6u5.143$QB6.70591@news.uswest.net>


"Steve Drewell" <bd83h@bedford.waii.com> wrote:
> I'm new to perl and would like to know how to get a list of ALL
> environment variables and their values from within a perl script.
> Something equivalent to the "env" command in a c-shell is what
> I'm after.

All the environment variables are stored in the %ENV hash.
(And, conversely, storing a value in the %ENV hash results
in the setting of an environment variable)

For example:


foreach (sort keys %ENV)
    {
    print "$_ = $ENV{$_}\n";
    }





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

Date: Fri, 08 Sep 2000 13:31:50 GMT
From: Margarit Nickolov <man@rila.bg>
Subject: file creation time ?
Message-Id: <8papo5$k6t$1@nnrp1.deja.com>

Hi all,
simple question: how can I get creation time of a file (not last
modification time(stat(file))[10]) ) ? Thanks.

              best ragards, margarit nickolov.


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


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

Date: 8 Sep 2000 07:49:44 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: file creation time ?
Message-Id: <39b8ee78$1@cs.colorado.edu>

In article <8papo5$k6t$1@nnrp1.deja.com>,
Margarit Nickolov  <man@rila.bg> wrote:

>simple question: how can I get creation time of a file (not last
>modification time(stat(file))[10]) ) ? Thanks.

Preferred mechanism to finding file-creation time:
    1) Write your own operating system
    2) Add a syscall that does this
    3) Run that syscall

Alternate mechanism for finding file-creation time:
    1) unlink the file
    2) create the file anew with O_EXCL 
    3) record the current time somewhere

--tom


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

Date: 8 Sep 2000 14:46:35 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: file creation time ?
Message-Id: <slrn8rhuub.dhi.vek@pharmnl.ohout.pharmapartners.nl>

On 8 Sep 2000 07:49:44 -0700, Tom Christiansen <tchrist@perl.com> wrote:
>In article <8papo5$k6t$1@nnrp1.deja.com>,
>Margarit Nickolov  <man@rila.bg> wrote:
>
>>simple question: how can I get creation time of a file (not last
>>modification time(stat(file))[10]) ) ? Thanks.
>
>Preferred mechanism to finding file-creation time:
>    1) Write your own operating system
>    2) Add a syscall that does this
>    3) Run that syscall
>
>Alternate mechanism for finding file-creation time:
>    1) unlink the file
>    2) create the file anew with O_EXCL 
>    3) record the current time somewhere
>
>--tom



Apart from that, unix systems do not store file creation time anywhere
so on these system this information isn't available.  You may call this
a defect if you like, but that is a discussion for a different forum.



Villy


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

Date: Fri, 08 Sep 2000 14:54:56 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: how can I tell the internet speed of visitor
Message-Id: <39b8f55a.10936386@news.tiscalinet.de>

On Fri, 8 Sep 2000 15:20:08 +0800, Denson Tang <nospam.tom@hotmail.com>
wrote:

> I want to know the internet speed connection of a website visitor, how 
> can I achieve that we PERL?

print <<EOF;
<form action="/your/script" method="POST">
Please enter your Internet connection speed: <input type="text"
size="20"> <input type="submit"></form>
EOF

Or you could phone up their ISP and ask whether they're connected at
50666 or 48000 or 49221 or whatever bps this time, and maybe they can
also tell you the current bps rate by looking at their equipment.

(A) This has nothing to do with Perl (it looks more like a CGI question,
since the problem is the same whether your web site uses PHP, or
CGI+Perl, or CGI+shell scripts, or ASP+VBScript), and (B) I think the
only people who know the speed are the user and his ISP. So you'd have
to ask one of them. How else did you think you could find out?

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Fri, 08 Sep 2000 14:20:42 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: How to delete line #1
Message-Id: <_A6u5.2750$WD3.83306@news20.bellglobal.com>

Brendon Caligari <bcaligari@my-deja.com> wrote:
: In article <39B8B5A3.DD2F206E@delta.de>,
:   Ralf Heydenreich <heydenreich@delta.de> wrote:
:> perhaps you can try this:
:>
:> $firstflag=0;
:> open(FILE, "< yourlogfile.log");
:> open(NEWLOG, "> newlogfile.log");
:> while(<FILE>)
:> {
:> 	next if( $firstflag++ == 0 );
:> 	print NEWLOG $_;
:> }
:> close(NEWLOG);
:> close(FILE);
:>

: for(<FILE>;<FILE>;) { print(NEWLOG); }
: Brendon
: ++++

	$ perl -ne'log$.&&print' whatever.txt

/Yanick

-- 
print map chr int ($_/1.1), map ord, split '', 
      'bp€$kz{€sp~$Yp~w$skmvp~3';


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

Date: Fri, 08 Sep 2000 15:01:24 +0100
From: Tim Cockle <T.Cockle@staffs.ac.uk>
To: Gisle Aas <gisle@ActiveState.com>
Subject: Re: HTML::parse bug
Message-Id: <39B8F134.7695D48E@staffs.ac.uk>

It appears this is a platform dependence problem!

It works fine on my Linux box.

Good luck!

Tim




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

Date: Fri, 08 Sep 2000 13:50:41 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: London =?iso-8859-1?Q?=A330-35K?= Perl Programmers Required
Message-Id: <slrn8rhrle.8ll.tjla@thislove.dyndns.org>

I was shocked! How could Tony Bowden <tony@pyxis.blackstar.co.uk>
say such a terrible thing:
>Russ Jones <russ_jones@rac.ray.com> wrote:
>> Since I only piss for two or three hours a day, I'd starve on that. 
>
>That's 30 seconds every 5 minutes or so ...

ETOOMUCHINFORMATION

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
BOFH excuse #277:

Your Flux Capacitor has gone bad.


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

Date: Fri, 08 Sep 2000 13:42:17 GMT
From: Ville Mattila <ville.mattila@nettipaa.fi>
Subject: Multiple socket
Message-Id: <8paqbj$kuu$1@nnrp1.deja.com>



Hello,

I'm looking for a way how I could make a some kind of server software
with Perl. I have found the system of sockets etc, but as I have tried,
it can handle only one session by once. Is there any solution to handle
multiple ones?

Or, is it possible to make one always on -socket and then "temporarily"
sockets as a server?

--
 ...............................
Ville Mattila
Ikaalinen, Finland


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


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

Date: Fri, 08 Sep 2000 14:37:47 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: New Perl Tutorial - www.perltutor.com
Message-Id: <slrn8rhudn.8ll.tjla@thislove.dyndns.org>

I was shocked! How could huw_watkins@my-deja.com <huw_watkins@my-deja.com>
say such a terrible thing:
>Anyone new to Perl might find the following link useful:
>
>http://perltutor.com
>
>PerlTutor.com is a free Perl tutorial, mainly aimed at
>complete newbies, but also possibly of use to those with
>some experience in Perl.

I really think you need to use the '-w' flag for all of your scripts as
well as the 'use strict' pragma.  For a tutorial level site aimed at
people who don't know perl it is essential (I think) to start them out
on the right track, and this means using all the help that is available.

I have read the first section so far and apart from that flaw the thing
seems well paced. I was able to answer all the questions (although I
doubt I am who you are aiming the thing at) and I feel they are quite
fair. I like the way you concentrate on "good programming practice"
(meaningful variable names and such).

You have an error in the section on strings. You say the literal
'C:\\AUTOEXEC.BAT' is interpolated into C:\AUTOEXEC.BAT which is clearly
wrong. Also given that you assume no previous knowledge of programming,
a better introduction to what a backslash in a double quoted string 
means might be a good thing to put in, in place of the complete list of
backslash escapes which I doubt someone would really need to learn at
their first try at programming.

You use the phrase "Each time you use <STDIN> where a scalar value is
expected" without really what scalar context is or what the alternatives
are. A simple example showing what happens when you do:

$line = <STDIN>;

as opposed to:

@lines = <STDIN>;

would help I think. You also use the chop() operator where it is
probably better to use chomp(). In any case, the use of chop() where you
say is unnecessary since in the example you give the input is used as a
number. I know I'm probably being quite picky, but for people who are
completely new to programming it is important I think to get the details
right and to pick a fairly simple subset of what you are trying to
teach.

In the section on concatenation you do a useless stringification:

print 'Welcome, ' . "$name" . "\n" . 'Please select a menu option' .
"\n";

Also I think it could be instructive to compare the effect of:

'Welcome to the home page of ' . $name;

to the equivalent:

"Welcome to the home page of $name";

This would help reinforce the stuff you have already gone over.

You have the blatantly false "Expressions may occur on the right hand
side of the '=' operator". I don't know about you but in "$x = $y * 2"
the variable $x is a perfectly valid expression.

>It features Javascript quiz questions to test progress,
>plus exercises with sample answers.

I like these things. They are fun and quick to do :)

>The tutorial is incomplete as yet, but I'm adding new
>lessons at a rate of one or two per week.

I like the way you don't talk down to your readers.

>There are currently twelve complete lessons:
>Getting Started, Scalar Data, Operators, Control Structures,
>Lists and Arrays, The $_ variable, Associative Arrays,
>Command Line Arguments, Subroutines, Logical Operators,
>Working with Files, File Test Operators.

Way too many for me to go through them all. I hope you aren't put out
by this, I think your tutorial is a good resource...I don't usually
bother with this much effort unless I think it's worth it.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I tell ya, I was an ugly kid.  I was so ugly that my dad kept the kid's
picture that came with the wallet he bought.
		-- Rodney Dangerfield


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

Date: 8 Sep 2000 08:52:36 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: New Perl Tutorial - www.perltutor.com
Message-Id: <39b8fd34$1@cs.colorado.edu>

In article <slrn8rhudn.8ll.tjla@thislove.dyndns.org>,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I really think you need to use the '-w' flag for all of your scripts as
>well as the 'use strict' pragma.  

NB: The "use warnings" pragma is safer and more functional than a
mere -w.  Why?  Because it's lexically scoped.  That way you don't
autoenable warnings in separate lexical scopes--read, module
files--that you don't have control over.

Advocate "use warnings" over -w in most cases.  See also the perllexwarn
manpage and the -W and -X entries in the perlrun manpage.

--tom


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

Date: Fri, 08 Sep 2000 13:56:14 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: open'ing lynx doesn't work when called by cron
Message-Id: <8par5h$lri$1@nnrp1.deja.com>

Hi,

Recently lynx on our system was upgraded (sorry I don't have the new
version number as I'm without telnet access) and if you run this from a
perl script called via cron:

 open(RESULT, "lynx -dump \"http://www.site.com\"|") || die "can't: $!";

then you get nothing (and no error). So I played about a bit by running
the lynx command via crontab in a shell script and found that it was
failing with the error:

Your terminal lacks the ability to clear the screen or position the
cursor.

Apparantly the solution (according to the lynx bugs mailing list) is to
place

 TERM=dumb

before the lynx call (and not to use -term=DUMB as that doesn't work),
which is great for shell scripts but I've no idea how to do that via
perl.

Can anyone advise?

Many thanks in advance.

Rich


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


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

Date: Fri, 08 Sep 2000 14:33:42 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: open'ing lynx doesn't work when called by cron
Message-Id: <8patc5$oln$1@nnrp1.deja.com>

In article <8par5h$lri$1@nnrp1.deja.com>,
  Richard Lawrence <ralawrence@my-deja.com> wrote:
> Hi,
>
> Recently lynx on our system was upgraded (sorry I don't have the new
> version number as I'm without telnet access) and if you run this from
a
> perl script called via cron:
>
>  open(RESULT, "lynx -dump \"http://www.site.com\"|") || die "can't:
$!";
>

You might want to use the LWP::* modules

here is a perl oneliner from: "perldoc lwpcook" that saves downloads
and saves a remote file/page to your local drive.

perl -MLWP::Simple -e 'etstore
"ftp://ftp.sunet.se/pub/lang/perl/CPAN/src/latest.tar.gz",
                  "perl.tar.gz"'

--
=============================
Richard More
http://www.richmore.com/


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


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

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


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