[18023] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 183 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 31 14:06:01 2001

Date: Wed, 31 Jan 2001 11:05:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980967923-v10-i183@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 31 Jan 2001     Volume: 10 Number: 183

Today's topics:
    Re: 'apply' function in perl? <perin@panix.com>
    Re: 'apply' function in perl? <joe+usenet@sunstarsys.com>
        Advanced regexp question wigren@mail.org
    Re: Allocating ports in perl <not@defined.com>
        Array Question amerar@ci.chi.il.us
    Re: buffering of STDIN tigra@sky.deep.ru
    Re: buffering of STDIN (Rafael Garcia-Suarez)
    Re: buffering of STDIN tigra@sky.deep.ru
    Re: Can't copy a database handle using DBI nobull@mail.com
        Cant gunzip pmtools-1.00.tar.gz blackpike@my-deja.com
        create a nt-link for existing file _tosch_@yahoo.com
    Re: Do threads really work? (Andy Dougherty)
        Executing external applications in Perl <peter@viasafe.com>
    Re: exists news reply grabber? [somewhat OT] (Greg Bacon)
    Re: exists news reply grabber? [somewhat OT] (=?iso-8859-1?Q?J=F6rg?= Ziefle)
    Re: exists news reply grabber? [somewhat OT] (Abigail)
    Re: Fish v Fishing lessons - again! nobull@mail.com
    Re: Fish v Fishing lessons - again! (BUCK NAKED1)
    Re: forcing compile errors on undeclared vars? iwelch@my-deja.com
    Re: ftp measurement <Atmosfear@t-online.de>
        get arrow key stroke <cpegbeggar@mail.com>
        Help Reg expr to handle variables safely? perlop confus chuckk@monmouth.com
        How to split one program on multiple pages ? <nvanomme@smg.cutoff.ulb.ac.be>
    Re: How to split one program on multiple pages ? (Rafael Garcia-Suarez)
    Re: How to split one program on multiple pages ? nobull@mail.com
        Install Qestion aotto2@my-deja.com
        interpolate object notation? <rfoskett@my-deja.com>
    Re: interpolate object notation? nobull@mail.com
        Is there a module that does... <ducateg@info.bt.co.uk>
    Re: Iterating through matches to a regexp ? <ren.maddox@tivoli.com>
        message threading algorithm in Perl (=?iso-8859-1?Q?J=F6rg?= Ziefle)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 31 Jan 2001 11:23:08 -0500
From: Lewis Perin <perin@panix.com>
Subject: Re: 'apply' function in perl?
Message-Id: <pc7g0hzg07n.fsf@panix6.panix.com>

mjd@plover.com (Mark Jason Dominus) writes:

> In article <pc7y9vs1z15.fsf@panix2.panix.com>,
> Lewis Perin  <perin@panix.com> wrote:
> >Might it not be nice to have a curried version without locals:
> >> Now you can call 
> >> 
> >>         reduce { $a + $b } 0, (1,4,2,8,5,7);
> >
> >seduce { $_[0] + $_[1] } 0 , (1,4,2,8,5,7);
> 
> 
> Sure, but I don't see what the benefit is.  

  use Benchmark;
  # ....
  my $rumRef = sub{ &$rum(1,4,2,8,5,7) };
  my $sumRef = sub{ &$sum(1,4,2,8,5,7) };
  print timethis(100000, $rumRef, 'rum'), "\n";
  print timethis(100000, $sumRef, 'sum'), "\n";

yields

         rum:  7 wallclock secs ( 6.44 usr +  0.00 sys =  6.44 CPU)
  Benchmark=ARRAY(0xcb9d7c)
         sum: 10 wallclock secs ( 9.13 usr +  0.00 sys =  9.13 CPU)
  Benchmark=ARRAY(0xcb9bc0)

>{ $a + $b } is easier to read and to type than { $_[0] + $_[1] }.

Certainly it's easier to type, but I tend to find anything involving
locals harder to read (or at least understand!)

/Lew
-- 
Lew Perin / perin@mail.med.cornell.edu / perin@acm.org
www.panix.com/~perin/


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

