[17913] in Perl-Users-Digest
Perl-Users Digest, Issue: 73 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 16 18:10:47 2001
Date: Tue, 16 Jan 2001 15:10:16 -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: <979686615-v10-i73@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 16 Jan 2001 Volume: 10 Number: 73
Today's topics:
Re: NEWBIE: need help with search spider/crawler (Ben Okopnik)
Re: NEWBIE: need help with search spider/crawler (Garry Williams)
Re: NEWBIE: need help with search spider/crawler (David H. Adler)
Re: NEWBIE: need help with search spider/crawler <amonotod@netscape.net>
newbie: split problem <j_graumann@hotmail.com>
Re: newbie: split problem <mjcarman@home.com>
Re: newbie: split problem <ren.maddox@tivoli.com>
passing parameters to another program <mattc@country-life.com>
Re: Perl and AOL. How is this possible? (Tad McClellan)
Petition script? daveanderson2000_dej@my-deja.com
Re: Petition script? <amonotod@netscape.net>
Re: Putting text in an image? (Ilya Zakharevich)
Re: Random Numbers with a Twist (Garry Williams)
Re: Random Numbers with a Twist (Abigail)
Re: Random Numbers with a Twist <johngros.NOSPAM@bigpond.net.au>
Re: Random Numbers with a Twist <johngros.NOSPAM@bigpond.net.au>
Re: Random Numbers with a Twist <joe+usenet@sunstarsys.com>
Sending CTRL-E with Net::Telnet <mdrobbins@home.com>
Small code review. <diab.lito@usa.net>
Re: Small code review. <johngros.NOSPAM@bigpond.net.au>
Re: Small code review. (Tad McClellan)
techniques for finding slow code? dtbaker_dejanews@my-deja.com
Re: techniques for finding slow code? (Chris Fedde)
Re: techniques for finding slow code? (Tad McClellan)
TNEF For Perl. Need Help. Is this a Perl Script? metacomputer1239@my-deja.com
Re: TNEF For Perl. Need Help. Is this a Perl Script? <greg2@surfaid.org>
Re: What's wrong with this (parent fork multiple childr <mischief@velma.motion.net>
Re: ZIp Code Perl Program <mmertel@ix.netcom.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jan 2001 20:39:46 GMT
From: ben-fuzzybear@geocities.com (Ben Okopnik)
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <slrn969cl7.13l.ben-fuzzybear@Odin.Thor>
The ancient archives of Tue, 16 Jan 2001 13:36:04 -0500 showed
Lou Moran of comp.lang.perl.misc speaking thus:
>On 16 Jan 2001 08:56:18 GMT, abigail@foad.org (Abigail) wrote
>wonderful things about sparkplugs:
>
>>Abigail
>>--
>>print 74.117.115.116.32;
>>print 97.110.111.116.104.101.114.32;
>>print 80.101.114.108.32;
>>print 72.97.99.107.101.114.10;
>
>This one is way cool... I can't wait to figure out how it works.
>
>lmoran@wtsgSPAM.com
>print "\x{263a}"
I'll confess: I just don't get it. Running the above with a
perl -we '....
etc., does nothing but print those strings; even your own .sig does
nothing more than output
Illegal hex digit ignored at -e line 1.
{263a}
What did I miss?
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
print pack("B200","0100101001110101011100110111010000100000011000010110111".
"0011011110111010001101000011001010111001000100000010100000110010101110010".
"011011000010000001001000011000010110001101101011011001010111001000001010");
------------------------------
Date: Tue, 16 Jan 2001 21:57:10 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <Ws396.59$h41.2118@eagle.america.net>
On 16 Jan 2001 20:39:46 GMT, Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
>The ancient archives of Tue, 16 Jan 2001 13:36:04 -0500 showed
>Lou Moran of comp.lang.perl.misc speaking thus:
>>On 16 Jan 2001 08:56:18 GMT, abigail@foad.org (Abigail) wrote
>>wonderful things about sparkplugs:
>>
>>>Abigail
>>>--
>>>print 74.117.115.116.32;
>>>print 97.110.111.116.104.101.114.32;
>>>print 80.101.114.108.32;
>>>print 72.97.99.107.101.114.10;
>>
>>This one is way cool... I can't wait to figure out how it works.
>>
>>lmoran@wtsgSPAM.com
>>print "\x{263a}"
>
>
>I'll confess: I just don't get it. Running the above with a
>
>perl -we '....
>
>etc., does nothing but print those strings; even your own .sig does
>nothing more than output
>
>Illegal hex digit ignored at -e line 1.
>{263a}
>
>What did I miss?
perl 5.6.0
--
Garry Williams
------------------------------
Date: 16 Jan 2001 22:38:08 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <slrn969jag.8oh.dha@panix2.panix.com>
On 16 Jan 2001 20:39:46 GMT, Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
>>On 16 Jan 2001 08:56:18 GMT, abigail@foad.org (Abigail) wrote
>>wonderful things about sparkplugs:
>>
>>>Abigail
>>>--
>>>print 74.117.115.116.32;
>>>print 97.110.111.116.104.101.114.32;
>>>print 80.101.114.108.32;
>>>print 72.97.99.107.101.114.10;
>
>I'll confess: I just don't get it. Running the above with a
C<require 5.6;>
dha :-)
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Well of *course* Perl should not be taught to everyone. It should only
be taught to people who want to like their computers. - Larry Wall
------------------------------
Date: Tue, 16 Jan 2001 22:39:38 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: NEWBIE: need help with search spider/crawler
Message-Id: <942ij9$h2q$1@nnrp1.deja.com>
In article <n3596t0t72ur4sjpca6muhoge26up0vcl6@4ax.com>,
Lou Moran <lmoran@wtsg.com> wrote:
> On 16 Jan 2001 08:56:18 GMT, abigail@foad.org (Abigail) wrote
> wonderful things about sparkplugs:
>
> >Abigail
> >--
> >print 74.117.115.116.32;
> >print 97.110.111.116.104.101.114.32;
> >print 80.101.114.108.32;
> >print 72.97.99.107.101.114.10;
>
> This one is way cool... I can't wait to figure out how it works.
>
> lmoran@wtsgSPAM.com
> print "\x{263a}"
>
Hmmm... I figured it was a JAPH, but evidently not...
74.117115.1163297.11111.116104.101114.3280.101114.1083272.9799.107101.11
410
Must be that perl sees the first . as a decimal indicator and the second
as a concatenation operator, then switches back and forth for each . on
each line. Is that it, or is my machine really stoned?
Heres what I actually ran:
#!perl -w
use strict;
print 74.117.115.116.32;
print 97.110.111.116.104.101.114.32;
print 80.101.114.108.32;
print 72.97.99.107.101.114.10;
with this command: perl abagail_sig.pl
Did you also get this result?
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 19:13:51 GMT
From: Johannes Graumann <j_graumann@hotmail.com>
Subject: newbie: split problem
Message-Id: <9426h4$5sa$1@nnrp1.deja.com>
Hello,
Completely new and fighting...
I want to do something like
@all = split("\n", $xyz)
to get strings from a file which holds a potential string in each line,
but that doesn't work (in contradiction to something like @all = split("
", $xyz)). How can I make the line break my split-marker?
Thanks for any help, hints.
Johannes
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 14:08:52 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: newbie: split problem
Message-Id: <3A64AA54.5EAE0724@home.com>
Johannes Graumann wrote:
>
> I want to do something like
> @all = split("\n", $xyz)
> to get strings from a file which holds a potential string in
> each line, but that doesn't work (in contradiction to something
> like @all = split("", $xyz)). How can I make the line break my
> split-marker?
You're making life much too difficult. Assuming, as you say, that you
have a file with a string on each line, you can just read it all at a
gulp. Perl will split it for you:
open(FILE, 'myfile') or die "Can't open 'myfile' [$!]\n";
chomp(@all = <FILE>);
close(FILE);
# Do something useful...
-mjc
------------------------------
Date: 16 Jan 2001 15:01:47 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: newbie: split problem
Message-Id: <m3d7dn5hz8.fsf@dhcp11-177.support.tivoli.com>
Johannes Graumann <j_graumann@hotmail.com> writes:
> Hello,
> Completely new and fighting...
> I want to do something like
> @all = split("\n", $xyz)
> to get strings from a file which holds a potential string in each line,
> but that doesn't work (in contradiction to something like @all = split("
> ", $xyz)). How can I make the line break my split-marker?
What you have done works fine, though since the first argument to
split is actually a pattern, things tend to get less confusing if you
make it look like a pattern:
@all = split /\n/, $xyz;
Note that this does not change the meaning and using quotes as you did
still works fine.
The most likely reason that you are not getting the behavior you
expect is that $xyz doesn't contain what you think it does. If you
can post a self-contained program that demonstrates the problem, we
can likely tell you the actual cause.
I expect that you are having a problem reading the whole file into
$xyz. There are, of course, several ways to do so, including:
$xyz = join "", <FILE>;
or
{ local $/; $xyz = <FILE>; }
HTH,
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 16 Jan 2001 17:47:36 -0500
From: Matt Carey <mattc@country-life.com>
Subject: passing parameters to another program
Message-Id: <3A64CF88.57A572CC@country-life.com>
I have a perl program on a Linux box that executes another perl program
on a remote host(HP-UX 11.00). I need to pass variables from the
program on the Linux box to the program on the remote host. Right now I
am using 'rsh' to execute the program on the remote host. How can I pass
variables with the 'rsh' command or is there a different approach
altogether that I may be able to try.
Thanks
------------------------------
Date: Tue, 16 Jan 2001 15:24:42 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl and AOL. How is this possible?
Message-Id: <slrn969bga.12p.tadmc@tadmc26.august.net>
Roman Stawski <roman.stawski@fr.adp.com> wrote:
>Tad McClellan wrote:
>>
>> Perl does not operate "under a browser" in ANY circumstance.
>
>Err, ActiveState _do_ have this thing called PerlScript
But that is not Perl. That is PerlScript.
I don't think there is a newsgroup for PerlScript, maybe there
is a mailing list?
>which
>works "under a browser". Granted, it's nothing to do with the
>OP and even blatant nit-picking..., but we do want to be
>accurate ;-)
What I said is still accurate.
PerlScript is not Perl, that is probably why it has a different name.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 16 Jan 2001 22:25:50 GMT
From: daveanderson2000_dej@my-deja.com
Subject: Petition script?
Message-Id: <942hp3$gfl$1@nnrp1.deja.com>
I'm looking for a petition script to run on my web site. Anyone have
any ideas? I've searched various perl sites like CGI Resource, etc.,
and haven't been able to find any.
I don't mind paying for one if it's a reasonable price and a good
script.
Thanks!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 22:43:13 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Petition script?
Message-Id: <942ipv$h67$1@nnrp1.deja.com>
In article <942hp3$gfl$1@nnrp1.deja.com>,
daveanderson2000_dej@my-deja.com wrote:
> I'm looking for a petition script to run on my web site. Anyone have
> any ideas? I've searched various perl sites like CGI Resource, etc.,
> and haven't been able to find any.
>
> I don't mind paying for one if it's a reasonable price and a good
> script.
>
> Thanks!
Search engines are cool:
http://www.google.com/search?q=petition+script+perl&hl=en&lr=&safe=off
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 16 Jan 2001 20:51:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Putting text in an image?
Message-Id: <942c8m$9gi$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Eric
<eric.kort@vai.org>],
who wrote in article <93nb9c$1udb$1@msunews.cl.msu.edu>:
> Is there a perl module to help with placing text on an image? For example,
> I am writing a program to generate a histogram of an image (thus creating a
> tiff), and I would like to be able to put numbers on the x axis scale. Must
> I draw the numbers pixel by pixel, or is there a simpler way?
In addition to other advices: check whether Term::Gnuplot supports
tiff. If it does, you can use it - and switch to other kinds of
output by changing one line only...
Ilya
------------------------------
Date: Tue, 16 Jan 2001 21:04:11 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Random Numbers with a Twist
Message-Id: <fH296.49$h41.2755@eagle.america.net>
On Tue, 16 Jan 2001 11:56:01 -0700, Rob Greenbank <rob@frii.com>
wrote:
>I would propose a solution where a set of all possible points is
>created. Now when a point is randomly chosen, all points within 30 of
>that point are removed from the set of possible points. The next
>point is then chosen from the new set. This has the advantage that
>you don't have to check a random choice to see if it's valid -- since
>all invalid pionts are eliminated, it *will* be valid.
But Abigail already pointed out that this method could lead to no
solution by unfortunate choices early in the interation you propose.
--
Garry Williams
------------------------------
Date: 16 Jan 2001 21:05:48 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Random Numbers with a Twist
Message-Id: <slrn969dtc.tp2.abigail@tsathoggua.rlyeh.net>
Gordon.Haverland@agric.gov.ab.ca (Gordon.Haverland@agric.gov.ab.ca) wrote
on MMDCXCV September MCMXCIII in <URL:news:3a6457ac.419332713@news.gov.ab.ca>:
}} >"Shawn Coppock" <coppocks@bellsouth.net> writes:
}} >> #Problem:
}} >>
}} >> Lets say I need to generate 60 random pairs of numbers ($x,$y) ...
}} >> where $x is from a range of 1..1200 and $y is from a range of 1..800.
}} >> Consider these pairs as a random point or coordinate on a grid of
}} >> 1200x800.
}}
}} >> In addition to this, each pair must be unique, in that
}}
}} >> 1. no pair can be the same
}} >> 2. no pair can be within 30 of another
}}
}} >> I don't want the pairs/coordinates to be perfectly spaced by 30. There's
}} >> no need because at 1200x800 there are 960k available points... and if no
}} >> two are within 30 of another, there are still 320k possibilities.
}}
}} I don't think you can solve this without some kind of rejection
}} mechanism, i.e. you calculate a trial (x,y) and test to see if there
}} are already found points within a radius of 30 (or rather, a radius
}} squared of 900).
Well, of course you can. The problem with rejection algorithms is deciding
when to reject a point. After all, a new point might be far enough from
all the others picked so far, but it could be point such that you cannot
pick enough points to solve the problem.
}} One thing you can do, is to "wrap" (tile ?) your data space using
}} modular arithmetic. So, if we are going to try adding 57 units in the
}} X direction to a point which is already at 1190, we get 47
}} (1190+57-1200).
That just might turn a solvable problem into an unsolvable one. For
instance, 4 points on a 10 x 10 grid with distance >= 8.
Abigail
--
BEGIN {$^H {q} = sub {pop and pop and print pop}; $^H = 2**4.2**12}
"Just "; "another "; "Perl "; "Hacker\n";
------------------------------
Date: Tue, 16 Jan 2001 22:07:03 GMT
From: "John Boy Walton" <johngros.NOSPAM@bigpond.net.au>
Subject: Re: Random Numbers with a Twist
Message-Id: <bC396.65708$xW4.515696@news-server.bigpond.net.au>
"Shawn Coppock" <coppocks@bellsouth.net> wrote in message
news:RZE86.288$zc4.21022@news2.mco...
> I can yank random numbers from ranges etc. all day. But now, I need a
little
> more and I am tripping to solve this one.
>
> #Problem:
>
> Lets say I need to generate 60 random pairs of numbers ($x,$y) ... where
$x
> is from a range of 1..1200 and $y is from a range of 1..800. Consider
these
> pairs as a random point or coordinate on a grid of 1200x800.
>
> In addition to this, each pair must be unique, in that
> 1. no pair can be the same
> 2. no pair can be within 30 of another
>
> #Example:
>
> Pair 1: 50,100
> Pair 2: 32,135
> Pair 3: 31,130
> etc..
>
> Assuming that the pair numbers are checked before being added to a final
> list...
>
> Pair 2 is ok because only one number is within 30 of Pair 1. But, Pair 3
is
> NOT ok, because both numbers are within 30 of another pair (Pair 2).
I did something similar with my minesweeper.pl to populate it with bombs at
random I had to make sure it did not overwrite previous bombs to wind up
with a full compliment of bombs.
Below is the code that stopped the multiple writes to the same coordinates.
for ($i = 1; $i < 100; $i++){
$xaxis = int(rand(30));
$yaxis = int(rand(16));
if (!defined($cell[$xaxis][$yaxis])){
$cell[$xaxis][$yaxis] = 'B';
}else{redo}
}
But you won't want an array of 1200 * 800.
You could push the co-ordinates onto a pair of arrays @xaxis and @yaxis.
Then loop through the arrays before writing the next point and testing for
each previous point to see that ($xaxis[x] + 30 > $new_point_xaxis or
$yaxis[x] + 30 > $new_point_yaxis) and ($xaxis[x] - 30 > $new_point_xaxis or
$yaxis[x] - 30 > $new_point_yaxis)
That should give the effect you want, all the new points being at least
thirty pixels away from previous points.
------------------------------
Date: Tue, 16 Jan 2001 22:20:55 GMT
From: "John Boy Walton" <johngros.NOSPAM@bigpond.net.au>
Subject: Re: Random Numbers with a Twist
Message-Id: <bP396.65731$xW4.515596@news-server.bigpond.net.au>
"Garry Williams" <garry@zvolve.com> wrote in message
news:fH296.49$h41.2755@eagle.america.net...
> On Tue, 16 Jan 2001 11:56:01 -0700, Rob Greenbank <rob@frii.com>
> wrote:
>
> But Abigail already pointed out that this method could lead to no
> solution by unfortunate choices early in the interation you propose.
>
> --
> Garry Williams
He did point out an easy test for it (the empty hash) and then you could run
through again.
------------------------------
Date: 16 Jan 2001 17:58:01 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Random Numbers with a Twist
Message-Id: <m366jfxfye.fsf@mumonkan.sunstarsys.com>
"John Boy Walton" <johngros.NOSPAM@bigpond.net.au> writes:
> I did something similar with my minesweeper.pl to populate it with bombs at
> random I had to make sure it did not overwrite previous bombs to wind up
> with a full compliment of bombs.
> Below is the code that stopped the multiple writes to the same coordinates.
> for ($i = 1; $i < 100; $i++){
> $xaxis = int(rand(30));
> $yaxis = int(rand(16));
> if (!defined($cell[$xaxis][$yaxis])){
> $cell[$xaxis][$yaxis] = 'B';
> }else{redo}
> }
> But you won't want an array of 1200 * 800.
> You could push the co-ordinates onto a pair of arrays @xaxis and @yaxis.
> Then loop through the arrays before writing the next point and testing for
> each previous point to see that ($xaxis[x] + 30 > $new_point_xaxis or
> $yaxis[x] + 30 > $new_point_yaxis) and ($xaxis[x] - 30 > $new_point_xaxis or
> $yaxis[x] - 30 > $new_point_yaxis)
> That should give the effect you want, all the new points being at least
> thirty pixels away from previous points.
Indeed, and it would essentially reproduce the correct solution
that Craig submitted a while ago. For reasons that are unclear
to me, the topic of this thread has now become the domain of
applicability of his code, since noone has offered any alternative.
Bizarre.
If ifs and buts were candy and nuts, we'd all have a merry Christmas.
--
Joe Schaefer
------------------------------
Date: Tue, 16 Jan 2001 19:16:30 GMT
From: Michael Robbins <mdrobbins@home.com>
Subject: Sending CTRL-E with Net::Telnet
Message-Id: <kf796tcbh09eifgi13101i0rcn3841np8d@4ax.com>
I AM new at this, so please bear with me.
I am connecting to a server using Net::Telnet. Upon connection, the
server will send no info until it recieves a <CTRL-E>, at which time
the server should resond with 'READY'. Then later I need to issue
commands like <CTRL-B>16 or <CTRL-B>25. I have each tried:
$obj->print("\005");
$obj->print("\x05");
$obj->print("\cE");
$obj->cmd("\005");
$obj->cmd("\x05");
$obj->cmd("\cE");
followed by:
$obj->waitfor('/READY/');
I get no result from the server. I've set input & output logs and the
input log is empty.
Q1) Should I be using the print method, or the cmd method for this?
Q2) What is the proper way to send control characters to a telnet
server using Net::Telnet?
Thanks for any help
Mike
------------------------------
Date: Tue, 16 Jan 2001 22:03:19 GMT
From: Mario <diab.lito@usa.net>
Subject: Small code review.
Message-Id: <942gf0$f51$1@nnrp1.deja.com>
Here is a not working piece of a script,it is supposed to read from a
file and convert all variable-like words into the value of those
variables.The (wrong) output is:"This is the variable HELLO:<b></b>".
If someone could please advices me about where is the error,it would be
very helpful.
Thanks.
-----------------------
my $HELLO="hello";
my $html=&template("test");
print $html;
sub template {
my $file_name=shift;
my $page=undef;
open (TMPL ,"<$file_name.tmpl") || die "Error,$!";
while (<TMPL>) {
$page.=$_;
}
close (TMPL) || die "Error,$!";
$page=~s/\$(\w+)/${$1}/g;
return $page;
}
------------------------
-test.tmpl
------------------------
This is the variable HELLO:<b>$HELLO</b>
------------------------
-
Mario
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 22:53:34 GMT
From: "John Boy Walton" <johngros.NOSPAM@bigpond.net.au>
Subject: Re: Small code review.
Message-Id: <Oh496.65794$xW4.516040@news-server.bigpond.net.au>
"Mario" <diab.lito@usa.net> wrote in message
news:942gf0$f51$1@nnrp1.deja.com...
> Here is a not working piece of a script,it is supposed to read from a
> file and convert all variable-like words into the value of those
> variables.The (wrong) output is:"This is the variable HELLO:<b></b>".
>
> If someone could please advices me about where is the error,it would be
> very helpful.
> Thanks.
>
> -----------------------
use strict;
print "Content-type: text/html\n\n";
my $HELLO="hello";
> my $html=&template("test");
> print $html;
>
> sub template {
> my $file_name=shift;
> my $page=undef;
> open (TMPL ,"<$file_name.tmpl") || die "Error,$!";
> while (<TMPL>) {
> $page.=$_;
> }
> close (TMPL) || die "Error,$!";
> $page=~s/\$(\w+)/${$1}/g;
> return $page;
> }
>
> ------------------------
> -test.tmpl
> ------------------------
> This is the variable HELLO:<b>$HELLO</b>
> ------------------------
>
> -
> Mario
>
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 15:59:44 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Small code review.
Message-Id: <slrn969di0.14i.tadmc@tadmc26.august.net>
Mario <diab.lito@usa.net> wrote:
>Here is a not working piece of a script,it is supposed to read from a
>file and convert all variable-like words into the value of those
>variables.The (wrong) output is:"This is the variable HELLO:<b></b>".
Have you seen your question in the Perl FAQ?
"How can I expand variables in text strings?"
Apparently not, or you wouldn't be here.
You are expected to check the Perl FAQ *before* posting
to the Perl newsgroup you know.
>-----------------------
>my $HELLO="hello";
^^
^^ my() makes a "lexical variable".
>my $html=&template("test");
>sub template {
> $page=~s/\$(\w+)/${$1}/g;
That is the identical code from the FAQ.
The FAQ says why it will not work the way you are using it.
If you do not understand the answer given in the FAQ, then ask
a question about the answer given in the FAQ.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 16 Jan 2001 21:55:06 GMT
From: dtbaker_dejanews@my-deja.com
Subject: techniques for finding slow code?
Message-Id: <942fvl$eru$1@nnrp1.deja.com>
I'd like to hear if ya'll have some favorite techniques for zeroing in
on slow code. I have a pretty large script that is taking way too long
to process some records, and I'm looking for ways to narrow down what
loop or activity is slowing it down so badly.
is my best bet just to open a debug file and print out some time stamps?
any methods for generating some kind of a time analysis from the outside
while it runs without inserting a bunch of print statements? A trace I
can turn on to figure out how much time is getting spent in which areas?
D
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 22:56:28 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: techniques for finding slow code?
Message-Id: <wk496.1011$B9.193143808@news.frii.net>
In article <942fvl$eru$1@nnrp1.deja.com>,
<dtbaker_dejanews@my-deja.com> wrote:
>I'd like to hear if ya'll have some favorite techniques for zeroing in
>on slow code. I have a pretty large script that is taking way too long
>to process some records, and I'm looking for ways to narrow down what
>loop or activity is slowing it down so badly.
>
>is my best bet just to open a debug file and print out some time stamps?
>
>any methods for generating some kind of a time analysis from the outside
>while it runs without inserting a bunch of print statements? A trace I
>can turn on to figure out how much time is getting spent in which areas?
>
Use the profiler. Read all about it in the perldebug manual page.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Tue, 16 Jan 2001 16:07:44 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: techniques for finding slow code?
Message-Id: <slrn969e10.14i.tadmc@tadmc26.august.net>
dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com> wrote:
>I'd like to hear if ya'll have some favorite techniques for zeroing in
>on slow code.
You mean beyond the ones offered in the answer to your Frequently
Asked Question? No.
>any methods for generating some kind of a time analysis from the outside
>while it runs without inserting a bunch of print statements? A trace I
>can turn on to figure out how much time is getting spent in which areas?
Perl FAQ, part 3:
"How do I profile my Perl programs?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 16 Jan 2001 18:55:14 GMT
From: metacomputer1239@my-deja.com
To: metacomputer@yahoo.com
Subject: TNEF For Perl. Need Help. Is this a Perl Script?
Message-Id: <9425ed$4om$1@nnrp1.deja.com>
Hello,
I am try to setup a program called AMAVIS email virus scanner.
The Linux box is using RED HAT 6.0, when I try to install the AMAVIS it
gives me a message that I need TNEF. I can't find TNEF for REDHAT 6.0
RPM. Does anyone no where it can be found?
Is TNEF a Perl module, or program? Can a newer version of TNEF be
re-compiled, for Red HAt 6.0.
Thank You
Bob Brown
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 22:04:28 +0000
From: Greg Griffiths <greg2@surfaid.org>
To: metacomputer1239@my-deja.com
Subject: Re: TNEF For Perl. Need Help. Is this a Perl Script?
Message-Id: <3A64C56C.572C0334@surfaid.org>
what makes you think that it is a Perl module ?
metacomputer1239@my-deja.com wrote:
> Hello,
> I am try to setup a program called AMAVIS email virus scanner.
> The Linux box is using RED HAT 6.0, when I try to install the AMAVIS it
> gives me a message that I need TNEF. I can't find TNEF for REDHAT 6.0
> RPM. Does anyone no where it can be found?
> Is TNEF a Perl module, or program? Can a newer version of TNEF be
> re-compiled, for Red HAt 6.0.
>
> Thank You
> Bob Brown
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Tue, 16 Jan 2001 21:47:24 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: What's wrong with this (parent fork multiple children)?
Message-Id: <t69gbcs18bhj26@corp.supernews.com>
David Sisk <davesisk@ipass.net> wrote:
[snip]
> What I want to do is have the parent fork x children (in this case 2).
> Instead, I get the parent forking children and the children forking more
> children (essentially, a forking infinite loop) [pun intended]. I'm trying
> to prevent the children from forking more children with the "if ($cpid
> !=0)", but that doesn't seem to work. Can anyone point me in the right
> direction? What am I doing wrong here?
There is another thread in this group right now called "Forking lots
of children", in which there is advice to check of the forking
examples in _Perl_Cookbook_ ( aka the Ram ) and an example program
of a parent forking multiple children.
I'm sure the most recent post, including the example, is still around,
since I posted it this morning.
Please look at that thread, as I'd hate to cut and paste the same
long example to a second thread the same day.
Chris
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Tue, 16 Jan 2001 12:35:19 -0800
From: Mark Mertel <mmertel@ix.netcom.com>
Subject: Re: ZIp Code Perl Program
Message-Id: <3A64B087.3EB09CD1@ix.netcom.com>
i've written an LWP script to go to:
http://www.framed.usps.com/cgi-bin/zip4/ctystzip2?submit=Process&ctystzip="99999";
and parse the "DEFAULT" value returnd which is the city and state.
no biggie.
mmertel@ix.netcom.com
Phallicity wrote:
> I am looking for a perl (cgi) script that will automatically enter a
> users city & state given a zip code, maybe one that I could simply
> implement using the require (".."); function call. If anyone can tell
> me where to find one and how to implement it I would appreciate it.
> Please be as specific as possible for I am fairly new to Perl
> programming and am still learning.
>
> Thanks in advance,
>
> --
> Phallicity
>
> "He must have a huge Schwanstucker!"
> -Young Frankenstein
>
> Sent via Deja.com
> http://www.deja.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 V10 Issue 73
*************************************