[16331] in Perl-Users-Digest
Perl-Users Digest, Issue: 3743 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 06:07:23 2000
Date: Wed, 19 Jul 2000 03:05:16 -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: <964001116-v9-i3743@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 19 Jul 2000 Volume: 9 Number: 3743
Today's topics:
Re: ???How to make Daemon in Perl without Cron? <gellyfish@gellyfish.com>
Re: closing read-only filehandles [was: Read a file int <gellyfish@gellyfish.com>
Re: Clsid Number Changes <cal@iamcal.com>
Re: configuring perl on windows2000 <gellyfish@gellyfish.com>
DB_File question. <zigouras@mail.med.upenn.edu>
Re: escaping HTML [was: limits on GET] <gellyfish@gellyfish.com>
Re: how to delete )) <mike.solomon@eps.ltd.uk>
Re: Is there a Perl bug list? <cal@iamcal.com>
Re: Module Versions <nospam@nospam.com>
Re: Module Versions <nospam@nospam.com>
Re: NEW: AI::NeuralNetwork - idea, comments (Logan Shaw)
Re: NEW: AI::NeuralNetwork - idea, comments peterhi@my-deja.com
Re: NEW: AI::NeuralNetwork - idea, comments (Mark Wright)
Re: Numerical evaluation in string <gellyfish@gellyfish.com>
Re: Passing command line regexp into perl program (Anno Siegel)
Re: Perl and Sendmail??? (Villy Kruse)
Re: Perl Expert? I need help! <iltzu@sci.invalid>
Re: Perl job offered San Mateo Perm <cal@iamcal.com>
Re: Perl on irc <lovelyspam@england.com>
Perl RTE ? <james@goodwill.globalnet.co.uk>
Perl RTE ? <james@goodwill.globalnet.co.uk>
Perl RTE ? <james@goodwill.globalnet.co.uk>
Re: Plugins architecture (Logan Shaw)
Re: Plugins architecture <carvdawg@patriot.net>
Re: Producing an executable for Perl program <gellyfish@gellyfish.com>
Re: Renaming files trough Perl? <gellyfish@gellyfish.com>
Search and replace with a large amount of text <ralawrence@my-deja.com>
Re: Search and replace with a large amount of text (jason)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Jul 2000 10:16:55 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ???How to make Daemon in Perl without Cron?
Message-Id: <8l3rm7$tt8$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 05:32:00 GMT pastan@my-deja.com wrote:
> Hello All,
>
> I need to schedule my tasks without. But unfortunately I don't have an
> opportunity to use Cron or similar. How can I implement scheduling
> by means of Perl functions such as fork, kill,...?
>
and sleep() dont forget about sleep.
Check perlfaq8 :
How do I fork a daemon process?
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 19 Jul 2000 00:17:47 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: closing read-only filehandles [was: Read a file into a hash ?]
Message-Id: <8l2oir$se7$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 11:43:26 +0200 Alan J. Flavell wrote:
> On Mon, 17 Jul 2000, Larry Rosler wrote:
>
>> I don't remember the subject; I do remember suggesting the solution --
>> close the file before unlinking or renaming it!
>
> But on systems that implement file locking, this is going to unlock
> the file - and thus let others get at it in the window before it's
> actually unlinked/renamed.
>
I think we are talking about those OS where it is not possible to rename
or unlink a file that is open in any mode whatsoever - no names no aspertions.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 19 Jul 2000 11:00:31 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Clsid Number Changes
Message-Id: <J_ed5.173$KR1.3469@news6-win.server.ntlworld.com>
"Bob Walton" <bwalton@rochester.rr.com> wrote...
:
: Hmmmm...I don't know anything about clsid's, but if all you want to do
: is "increment" a 4 character string containing letter and digits, try
: something like:
:
: $clsid='ADBE2CC0-5CD5-11D4-85DE-00105AE3A355';
: $a=substr $clsid,4,4;
: &inc_string(\$a);
: substr($clsid,4,4)=$a;
: print "$clsid\n";
:
: sub inc_string{ #increment a string ref containing letter and digits,
: any mix
: my $ref=shift;
: die "unincrementable string in sub inc_string"
: unless $$ref; #prevent infinite loop
: $$ref=~s/([a-zA-Z]*[0-9]*)$//; #get ending magical substring
: my $b=$1;
: $b++; #magical increment
: if(length($b)>length($1)){ #carry?
: $b=~s/^.//; #destroy carry digit
: &inc_string($ref); #and increment previous string
: }
: $$ref.=$b; #and tack on the result
: }
:
: This works on pathological clsid's like one starting with aaaaz8z9. I'm
: sure this could be golf'ed a bit.
I think CLSIDs use only hex digits, so this could be done:
$clsid='ADBE2CC0-5CD5-11D4-85DE-00105AE3A355';
substr($clsid,4,4) = sprintf("%4X",hex(substr $clsid,4,4)+1);
Benchmark: timing 100000 iterations of New, Old...
Old: 2 wallclock secs ( 2.17 usr + 0.00 sys = 2.17 CPU) @ 46019.33/s
(n=100000)
New: 1 wallclock secs ( 0.64 usr + 0.00 sys = 0.64 CPU) @
156006.24/s(n=100000)
Not great, but a little smaller.
--
Cal Henderson
sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);
------------------------------
Date: 19 Jul 2000 10:10:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: configuring perl on windows2000
Message-Id: <8l3r9m$tsj$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 10:57:54 GMT macromueslia wrote:
> For some reason since installing the new version of ActivePerl for win32 my
> scripts keep looking for data files in the C:\ directory. I have to type in
> the full path to the cgi-bin now...eg: $counter=
> "/IIS/www/cgi-bin/counter.dat";
>
> How do I get / to resole to the directory the script is running in?
>
Eh ? WHat do you mean 'directory the script is running in' ? : the
current working directory ? The actual location of the program ?
It is foolhardy to rely on the current working directory to be anything
particular and it is always best to supply a fully qualified path when
working in an environment such as the CGI. You seem also to be confusing
the document root of the HTTP server with an actual physical path.
On a windows machine '/' *is* 'c:\' (assuming your current working drive is
called 'C') this is no different for any program however they are run. That
a web server might appear to interpret this differently is by the by.
Anyhow, the change in behaviour is probably something you want to ask in
the group comp.infosystems.www.servers.ms-windows about ...
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 19 Jul 2000 03:11:59 -0400
From: Nico Zigouras <zigouras@mail.med.upenn.edu>
Subject: DB_File question.
Message-Id: <Pine.OSF.4.21.0007190308270.17902-100000@mail.med.upenn.edu>
As far as I know, you can't use data structures in a tied DB_file hash,
right? You can only use strings, right? When I tried to use an array as
a value strict gave me an error.
this is ok?
dbmopen( my %db, "test.db", 0666 ) || die($!);
$db{name} = "john";
dbmclose %db;
dbmopen( my %db, "test.db", 0666 ) || die($!);
print $db{name}; # this prints "john"
dbmclose %db;
but this is not?
dbmopen( my %db, "test.db", 0666 ) || die($!);
my $arr;
$$arr[0] = "john";
$$arr[1] = "doe";
$db{name} = $arr;
dbmclose %db;
dbmopen( my %db, "test.db", 0666 ) || die($!);
print join "\n", @{$db{name}}; # this gets non array ref error from strict
dbmclose %db;
Thanks.
------------------------------
Date: 18 Jul 2000 23:51:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: escaping HTML [was: limits on GET]
Message-Id: <8l2n1v$sap$1@orpheus.gellyfish.com>
On 18 Jul 2000 04:50:03 GMT jason wrote:
> Prasanth A. Kumar wrote ..
>>elephant@squirrelgroup.com (jason) writes:
>>
>>> Prasanth A. Kumar wrote ..
>>> >This brings up a related question... in the Perl CGI module, is there
>>> >a function to do the encoding for href inside of anchor tags?
>>>
>>> escape
>>>
>>> it's not part of any of the export tags so you need to import it
>>> explicitly
>>>
>>> use CGI qw'escape';
>>>
>>> works as you'd expect
>>
>>I don't think I saw that in the man pages. I there a standard way to
>>find about these kind of commands? Or do I just look at the source?
>
> it's not documented .. and yes there's a standard way - however - the
> standard way _is_ to look at the source ;)
>
> (the non-standard way is to guess)
An alternative standard way is to use Deja News to search for these things
being discussed in this group ....
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 19 Jul 2000 09:11:27 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: how to delete ))
Message-Id: <8l3nuh$3jjcp$1@ID-36965.news.cis.dfn.de>
would this work for you ?
my $foo = "aaa))ggg";
$foo =~ s/\)\)//;
print "$foo\n";
this strips the ))
Regards
Mike Solomon
<tvn007@my-deja.com> wrote in message news:8l3gtl$2bd$1@nnrp1.deja.com...
> Hi,
>
> I have tried so many way but I cannot delete this characters ))
>
> Example: I have the file as shown below:
>
>
>
> (ab
> c)
> (xyx)
> (zzz)
> ))
>
> #my script has:
>
> $/ =")";
>
> How can I delete the )) in the file above. The )) is always
> at the end of file.
>
> Thanks in advance
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 09:20:06 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Is there a Perl bug list?
Message-Id: <Awdd5.97$KR1.2297@news6-win.server.ntlworld.com>
"Mark Lewis" <nospam.nicedoctor@hotmail.com> wrote...
:
: Tried this but still nothing, just get a blank database form after
: selecting query.
:
Paste and run for sparkling results:
<form method="post" action="http://bugs.perl.org/perlbug.cgi?">
<input type="hidden" name="range" value="22031">
<input type="hidden" name="format" value="h">
<input type="submit" name="req" value="query">
</form>
If that doesn't work, god help you ;)
--
Cal Henderson
sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);
------------------------------
Date: 19 Jul 2000 09:23:55 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Module Versions
Message-Id: <8l3s3b$2t3$0@216.155.33.61>
In article <8l3dmh$1r0s$1@news.gate.net>, Prakash Kailasa
<prakash@dakota.gate.net> wrote:
[Jeopardy-quoting corrected]
| The WebDragon <nospam@nospam.com> wrote:
| : suppose I wanted to print out to a file a list of every module in
| : ./lib
| : and ./site_perl AND, if they support the $Module::VERSION scheme,
| : include its version number, otherwise left blank.
| use ExtUtils::Installed;
| my ($inst) = ExtUtils::Installed->new();
| foreach my $mod ($inst->modules()) {
| print $mod, "\t=> ", $inst->version($mod), "\n";
| }
Noticing that you are calling my ($inst) in list context instead of
scalar context -- and that sometimes that causes different things to
happen depending on the RH argument
(see another thread that mentions this :
my $date = localtime;
my ($date2) = localtime; #not the same thing!
print "$date\n$date2\n";
)
is that intentional, or are you mistaking 'my' as a function ?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 19 Jul 2000 09:44:59 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Module Versions
Message-Id: <8l3tar$65s$0@216.155.32.168>
In article <8l3s3b$2t3$0@216.155.33.61>, The WebDragon
<nospam@nospam.com> wrote:
| In article <8l3dmh$1r0s$1@news.gate.net>, Prakash Kailasa
| <prakash@dakota.gate.net> wrote:
|
| [Jeopardy-quoting corrected]
|
| | The WebDragon <nospam@nospam.com> wrote:
| | : suppose I wanted to print out to a file a list of every module in
| | : ./lib
| | : and ./site_perl AND, if they support the $Module::VERSION scheme,
| | : include its version number, otherwise left blank.
|
| | use ExtUtils::Installed;
| | my ($inst) = ExtUtils::Installed->new();
| | foreach my $mod ($inst->modules()) {
| | print $mod, "\t=> ", $inst->version($mod), "\n";
| | }
|
| Noticing that you are calling my ($inst) in list context instead of
| scalar context -- and that sometimes that causes different things to
| happen depending on the RH argument
|
| (see another thread that mentions this :
|
| my $date = localtime;
| my ($date2) = localtime; #not the same thing!
| print "$date\n$date2\n";
|
| )
|
| is that intentional, or are you mistaking 'my' as a function ?
Hmm.. not that it matters after all
I cannot update to 5.005 on my system (needs to be ported yet, and the
status is unclear what with MacOS X on the immediate horizon with native
perl anyway), so I'm stuck with 5.004
Also tried this on another shell I access that DOES run 5.005_03, and
the result was somewhat less than helpful:
/home/pro % perl installed.pl
Can't open file /usr/libdata/perl5/5.00503/i386-bsdos/auto/IO/.packlist:
Permission denied at /usr/libdata/perl5/5.00503/ExtUtils/In
stalled.pm line 87
/home/pro % ll /usr/libdata/perl5/5.00503/i386-bsdos/auto/IO/
-rw------- 1 root wheel 1021 May 8 14:13 .packlist
-r--r--r-- 1 root wheel 0 Nov 17 1999 IO.bs
-r-xr-xr-x 1 root wheel 14358 May 8 14:12 IO.so*
Since I don't have root on any of the other boxen I'd want to check this
on, out of curiosity's sake, this is quite obviously NOT a solution.
Anyone else have a solution? (one that works? :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 19 Jul 2000 02:37:41 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l3ls5$rh9$1@provolone.cs.utexas.edu>
In article <3974F776.991A457C@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>However, in
>reality, this parallel processing usually takes
>place with hundreds, even thousands of unique
>microprocessors such as today's super computers
>employ. Perhaps a practical example would our
>new dual processor computers often used for
>internet service providers. Still, this is
>not a classic example of parallel processing
>but rather simply a computer with two CPUs.
>
>For a module to exhibit parallel processing,
>especially with Perl, this is quite the coding
>challenge and most would agree, impossible.
>Perl is inherently linear in nature. I would
>suppose a complex looping nest, might be a
>construed parallel process, yet it is still
>linear in nature regardless of iteration;
I have to admit I haven't thought about this in depth, but I've never
understood the idea that there would be something a multi-processor
machine could do but a single-process machine couldn't.
Fundamentally, the whole thing is a state machine. Its output at a
given time is a function of its input and its internal state. I cannot
see why it matters whether that internal state is stored in a single
processor or multiple processors.
Put another way, it has always seemed to me like it should be possible
to perfectly emulate a multi-processor computer on a single-processor
machine. (In fact, isn't that what xmame does?)
However, I will agree that it will definitely be *slower*. In fact,
I'd always assumed that the reason massively parallel systems were used
was to gain performance, not because it was impossible otherwise.
- Logan
------------------------------
Date: Wed, 19 Jul 2000 07:52:47 GMT
From: peterhi@my-deja.com
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l3moa$7b2$1@nnrp1.deja.com>
In article <8l0ou9$ml0$0@206.230.71.42>,
"Josiah Bryan" <jdb@wcoil.com> wrote:
> Greetings perlfolk,
>
> I have finished a new module designed to simulate simple neural
> networks completly with Perl. I am writing to .modules mainly to
> see if anyone has any objections to the namespace, or suggestions
> for a better namespace.
>
The only problem that I can forsee is that you have got there first and
therefore will end up with AI::NeuralNetwork when all you really have is
backprop. Should I develope a Perl Hoppfield network then I would have
to put it elsewhere even though it would logically go in
AI::NeuralNetwork.
AI::NeuralNetwork::BackProp perhaps and then we can extend the base name
in time. NeuralNetwork is too broard a category for something,
initially, so narrow.
Just for the record I'm not developing a Hoppfield module in Perl. But
maybe I will develope my GA code.
Keep up the good work.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 08:03:44 GMT
From: mark@giallo.demon.nul (Mark Wright)
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <397560bf.719685@194.159.73.10>
One joyful day (Tue, 18 Jul 2000 17:33:58 -0700 to be precise),
"Godzilla!" <godzilla@stomp.stomp.tokyo> decided that the Usenet
community would benefit from this remarkable comment:
>As for this ignorant jerk who suggested I need
>to medicate myself with prozac, I would politely
>suggest you visit with the Wiz for enlightenment
>and a brain, lest next time, I intellectually come
>down on you so hard, you will need to unzip your
>pants to see where you are going.
HAHAHAHAHAHAHAHAHAHA!!!!
*plonk*
Mark Wright
- mark@giallo.demon.nl
--
perl -e "print join' '=>map{$_ if s/(\w*)(.)ay/\U$2\E$1/}grep/^\w/=>reverse qw+ackerhay :o( erlpay :o| notheraay :o\ ustjay :o)+"
------------------------------
Date: 19 Jul 2000 09:33:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Numerical evaluation in string
Message-Id: <8l3p4j$tpt$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 17:54:44 GMT Vinod K. Menon wrote:
> Hey guys..
>
> yet another question..how do I make a calculation inside a double
> quoted string?
>
> for example (I know the format is not right..just giving the idea!)
>
> if I wanna do something like string = " 1/($keyVal/$len -1)) is the
> answer"
>
> I want it to evaluate to something like
> and print
>
> 0.33 is the answer
>
> how do I do that?
>
I would look in perlfaq4 :
How do I expand function calls in a string?
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 19 Jul 2000 09:02:06 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Passing command line regexp into perl program
Message-Id: <8l3qqe$jjt$1@lublin.zrz.tu-berlin.de>
Bob Walton <bwalton@rochester.rr.com> wrote in comp.lang.perl.misc:
>Don McCorvey wrote:
>> if (field2 =~ eval($regexp) {
...where $regexp is @ARGV[0].
[...]
>Why are you eval'ing the argument? That will treat the argument as a
>Perl program, and, assuming it compiles and executes (which is unlikely
>if it is a regex), will return the results of the last statement in it
>which was executed. That is almost certainly not what you want.
It's not only not doing what you want, it could even do things you
definitely don't want, such as erasing all files in the current
directory, or sending a quit notice to your boss[1]. Never blindly
eval() user input, except when you are writing a shell.
Anno
[1] well, you may want that, but still...
--
Its not bad design, its a cgi script.
------------------------------
Date: 19 Jul 2000 09:39:36 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Perl and Sendmail???
Message-Id: <slrn8nasij.hpr.vek@pharmnl.ohout.pharmapartners.nl>
On Tue, 18 Jul 2000 16:25:14 GMT,
lefkogt@my-deja.com <lefkogt@my-deja.com> wrote:
>What is syntax for sending to multiple respondents using Sendmail and
>Perl?
>
>I tried this with no luck in my Perl CGI:
> print MAIL "To: $FORM{'supervisor'},$FORM{'peer'}\n";
>
>Gary
>
And how is MAIL opened?
Villy
------------------------------
Date: 19 Jul 2000 07:36:17 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Perl Expert? I need help!
Message-Id: <963991005.8357@itz.pp.sci.fi>
In article <39753c7a_1@excalibur.gbmtech.net>, Alejandro Kurczyn wrote:
>"Abigail" <abigail@delanet.com> escribió en el mensaje
>> If it's speed & memory that are your prime requisites, then what on earth
>> are you doing in this group?
>>
>> You should be going to comp.lang.c.
>
>Don't you think I'm here because I'm interested in Perl?
Well, I can understand quite well how you might like Perl while also
being interested in maximizing execution speed, but let's face it,
there's only so far you can go along that road.
It's like wanting to buy a fast bicycle. It makes perfect sense to
choose a faster one over a slower one, but if speed really is your
_primary_ requirement, you don't want a bicycle.
>What is the difference (performance wise, internal workings,
>I_dont_know_what_else), of using regex to do something a Perl function can
I don't know. Let's try it and see:
#!/usr/bin/perl -w
use strict;
use Benchmark;
use vars qw($text);
$text = 'MynameisSylvain';
timethese 1<<(shift||0),
{ regexp => 'my ($first) = $text =~ /(.{0,8})/s',
substr => 'my $first = substr($text, 0, 8)',
};
__END__
Benchmark: timing 1048576 iterations of regexp, substr...
regexp: 6 wallclock secs ( 6.65 usr + 0.00 sys = 6.65 CPU)
substr: 3 wallclock secs ( 1.67 usr + 0.00 sys = 1.67 CPU)
This is perl, version 5.005_03 built for i386-linux
Ok, so substr() is faster as expected. And IMHO it also looks nicer.
I think it's fair to say that there is no advantage in using a regex
in this particular situation. The large number of iterations required
to produce a noticeable difference, on the other hand, shows there is
hardly any performance penalty either, unless you really are doing the
operation in a ridiculously long, tight loop.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Wed, 19 Jul 2000 10:05:37 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Perl job offered San Mateo Perm
Message-Id: <fbed5.130$KR1.2983@news6-win.server.ntlworld.com>
"Andrew J. Perrin" <aperrin@socrates.berkeley.edu> wrote...
:
: It really does sound like comedy - every meaningless buzzword of the
: computer industry, strung together.
:
does it also deliver a bespoke turnkey solution in a robust and scableable
environment?
i hope it does
--
Cal Henderson
sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);
------------------------------
Date: Tue, 18 Jul 2000 13:11:46 +0100
From: Yns <lovelyspam@england.com>
Subject: Re: Perl on irc
Message-Id: <39744982.447F44E2@england.com>
Abigail wrote:
>
> Kiel Stirling (taboo@doofa.net) wrote on MMDVIII September MCMXCIII in
> <URL:news:396e0f8d_3@nexus.comcen.com.au>:
> //
> // Any idea's on good perl irc channels?
>
> #teensex
Is that what the chomp command is for?
>
> Abigail
------------------------------
Date: Wed, 19 Jul 2000 09:59:10 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: Perl RTE ?
Message-Id: <8l3qka$kg7$1@gxsn.com>
Hi,
I've developed an application written in Perl (on AIX), and wish to
implement it on other AIX servers without having to install the full Perl
software (about 32 Mb on AIX).
How can I install just the bits I need to get Perl up-and-running, i.e. a
runtime environment? Or am I looking at compiling the Perl code?
Any suggestions ?
James G.
------------------------------
Date: Wed, 19 Jul 2000 09:59:10 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: Perl RTE ?
Message-Id: <8l3qns$9dt$1@gxsn.com>
Hi,
I've developed an application written in Perl (on AIX), and wish to
implement it on other AIX servers without having to install the full Perl
software (about 32 Mb on AIX).
How can I install just the bits I need to get Perl up-and-running, i.e. a
runtime environment? Or am I looking at compiling the Perl code?
Any suggestions ?
James G.
------------------------------
Date: Wed, 19 Jul 2000 09:59:10 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: Perl RTE ?
Message-Id: <8l3qrd$hsd$1@gxsn.com>
Hi,
I've developed an application written in Perl (on AIX), and wish to
implement it on other AIX servers without having to install the full Perl
software (about 32 Mb on AIX).
How can I install just the bits I need to get Perl up-and-running, i.e. a
runtime environment? Or am I looking at compiling the Perl code?
Any suggestions ?
James G.
------------------------------
Date: 19 Jul 2000 02:49:13 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Plugins architecture
Message-Id: <8l3mhp$rk1$1@provolone.cs.utexas.edu>
In article <39750EE9.AE92539C@patriot.net>, H C <carvdawg@patriot.net> wrote:
>I'm working on a small app, trying to develop a suitable plugins
>architecture.
>Basically, I've tried having a "plugins" subdirectory, and the main code
>reads the
>contents of the directory and "registers" the available modules...but
>doesn't "use" or
>"require" the code. Then, if certain conditions are met, then the
>suitable module is
>called using "use" or "require", and the new() method is called.
>
>I've tried a couple of my own ideas, but was wondering if someone has
>used something
>that they'd be willing to share...
Have you looked at the documentation for SelfLoader and AutoLoader? If
not, that may give you ideas.
It may even be possible to make SelfLoader do much or most of the work
for you -- just make each plugin a SelfLoader and require it; its
methods will then make themselves available as necessary. One possible
gotcha is that I'm not sure what happens when you have a __DATA__
marker inside a file you require.
- Logan
------------------------------
Date: Wed, 19 Jul 2000 05:43:07 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Plugins architecture
Message-Id: <3975782B.B74F078A@patriot.net>
> Have you looked at the documentation for SelfLoader and AutoLoader? If
> not, that may give you ideas.
Logan,
Very interesting. I'll take a look. Thanks.
Carv
------------------------------
Date: 19 Jul 2000 09:56:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Producing an executable for Perl program
Message-Id: <8l3qgo$trc$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 13:39:20 GMT sanjay33@my-deja.com wrote:
> Although I understand that Perl is an interpreted language, am I correct
> in assuming that a Perl program is read into memory and converted into
> some intermediate form before it is executed. If this is true, then it
> should be possible to produce a executable file which runs the program.
>
> Can anyone tell me how to produce this file?
>
To produce *that* file you need to cause perl to dump core immediately
after the compilation phase. Production of a 'proper' binary executable is
discussed in the FAQ.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 19 Jul 2000 10:01:15 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Renaming files trough Perl?
Message-Id: <8l3qor$tru$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 11:06:29 GMT Trond Aage Langtind wrote:
> How do I make a perl script that rename a file. I'm running UNIX.
>
I dunno there doesnt seem to be a builtin function to do that so I
implemented a disk editor that would enable me to change the directory
entries and inode tables as appropriate.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 19 Jul 2000 09:07:42 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Search and replace with a large amount of text
Message-Id: <8l3r4n$a45$1@nnrp1.deja.com>
Hi,
I wonder if anyone can help? I need to load in a reasonably large
amount of text and do some searches and replaces on it (which could
span several lines). I don't know how big the text will be (it will
vary) but I do know its going to be large.
Now I could do:
my $contents = "";
open(FILE, "text") || die "erk: $!";
while (<FILE>)
{
$contents .= $_;
}
close FILE;
but the text file could be larger than the maximum limit $contents can
hold.
I can't load each line and process individually as some of the searches
and replaces will span over several lines.
So, what on earth can I do? Should I just use sed and be done with it
or is there a good approach?
Thanks!
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 09:58:32 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Search and replace with a large amount of text
Message-Id: <MPG.13e0191d556415279896fa@news>
Richard Lawrence wrote ..
>I wonder if anyone can help? I need to load in a reasonably large
>amount of text and do some searches and replaces on it (which could
>span several lines). I don't know how big the text will be (it will
>vary) but I do know its going to be large.
>
>Now I could do:
>
>my $contents = "";
>open(FILE, "text") || die "erk: $!";
>while (<FILE>)
>{
> $contents .= $_;
>}
>close FILE;
>
>but the text file could be larger than the maximum limit $contents can
>hold.
>
>I can't load each line and process individually as some of the searches
>and replaces will span over several lines.
>
>So, what on earth can I do? Should I just use sed and be done with it
>or is there a good approach?
check out the '..' and '...' operators
perldoc perlop
they can be used like this
/regex to begin true/../regex to end true/
of course - each one of those regexes can only be done on one line - so
whether this will work depends on what you mean by "searches and
replaces will span over several lines"
you might also want to look the $/ builtin variable .. that might help
to read in more than a line (eg a paragraph at a time)
perldoc perlvar
--
jason -- elephant@squirrelgroup.com --
------------------------------
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 3743
**************************************