Date: 31 Jan 2001 12:00:04 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: 'apply' function in perl?
Message-Id: <m3snlz8xnv.fsf@mumonkan.sunstarsys.com>

Lewis Perin <perin@panix.com> writes:

> mjd@plover.com (Mark Jason Dominus) writes:
> 
> > In article <pc7y9vs1z15.fsf@panix2.panix.com>,
> > Lewis Perin  <perin@panix.com> wrote:
> > >Might it not be nice to have a curried version without locals:
> > >> Now you can call 
> > >> 
> > >>         reduce { $a + $b } 0, (1,4,2,8,5,7);
> > >
> > >seduce { $_[0] + $_[1] } 0 , (1,4,2,8,5,7);
> > 
> > 
> > Sure, but I don't see what the benefit is.  
> 
>   use Benchmark;
>   # ....
>   my $rumRef = sub{ &$rum(1,4,2,8,5,7) };
>   my $sumRef = sub{ &$sum(1,4,2,8,5,7) };
>   print timethis(100000, $rumRef, 'rum'), "\n";
>   print timethis(100000, $sumRef, 'sum'), "\n";
> 
> yields
> 
>          rum:  7 wallclock secs ( 6.44 usr +  0.00 sys =  6.44 CPU)
>   Benchmark=ARRAY(0xcb9d7c)
>          sum: 10 wallclock secs ( 9.13 usr +  0.00 sys =  9.13 CPU)
>   Benchmark=ARRAY(0xcb9bc0)

Benchmarks are a red herring.  That there is a performance discrepancy
has to do with the fact that mjd's reduce didn't alias $b to $_; 
hence his "for(@_)" loop is slower than yours.  Try comparing 
seduce with this version of reduce:

sub reduce (&$@) {
    my $code = shift;
    my $r1 = sub { 
	my $id = shift;
	my $r2 = sub {
	    local ($a, *b) = ($id, *_); # @b, $b aliased to @_, $_

	    for (@b) {
                $a = &$code;
	    }

	    $a;
	};
	return @_ ? $r2->(@_) : $r2;
    };
    return @_ ? $r1->(@_) : $r1;
}
 
> >{ $a + $b } is easier to read and to type than { $_[0] + $_[1] }.
> 
> Certainly it's easier to type, but I tend to find anything involving
> locals harder to read (or at least understand!)

Ignorance is not bliss in Perl; learn about how to use symbols and
alias them. OOP Ch.2 has a nice section on typeglobs, and it's worth 
a look. 

HTH
-- 
Joe Schaefer



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

Date: Wed, 31 Jan 2001 18:02:10 GMT
From: wigren@mail.org
Subject: Advanced regexp question
Message-Id: <959jur$nks$1@nnrp1.deja.com>

I'm porting a program that I've written in Python to Perl. It's a
wrapper for 20+ archive, diskimage and compression tools, to
list/extract/create/add to 40+ common and obscure archive and diskimage
types using the same command, same syntax and same list-output.

In the old Python-version I stored the regexps to parse the list-output
in a hash (imported from a separate file) using filetype as the key.
The regexps looks something like:

^\s*(?:P<size>\d+)\s+(?:P<month>\d\d)-(?:P<day>\d\d)-(?:P<year>\d\d)
(?:P<file>.*)$
or
^\s*(?:P<year>\d{4})-(?:P<month>\w{3})-(?:P<day>\d\d)\s+(?:P<size>\d\d)
(?:P<file>.*)$

Then the match then returns a hash (called "dictionary" in Python) that I can
use like:
filelist.append((hash["file"],hash["size"],hash["year"],hash["month"],hash["d
ay"]))

How can I simulate this behaviour in Perl??  Please help!

Best regards
Per Wigren


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 16:33:15 GMT
From: "Koen Bossaert" <not@defined.com>
Subject: Re: Allocating ports in perl
Message-Id: <f7Xd6.64$h_5.2912@nreader1.kpnqwest.net>


<ayeletma1@my-deja.com> wrote in message news:950aga$2jc$1@nnrp1.deja.com...
> In article <903493374NickCondon@132.146.16.23>,
>   nickco3@yahoo.co.uk (Nick Condon) wrote:
> > ayeletma1@my-deja.com wrote in <94opki$ul6$1@nnrp1.deja.com>:
> >
> > >I need to allocate a port and check port status from a perl script.
> > >Is there a function or a package I can use?
> >
> > A serial/parallel port? A TCP socket? Tell us more.
> >
>
> A TCP socket. I want to be able to find from a perl program which
> program use a certain socket and what is the port status.
>

Use the IO::Socket module.  There is an RFC that contains the standard ports
for a lot of applications, RFC 1700 or are you going to make a portscanner?



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

Date: Wed, 31 Jan 2001 18:45:02 GMT
From: amerar@ci.chi.il.us
Subject: Array Question
Message-Id: <959mfc$qaa$1@nnrp1.deja.com>



Hello,

I am trying to see how I can create a multi-dimentional array in Perl.
I cannot seem to find any examples......can anyone point me in the
right direction?

Thanks,

Arthur
amerar@ci.chi.il.us

PS.  Please CC a copy to my e-mail.


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 14:02:03 GMT
From: tigra@sky.deep.ru
Subject: Re: buffering of STDIN
Message-Id: <9595sm$9rh$1@nnrp1.deja.com>

In article <slrn97fj5s.6g3.rgarciasuarez@rafael.kazibao.net>,
  rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> Roman Chumakov wrote in comp.lang.perl.misc:
> > Situation:
> > while(<STDIN>){
> >     #process line
> > }
> >
> > If an input line will be very-very large ...
> > all memory may be used up...
> >
> > How can I limit input string in <STDIN>?
>
> Are you reading a binary file ? Then use the read() function to read
> fixed-length blocks of data.

Or set $/ = 32768 to read in 32K chunks (or as much as you want). But
IMHO read() is just cooler :).


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 14:36:24 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: buffering of STDIN
Message-Id: <slrn97g8of.79b.rgarciasuarez@rafael.kazibao.net>

tigra@sky.deep.ru wrote in comp.lang.perl.misc:
> In article <slrn97fj5s.6g3.rgarciasuarez@rafael.kazibao.net>,
>   rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> > Roman Chumakov wrote in comp.lang.perl.misc:
> > > Situation:
> > > while(<STDIN>){
> > >     #process line
> > > }
> > >
> > > If an input line will be very-very large ...
> > > all memory may be used up...
> > >
> > > How can I limit input string in <STDIN>?
> >
> > Are you reading a binary file ? Then use the read() function to read
> > fixed-length blocks of data.
> 
> Or set $/ = 32768 to read in 32K chunks (or as much as you want). But
> IMHO read() is just cooler :).

You meant $/ = \32768 (see perlvar).

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


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

Date: Wed, 31 Jan 2001 16:56:44 GMT
From: tigra@sky.deep.ru
Subject: Re: buffering of STDIN
Message-Id: <959g46$ju5$1@nnrp1.deja.com>


> > Or set $/ = 32768 to read in 32K chunks (or as much as you want).
But
> > IMHO read() is just cooler :).
>
> You meant $/ = \32768 (see perlvar).

Yes. Thanks for corrections.

Sergey


Sent via Deja.com
http://www.deja.com/


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

Date: 31 Jan 2001 17:59:27 +0000
From: nobull@mail.com
Subject: Re: Can't copy a database handle using DBI
Message-Id: <u91ytjppq8.fsf@wcl-l.bham.ac.uk>

mwarnes7676@my-deja.com writes:

> Subject: Can't copy a database handle using DBI

Always try to reduce your problem to its simplest form.  Your problem
has nothing to do with DBI.

Also I should point out that this looks suspiciously similar to
another thread "DBI problem; can't use a reference to a db handle".
Do not start multiple threads on the same question unless your
intension is to create annoyance.

> my $dbh1 = DBI::connect("DBI:ODBC:source1"....);
> my $dbh2 = DBI::connect("DBI:ODBC:source2"....);
> .
> .
> my $handle = 'dbh1'; # This would be picked up from a file for example
> my $dummydbh = ${$handle}; # $dummydbh becomes $dbh1
> my $sth = $dummydbh->prepare(...);

Simplify this to:

my $dbh1 = 'Hello world';
my $handle = 'dbh1';
my $dummydbh = ${$handle};
print "$dummydbh\n";

You are trying to use symbolic references to lexically scoped
variables.  This doesn't work.  Use global (package) variables or
better still elimiate the use of symbolic references.

my %dbh = ( 
    dbh1 => DBI::connect("DBI:ODBC:source1"....),
    dbh2 => DBI::connect("DBI:ODBC:source2"....),
);

my $handle = 'dbh1'; # This would be picked up from a file for example
my $sth = $dbh{$handle}->prepare(...);

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 31 Jan 2001 14:11:48 GMT
From: blackpike@my-deja.com
Subject: Cant gunzip pmtools-1.00.tar.gz
Message-Id: <9596es$acs$1@nnrp1.deja.com>

Hello everyone,
   I'm trying to install pmtools-1.00, but every version I've
downloaded fails to gunzip.
I'm using Redhat Linux 5.2 and Gunzip verion 1.2.4 (18 Aug 93)

Thanks in advance



Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 14:21:59 GMT
From: _tosch_@yahoo.com
Subject: create a nt-link for existing file
Message-Id: <95971t$au1$1@nnrp1.deja.com>

hi,

i want to create links for several files automatically. I did some
tests with cygwin's ln. I tried symbolic as well as hardlinks. I don't
know how they are implemented, but it seemed, that they differ from the
kind of Links which can be created f.i. with NT's explorer, because
they didn't show similar behavior.

What can i do to create 'windozish' File-Links with perl (or something
else) automatically.

regards,  tosch


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 18:10:55 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: Do threads really work?
Message-Id: <slrn97glbn.3u1.doughera@maxwell.phys.lafayette.edu>

In article <3A77859C.3ADE611D@iscusa.com>, Raphael wrote:
>If you can point me to an answer to this question that is great, but I have reviewed the Perl FAQ, search the Perl and CPAN web sites and have not been able to find the current status of Perl threads. I need to learn the exact status in order to decide what approach to take for a major development effort..

Please read the introduction to README.threads in the perl source kit.
It correctly describes the current status of Perl threads.  I'll quote
it here:

    Support for threading is still in the highly experimental stages.  There
    are known race conditions that show up under high contention on SMP
    machines.  Internal implementation is still subject to changes.
    It is not recommended for production use at this time.

That describes the state of the perl5.005-style threads.  Perl-5.6.0
introduced a second type of threads, interpreter-based threads, to try
to get around some of the main problems.  However that support is
incomplete, not fully documented, and there is no way to (presently)
to create threads from within Perl.

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042


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

Date: Wed, 31 Jan 2001 17:13:46 GMT
From: "Magma" <peter@viasafe.com>
Subject: Executing external applications in Perl
Message-Id: <eJXd6.8137$f5.1647245@news>

Hey,

I'm working on Windows NT 4.0.

What I need to do is run an application ( a ".exe") with a list of parameters and read back what this application writes to the
console (to parse the various return values).

I am currently using system() to execute a command as if using the command prompt to invoke the application.

I build a path to the exe. I build a string with the command and it's parameters. I append these two strings and pass it to the
system() function.

Problem 1:
    The application I am invoking needs to access certain files relative to the directory in which the exe is located . Due to where
I run my perl script from, the app cannot find these files. I have tried setting the path with another system() command ("set path
blah blah..."), with no success. How can I get this app to run as if I were runing it from it's home directory?

Problem two:
    How can I open a pipe in which to read what is written to the console when the system() call executes into an array of lines to
be parsed for specific information I need (:succes or failure... etc)?

ANy help whatsoever would be appreciated.

My email is peter@viasafe.com.

Thanks in advance.




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

Date: Wed, 31 Jan 2001 15:23:03 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: exists news reply grabber? [somewhat OT]
Message-Id: <t7gbenp3av8ac9@corp.supernews.com>

In article <slrn97fln9.747.tjla@thislove.dyndns.org>,
    Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:

: I was shocked! How could Abigail <abigail@foad.org>
: say such a terrible thing:
:
: >I guess you could ask Kibo....
: 
: Did Perl even exist when Kibo did that? (Hi Kibo *waves*)

Kibo predates Perl.  I remember reading an interview with Larry in
which he talked about initially resisting the creation of a Perl
newsgroup and instead kiboized groups like comp.unix.questions to
evangelize and convert.  Sorry, I can't find a URL. :-(

Greg
-- 
When Galileo turned his telescope toward the heavens, and allowed Kepler to
look as well, they found no enchantment or authorization in the stars, only
geometric patterns and equations.  God, it seemed, was less of a moral
philosopher than a master mathematician.  -- Neil Postman


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

Date: 31 Jan 2001 17:07:42 GMT
From: gt4556a@acmey.gatech.edu (=?iso-8859-1?Q?J=F6rg?= Ziefle)
Subject: Re: exists news reply grabber? [somewhat OT]
Message-Id: <slrn97ghiu.ri7.gt4556a@acmey.gatech.edu>

On 31 Jan 2001 08:58:54 GMT, Abigail <abigail@foad.org> wrote:

>I guess you could ask Kibo....

Ok, if now somebody could tell me what or who kibo is or where to find it/him,
then this would all make more sense to me :)

You're not talking about www.kibo.com, aren't you?

Jörg


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

Date: 31 Jan 2001 18:11:53 GMT
From: abigail@foad.org (Abigail)
Subject: Re: exists news reply grabber? [somewhat OT]
Message-Id: <slrn97glb9.cnd.abigail@tsathoggua.rlyeh.net>

Jörg Ziefle (gt4556a@acmey.gatech.edu) wrote on MMDCCX September MCMXCIII
in <URL:news:slrn97ghiu.ri7.gt4556a@acmey.gatech.edu>:
}} On 31 Jan 2001 08:58:54 GMT, Abigail <abigail@foad.org> wrote:
}} 
}} >I guess you could ask Kibo....
}} 
}} Ok, if now somebody could tell me what or who kibo is or where to find it/him,
}} then this would all make more sense to me :)
}} 
}} You're not talking about www.kibo.com, aren't you?


That's his web site.


HappyNet rulez.


Abigail
-- 
perl -wlpe '}{*_=*.}{' file  # Count the number of lines.


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

Date: 31 Jan 2001 17:40:09 +0000
From: nobull@mail.com
Subject: Re: Fish v Fishing lessons - again!
Message-Id: <u97l3bpqme.fsf@wcl-l.bham.ac.uk>

"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> Eric Bohlman wrote:
> > Not to mention that a surprising number of the fish given out here, by
> > generally well-meaning people, are rotten.  The FAQs are prepared under
> > sanitary conditions.

> Sanitary conditions are often found in infirmaries
> for the mentally disabled.

So are lightbulbs, notebooks and many other things.  I fail to see the
relevance.

I should also note that Webster's defines sanitary thus:

1 : of or relating to health
2 : of, relating to, or used in the disposal especially of domestic
waterborne waste
3 : characterized by or readily kept in cleanliness

I assume Eric was refering to (3).  The trouble is that the first
definition that comes into my mind is always (2).

> My experience is when I read Perl documentation, I sense a smell of
> long dead fish and sense sounds, odd clicketyclack sounds of
> one-hundred monkeys.

Yes, is true that some of the manuals are full of rotting fish.  When
you tell someone to RTFM you must only do so if you've read and agree
with the manual and the manual actually does answer the question.  It
is also true that many of the regulars here are guilty of giving RTFM
responses without doing the requiste checking.  Noteably these
regulars include both Godzilla and some of her most vocal detractors.

If a manual is found to be full of rotting fish we can do something
about it - we can submit patches.  When someone is pesistantly handing
out predomonantly rotten fish in the newsgroups we do try to apply a
"patch" to that person's behaviour.  Unfortunately, repeated
experience has shown that they often respond with personal attacks.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 31 Jan 2001 11:46:58 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Fish v Fishing lessons - again!
Message-Id: <17060-3A784F92-9@storefull-246.iap.bryant.webtv.net>

Ah!... the old fish story again. While I agree to some extent, perhaps
the person has already been starving for awhile. In that instance, a
lone fish could save their life or at least keep them from becoming more
ill. So, in some situations, if the fish were not given immediately, the
person could die... and the rivers of other fish to be had, would be
useless for that particular person.

I suggest that we simultaneously throw a fish, and teach people how to
fish whenever possible.

Regards,
Dennis



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

Date: Wed, 31 Jan 2001 15:11:03 GMT
From: iwelch@my-deja.com
Subject: Re: forcing compile errors on undeclared vars?
Message-Id: <9599tv$dkq$1@nnrp1.deja.com>



I presume the silence means that the answer here is "no".  It is
impossible to require definition at compilation time when a variable
name contains a module identifier...

In article <94pl2e$lb6$1@nnrp1.deja.com>,
  iwelch@my-deja.com wrote:
>  is it possible to force perl at compile time to check whether package
> variables have really been declared
>  (using "our")?
>
>  #!/usr/bin/perl -w
>  use strict;
>  use p1;
>  use strict;
>  print "hello";
>  print "variable 1 is ".$p::var1."\n";
>  print "variable 2 is ".$p::var2."\n";  # NOT DEFINED #print
> "compile-error".$compileerror."\n";
>
>  and p1.pm is
>
>  package p;
>  use strict;
>  our $var1="defined";
>  1;
>
>  I would like the perl compiler to die with an error telling me that
it
> never saw an "our $var2" declaration in
>  module p.
>
> Sent via Deja.com
> http://www.deja.com/
>


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 15:17:30 +0100
From: "Atmosfear" <Atmosfear@t-online.de>
Subject: Re: ftp measurement
Message-Id: <9596pm$mje$00$1@news.t-online.com>

"Florian Albrecht" <Florian.Albrecht@alcatel.de> wrote in message
news:3A77EAD5.C8E46B04@alcatel.de...
> Hi Everybody!
>
> I have a little problem making big trouble. I want to measure the time a
> single file needs to download on the local pc. This time is also printed
> after you made a ftp "get" command, e.g. "0.333 secs for 2345251 bytes"
> or something like that.
> First I tryed to do something with open(FTP, "|ftp 192.168.0.2"), but I
> couldn't manage this. Then I used the module Net::FTP with its methods
> together with a time measurement method from the perldoc. Unfortunately,
> this didn't run, because the script continues while downloading, I
> suppose.
>

I would just take the unix timestamp before a file-transerf with Net::FTP,
ie by $time = time, and after the transfer do time - $time and you have the
time in seconds, the transfer took.
If you want to measure in milliseconds, use Time::HiRes.

> Does anyone have a solution? Or a hint?
>
> Thanks
> ;-) Flo

Best Regards,
  Atmosfear




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

Date: Thu, 01 Feb 2001 02:04:34 +0800
From: Beggar <cpegbeggar@mail.com>
Subject: get arrow key stroke
Message-Id: <3A7853B2.A5AFC374@mail.com>

Hi all,

How can I check if the user has press the arrow keys?
(up, down, left, right)

Please cc reply to cpegbeggar@mail.com

Thanks!

Hei



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

Date: Wed, 31 Jan 2001 17:28:00 GMT
From: chuckk@monmouth.com
Subject: Help Reg expr to handle variables safely? perlop confusing.
Message-Id: <959huh$loj$1@nnrp1.deja.com>

Hello all,

I've just read the perlop section of the faq on quoting.
But I'm still confused about special charaters in the string like
$&@*.? etc...

Say I have a variable that contains the following:
$a='mydir/myfile$_&?.txt';
$b='$_&?';
$c='^&*"';

And I want to safely replace via substitution $_&? with anything else
(like xzy)

What is the simplest way to avoid problems with special characters in
the original string AND the replacement string.


Is this the safest way to do this:?
$a='mydir/myfile$_&?.txt';
$b='$_&?';
$c='^&*"';

$d= $a;
$d =~ s,\Q$b\E,\Q$c\E,g;

IS THIS THE SAFEST SIMPLEST WAY - OR WHAT OTHER WAYS COULD I DO THIS?

Thanks,
Chuck
chuckk@monmouth.com


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 15:23:12 +0100
From: Nikolaj van Omme <nvanomme@smg.cutoff.ulb.ac.be>
Subject: How to split one program on multiple pages ?
Message-Id: <3A781FD0.B32A7388@smg.cutoff.ulb.ac.be>

Hello,

I didn't find the answer in the FAQ (but there are so many that I
couldn't read everything).

I would like to write a huge program (thousands of lines) and to split
it in different files in the same directory or in different directories.
I do not need to make modules. 

(I can make modules if someone could tell me how to share all the global
variables in the program and in the modules (i.e. I want to use a global
variable of the program into a module and, vice-versa, I want to use a
global variable from the module into the main program whitout naming my
variables like $MAIN::VARIABLE)).

Could somebody help me ? Thanks a lot,

Nikolaj
-- 
Nikolaj van Omme
nvanomme@smg.ulb.ac.be


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

Date: Wed, 31 Jan 2001 14:41:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How to split one program on multiple pages ?
Message-Id: <slrn97g91i.79b.rgarciasuarez@rafael.kazibao.net>

Nikolaj van Omme wrote in comp.lang.perl.misc:
> 
> I would like to write a huge program (thousands of lines) and to split
> it in different files in the same directory or in different directories.
> I do not need to make modules. 

Then use 'require'. Look it up in perlfunc.

> (I can make modules if someone could tell me how to share all the global
> variables in the program and in the modules (i.e. I want to use a global
> variable of the program into a module and, vice-versa, I want to use a
> global variable from the module into the main program whitout naming my
> variables like $MAIN::VARIABLE)).

Using a global variable from the main program in a module is not a sign
of good software design.

Anyway, if you want to import some identifiers declared by a module in
the caller's namespace, then your module should use the Exporter module.
That's also in the docs.

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


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

Date: 31 Jan 2001 17:49:08 +0000
From: nobull@mail.com
Subject: Re: How to split one program on multiple pages ?
Message-Id: <u94ryfpq7f.fsf@wcl-l.bham.ac.uk>

Nikolaj van Omme <nvanomme@smg.cutoff.ulb.ac.be> writes:

> I would like to write a huge program (thousands of lines) and to split
> it in different files in the same directory or in different directories.
> I do not need to make modules. 

> (I can make modules if someone could tell me how to share all the global
> variables in the program and in the modules (i.e. I want to use a global
> variable of the program into a module and, vice-versa, I want to use a
> global variable from the module into the main program whitout naming my
> variables like $MAIN::VARIABLE)).

Simply omit the "package" line from your modules so that everything is
in one namespace.

> Could somebody help me ? Thanks a lot,

You really should reconsider _wanting_ to program in such a poor style.
(This is nothing to do with Perl - massive use of global variables is
language-independant poor practice).

I think it would be better to use proper modules and use the Exporter
module to allow them to share global variables where necessary.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 31 Jan 2001 16:14:04 GMT
From: aotto2@my-deja.com
Subject: Install Qestion
Message-Id: <959dk2$hfj$1@nnrp1.deja.com>




Sorry for this stupid question's but i'm new ...

  > PWD:/home/f994236/src/perl-5.6.0


  1)  I want perl to install in my own location...
         /home/f994236/usr/local
      How to configure this

  2)  If you read "INSTALL" you only have to type
          rm -f config.sh Policy.sh
          sh Configure -de
          make
          make test
          make install
      to configure and install perl ....
      but this doesn't work no "Makefile" was created
      no "config.sh" or "Policy.sh" was created



does help is available ???

  Thanks ....


mfg

  aotto :)


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 31 Jan 2001 16:37:19 GMT
From: rog <rfoskett@my-deja.com>
Subject: interpolate object notation?
Message-Id: <959evu$ipb$1@nnrp1.deja.com>

Hi, silly little question really.

Is there a way to interpolate method calls within a string?

For example, I would like to do this:

    print "Value = $obj->func\n";

instead of:

    print "Value = ".$obj->func."\n";

- which in my opinion looks messier (starting to look like Java :-)

In a desperate attempt, I tried messing around with things like:

    print "Value = ${$obj->func}\n";
    print "Value = &{$obj{func}}\n";

But obviously these dont work (I dont think I understand enough about
how methods are related to a blessed object).

I've had alook around the pod documentation but cannot find anything -
can someone please enlighten me as to whether this is possible or
whether I am asking for too much?

Many thanks

Roger Foskett


Sent via Deja.com
http://www.deja.com/


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

Date: 31 Jan 2001 18:13:19 +0000
From: nobull@mail.com
Subject: Re: interpolate object notation?
Message-Id: <u9vgqvoaio.fsf@wcl-l.bham.ac.uk>

rog <rfoskett@my-deja.com> writes:

> Is there a way to interpolate method calls within a string?
> instead of:
> 
>     print "Value = ".$obj->func."\n";

FAQ: "How do I expand function calls in a string?"

> In a desperate attempt, I tried messing around with things like:
> 
>     print "Value = ${$obj->func}\n";

Very close.  You'll kick yourself when you read the FAQ.  Which is all
right and proper - people who post FAQs should be kicked. :-)

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 31 Jan 2001 15:58:09 -0000
From: "Géry" <ducateg@info.bt.co.uk>
Subject: Is there a module that does...
Message-Id: <959crs$ifl$1@pheidippides.axion.bt.co.uk>

Hi people,

Does anyone knows of a module to programme Services under Windows NT?

This would save me the hassle of learning Windows .net interoperability with
Perl :(
--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Géry
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<




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

Date: 30 Jan 2001 21:22:50 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Iterating through matches to a regexp ?
Message-Id: <m3wvbc8kxh.fsf@dhcp11-177.support.tivoli.com>

Jerome Abela <Jerome.Abela@free.fr> writes:

> Jerome Abela wrote:
> > 'aaabbb'=~m/(a+b+)(?{push @res, $1})(?!.|$)/g;
> > print join('/', @res);
> > 
> > The result is: aaabbb/aaabb/aaab/aabbb/aabb/aab/abbb/abb/ab
> 
> m/(a+b+)(?{push @res, $1})^/g is enough. No need to use (?!).

I like it...

When this question has been asked in the past, my answer has been
something similar:

  /(a+b+)(?(?{print "$1\n"})(?!))/

or, if you don't mind using $&:

  /a+b+(?(?{print "$&\n"})(?!))/

Naturally, after seeing your solution, "(?!)" can be replaced by "^",
though I'm not sure I don't prefer the former for legibility.  But
avoiding the conditional by using the "g" modifier I very much like.

  /a+b+(?{print "$&\n"})^/g

-- 
Ren Maddox
ren@tivoli.com


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

Date: 31 Jan 2001 18:55:24 GMT
From: gt4556a@acmey.gatech.edu (=?iso-8859-1?Q?J=F6rg?= Ziefle)
Subject: message threading algorithm in Perl
Message-Id: <slrn97gnss.rn2.gt4556a@acmey.gatech.edu>

Does anyone know of an implementation of message threading (for Usenet
or email aricles) in Perl?  If not, how about another language? (I
already saw JWZ's web page http://www.jwz.org/doc/threading.html.)

[Sorry, but it gets a bit OT now.]

What data structure would you advise me to use for the representation of
the nodes - an N-ary tree?

Is there a general CS algorithm for sorting/generating such data
structures?

Do you know of a good implementation of message threading in common
software (mutt, trn, Mozilla, ...)?

Jörg


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

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 V10 Issue 183
**************************************


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