[18472] in Perl-Users-Digest
Perl-Users Digest, Issue: 640 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 6 00:05:58 2001
Date: Thu, 5 Apr 2001 21:05:18 -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: <986529918-v10-i640@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 5 Apr 2001 Volume: 10 Number: 640
Today's topics:
Re: $text in a text file - how do I get it to print? <moiraine{NOSPAM}@qwest.net>
Re: $text in a text file - how do I get it to print? <wyzelli@yahoo.com>
ANNOUNCE: Text::FastTemplate v0.9 (Robert Lehr)
Anyone know how to handle CVS files With " in them? <gary@tigerstripes.co.uk>
Re: Anyone know how to handle CVS files With " in them? <wyzelli@yahoo.com>
apache:session <troyr@vicnet.net.au>
Re: CGI vs. embperl vs. Mason or CGI/emperl/mason <JIMIT@prodigy.net>
cookie woes. <hhsoft@csoft.net>
Re: Does "return @list" do a copy? <persicom@acedsl.com>
Re: Does "return @list" do a copy? <jeffp@crusoe.net>
Re: Does this newsgroup have an FAQ? (Chris Fedde)
Re: Does this newsgroup have an FAQ? <uri@sysarch.com>
Re: Hash Referencing question <chrisw+usenet@dynamite.com.au>
Re: Image Reloading?! <iltzu@sci.invalid>
Re: maximum value of a list (Gwyn Judd)
Re: NET::SMTP module problems <moiraine{NOSPAM}@qwest.net>
Re: Newbies welcome (Gwyn Judd)
Re: Newbies welcome <moiraine{NOSPAM}@qwest.net>
Re: Newbies welcome <wyzelli@yahoo.com>
Re: opening several Sendmail processes with Perl <jbc@west.net>
Re: opening several Sendmail processes with Perl (Chris Fedde)
Re: Please Help <nap@illx.org>
Re: Please Help <moiraine{NOSPAM}@qwest.net>
Re: Please Help <uri@sysarch.com>
problem with quoting or how to avoid \n at the the end <info@java.seite.net>
Re: problem with quoting or how to avoid \n at the the <jeffp@crusoe.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 05 Apr 2001 19:16:58 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: Re: $text in a text file - how do I get it to print?
Message-Id: <3ACD2719.3A9402B9@qwest.net>
Alan Fleming wrote:
> I have a program which reads info from a plain text file, containing
> variable names, eg:
>
> Hi, my name is $name, and I am $age years old...
This will display $name as the value of $name, etc:
print "Hi, my name is $name, and I am $age years old.";
This will display "$name":
print 'Hi, my name is $name, and I am $age years old.';
It's the difference between the single and double quotes.
<snip>
>
> Alan
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Fri, 6 Apr 2001 12:13:07 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: $text in a text file - how do I get it to print?
Message-Id: <vR9z6.11$YK2.2752@vic.nntp.telstra.net>
"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
news:3ACD2719.3A9402B9@qwest.net...
> Alan Fleming wrote:
>
> > I have a program which reads info from a plain text file, containing
> > variable names, eg:
> >
> > Hi, my name is $name, and I am $age years old...
>
> This will display $name as the value of $name, etc:
> print "Hi, my name is $name, and I am $age years old.";
> This will display "$name":
> print 'Hi, my name is $name, and I am $age years old.';
>
> It's the difference between the single and double quotes.
Not when $name is within a scalar read in from a text file, as the OP
described.
As other responders have already said, PerlFAQ4 gives the answer, though it
is probably A Bad Way to do things.
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Wed, 04 Apr 2001 05:31:25 GMT
From: bozzio@robert.the-lehrs.com (Robert Lehr)
Subject: ANNOUNCE: Text::FastTemplate v0.9
Message-Id: <tcqc7slqe69g5b@corp.supernews.com>
Keywords: TEMPLATE TEXT HTML COMPONENT MOD_PERL OBJECT
Text::FastTemplate v1.0
April 4, 2001
################################################################################
Text::FastTemplate is yet another template module written in Perl. So why
use this module instead of one of the other template modules? Well...
+ it's ultra simple.
+ it's fast.
+ it's lean.
+ it completely separates the presentation from the application logic.
+ it's a class.
SIMPLE:
This template uses a C-preprocessor style syntax, which means that it is
line-oriented. Unlike the C-preprocessor, this template provides syntax
for a loop around a block text that you might want to repeat.
FAST:
Like some other template modules, this template module converts the template
text into a subroutine and passes it to Perl's compiler. This compiled
subroutine is then cached for successive uses.
LEAN:
There is very little code to this module. And there are no typeglobs, which
means no memory leaks. One of the reasons this was originally written was
because a memory leak was discovered in one of the more popular template
modules when used in Apache/mod_perl.
OBJECT-ORIENTED:
Since it is a class, it is easily extensible. One of my favourite applications
of this module is to derive a Page class from it. The Page class overrides the
output() method with its own output() method that passes some common macroes,
such as a DATE or USER_ID string, with the original macroes to the parent
class output().
################################################################################
This module is really only useful in Perl programs that use the same template
several times during the lifetime of its execution such as Apache/mod_perl
(surprise!) or some other server/daemon.
Why another template module? I can describe it best by explaining why it was
ever written template module. We didn't want to write another template module.
We set our criteria and looked for a module that would work for our project.
We tried a couple of the popular modules but abandoned them. Why?
HTML::Template ?
pros: simple syntax, complete isolation of HTML from perl code
cons: memory leak, slow
HTML::Mason ?
pros: nice component structure, fast
cons: too easy to mix perl and HTML,
too complex for lame HTML coder
Text::Template ?
pros: could make our own template syntax
cons: too much overhead, too complex, meant too slow
In the end, we wanted a template that was simple, fast and completely separated
the text template from the perl code. We got it by using:
+ C-preprocessor line-oriented syntax (SIMPLICITY)
+ converting templates into perl subroutines and
compiling and caching it (SPEED)
Our design gave us two additional benefits that we didn't anticipate:
+ component-type flexibility, like Mason.
+ general text-template capability, i.e. it is not restricted to HTML.
Please note that I respect the templates that we evaluated. We simply had a set
of requirements that none of them fulfilled completely.
################################################################################
I certainly would appreciate any feedback from people that use it, including
complaints, suggestions, patches or anything. Even people that don't use it
are welcome to send comments.
Thanks for using Text::FastTemplate and for your feedback.
Cordially,
Robert Lehr
bozzio@the-lehrs.com
################################################################################
Legal information:
Copyright (c) 2001 Robert Lehr. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms as
Perl itself.
Caveat emptor. Use this module at your own risk. I will accept no
responsibility any loss of any kind that is the direct or indirect result
of the use of this module.
################################################################################
------------------------------
Date: Fri, 6 Apr 2001 03:47:30 -0700
From: "Gary Blake" <gary@tigerstripes.co.uk>
Subject: Anyone know how to handle CVS files With " in them?
Message-Id: <k5az6.5644$bL6.1097917@news2-win.server.ntlworld.com>
Anyone know how to handle CVS files With " in them?
I've come up blank with google searches!
Gary
gary@tigerstripes.co.uk
------------------------------
Date: Fri, 6 Apr 2001 13:05:52 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Anyone know how to handle CVS files With " in them?
Message-Id: <XCaz6.16$YK2.3116@vic.nntp.telstra.net>
"Gary Blake" <gary@tigerstripes.co.uk> wrote in message
news:k5az6.5644$bL6.1097917@news2-win.server.ntlworld.com...
> Anyone know how to handle CVS files With " in them?
>
Do you mean CSV? Where the data would normally look like:
"stuff","more stuff","other stuff and so on"
And you have:
"stuff","more stuff","other stuff with " and so on"
?
I normally strip the leading and trailing " and then split on "," but there
is a Module Text::CSV I think ... a CPAN search should help.
Here, I'll feed you a fish...
http://search.cpan.org/search?mode=module&query=csv
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
$d='$_$a$s$b$w';$e='$_$a$s$b';sub d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
sub
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
------------------------------
Date: Fri, 6 Apr 2001 13:23:20 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: apache:session
Message-Id: <7Haz6.182$pO2.4706@ozemail.com.au>
Hi there,
If anyone has used the apache::session module i was wondering....How do
you get the "last_update" field to update itself..whever the session is
accessed.
ie. When the session is created, the created and last update fields have the
current date time..but i would assume that the last_update field would
contain the most current activity.
Does anyone know of a work around for this
Thanks in advance
--
----------------------------------------------------------------
Troy Rasiah
Melbourne, Aus
------------------------------
Date: Thu, 5 Apr 2001 19:48:53 -0500
From: "Jimi Thompson" <JIMIT@prodigy.net>
Subject: Re: CGI vs. embperl vs. Mason or CGI/emperl/mason
Message-Id: <9ajcd1$5pe6$17@newssvr06-en0.news.prodigy.com>
You don't tell anyone what you're trying to accomplish. If you don't know
the end result, it's hard to recommend a tool.
A_Geekette <moiraine{NOSPAM}@qwest.net> wrote in message
news:3ACBA81A.1F8AD66B@qwest.net...
> Has anyone worked with all three of these? Do they work well in
> combination.
> ie: CGI generates HTML that has embperl script within the new HTML that
> calls on *.epl files...etc.
> How about Mason. I haven't found out much about it...I could've been
> tired from researching that day or something, but it seemed to me Mason
> didn't have much in the way of explanation on their site. I'll check
> again, but if anyone could point me in the direction of an alternate
> site that explains/has examples of Mason, I'd be much appreciative.
>
> Thanks,
>
> --
> Geekette
>
> "Try Not. Do or do not. There is no try."
> -If you don't know who said this,
> I don't want to talk to you. ;-)
>
> "Nothing is impossible, no matter how improbable."
> -Anonymous
>
>
------------------------------
Date: Thu, 05 Apr 2001 21:06:13 -0500
From: Kyle Dusang <hhsoft@csoft.net>
Subject: cookie woes.
Message-Id: <319qctkt92tvrqano5lriemtiv039jiebu@4ax.com>
Any reason why the following would not set a cookie in netscape 4.7
which lasts longer than a browser session? (it does in I.E. 5)
print "Set-Cookie: rpassword=${password}; expires=Thu, 01-Jan-2099
00:00:00 GMT;\n";
Thanks in advance.
Kyle
------------------------------
Date: Thu, 05 Apr 2001 22:54:46 -0400
From: "Matthew O. Persico" <persicom@acedsl.com>
Subject: Re: Does "return @list" do a copy?
Message-Id: <3ACD2FF6.B7F7F566@acedsl.com>
Norman Gaywood wrote:
>
> I think this is a question about the internals of perl.
>
> Suppose I have some code like this:
>
> my $big = 1000000;
> sub bigarray {
> my @ll;
> @ll[0..$big] = 1 x $big;
> }
> my @bl = bigarray;
>
> From what I can tell, the array is built in biglist() and on return the
> built array is copied to the new array (@bl). So briefly 2 copies of this
> big array exist while the values are copied. A pretty expensive operation.
Yup, it is. That's why there are references, among other reasons.
> And before I get told, "Use references. Cheers.", I know I can
> do this:
>
> sub rbigarray {
> my @ll;
> @ll[0..$big] = 1 x $big;
> \@ll;
> }
>
> But this means I have to remember to de-reference to get to my data.
> In this modern day and age with memory handling all done for us, why is
> this so?
Because you are not doing memory handling here. You're doing interface
contracting. Memory handling is the act of allocating and freeing
memory. Perl does that for you. You don't see any malloc calls and you
do not have to do any free calls.
> So I guess my question is, would it not be better to avoid the copy of
> arrays/lists on return from subroutines internally in perl? What is the
> reason it is not.
Because TIMTOWTDI in Perl. :-). Seriously, I think that references were
added in version 5; prior to that you HAD to get the copy. In order not
to break older code, the original copy sematics were not removed.
BTW, you can (should?) leave the choice of array or ref to the caller of
the function:
sub rbigarray {
my @ll;
@ll[0..$big] = 1 x $big;
return wantarray ? @ll : \@ll;
}
--
Matthew O. Persico
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area
--
Matthew O. Persico
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area
------------------------------
Date: Thu, 5 Apr 2001 23:12:39 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Does "return @list" do a copy?
Message-Id: <Pine.GSO.4.21.0104052310310.23266-100000@crusoe.crusoe.net>
On Apr 5, Matthew O. Persico said:
>Because TIMTOWTDI in Perl. :-). Seriously, I think that references were
>added in version 5; prior to that you HAD to get the copy. In order not
>to break older code, the original copy sematics were not removed.
Before references, you could use typeglobs, which allowed aliasing:
sub makeBigHash_1 {
local %hash = ( ... );
return *hash;
}
sub makeBigHash_2 {
local *hash = @_;
%hash = ( ... );
}
They are called like so:
*alias_to_hash = makeBigHash_1();
makeBigHash_2(*alias_to_hash);
They're the Perl 4 way of doing things. No need for such tomfoolery
anymore.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
------------------------------
Date: Fri, 06 Apr 2001 03:32:48 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Does this newsgroup have an FAQ?
Message-Id: <ANaz6.653$T3.191005184@news.frii.net>
[This messages was both posted to clpm and mailed to the poster]
In article <3ACC8455.FC1D5B99@uchicago.edu>,
Jesse James Jensen <jesse@uchicago.edu> wrote:
>Paul Tomblin wrote:
>>
>> In a previous article, "pgroves" <pgroves@ntlworld.com> said:
>> >If so, how do I get it?
>>
>> It appears you're not going to make the minimal effort of scanning a few
>> subject lines to find the information for yourself. Read the FAQ. While
>> you're at it, you might want to read the FAQ for news.newusers.questions
>> for tips on how to make a better first impression.
>>
>
>Perhaps the FAQ Server posts should include a direct link (e.g.,
>http://www.perl.com/pub/doc/manual/html/pod/perlfaq.html) at the very
>top of each message. And also post a generic "Here is the FAQ" message
>every so often.
>
I'm intrigued by your second suggestion. What form would the body of that
message take?
thanks
chris
--
This space intentionally left blank
------------------------------
Date: Fri, 06 Apr 2001 03:55:50 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Does this newsgroup have an FAQ?
Message-Id: <x7n19usmux.fsf@home.sysarch.com>
>>>>> "CF" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:
>> Perhaps the FAQ Server posts should include a direct link (e.g.,
>> http://www.perl.com/pub/doc/manual/html/pod/perlfaq.html) at the very
>> top of each message. And also post a generic "Here is the FAQ" message
>> every so often.
>>
CF> I'm intrigued by your second suggestion. What form would the body
CF> of that message take?
well, tad was working on something of that nature for this group. it is
on a web site somewhere but should be autoposted (probably once a day
for the volume we get here). you could easily add it to your FAQ
autopost code.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Fri, 6 Apr 2001 08:51:54 +1000
From: "Chris W" <chrisw+usenet@dynamite.com.au>
Subject: Re: Hash Referencing question
Message-Id: <WH6z6.37$2S7.158859@news.interact.net.au>
"Gregory Toomey" <gtoomey@usa.net> wrote in message
news:OVZy6.9656$45.56457@newsfeeds.bigpond.com...
> Hi everybody (again). I find the Perl typing machanism confusing
...
> Why does the assignment $hash=$var[$i] work, but %hash=$var[$i]
> not work?
>
> When I do the $hash=$var[$i], why do I reference elements as
> $hash->{hashval} rather than $hash{hashval}?
Each element of the array @var is a _reference_ to a hash not a hash.
To access a hash from a reference you use the $ref->{hashkey}syntax.
The $var[$i]{$j} is a convenient shortcut for $var[$i]->{$j} which you
should find also works.
'perldoc perlref' is a good place to be reading.
#!perl
use strict;
use warnings;
my @var = (
{ key1 => 'val1', key2 => 'val2', key3 => 'val3' },
{ key4 => 'val4', key5 => 'val5', key6 => 'val3' }
);
print $var[0]{key2}, "\n";
print $var[0]->{key2}, "\n";
my $ref = $var[1];
print $ref->{key5}, "\n";
------------------------------
Date: 5 Apr 2001 22:34:30 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Image Reloading?!
Message-Id: <986509799.7740@itz.pp.sci.fi>
In article <3ACB586B.39D8113C@sequenom.com>, Bryan Coon wrote:
>
>The header method in CGI.pm supposedly has the capability to prevent
>this, but I have not found any combination of -expires, -pragma settings
>which guarantee that images will be reloaded fresh, rather than from
>cache.
-expires => '-1d', -cache_control => 'no-cache'
works for me. YMMV. Remember that the browser back button will not
normally cause a refresh, nor can you force it to without client-side
scripting. This is generally considered a feature.
You'd probably get better advice for problems like this at another
newsgroup like comp.infosystems.www.authoring.cgi.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Thu, 05 Apr 2001 23:58:46 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: maximum value of a list
Message-Id: <slrn9cq5hl.qu.tjla@thislove.dyndns.org>
I was shocked! How could Dan Berger <djberge@uswest.com>
say such a terrible thing:
>Here were the results:
>
>Benchmark: timing 100000 iterations of foreach, map, max, sort...
>
>foreach: 4 wallclock secs ( 3.14 usr + 0.00 sys = 3.14 CPU)
>map: 9 wallclock secs ( 8.54 usr + 0.00 sys = 8.54 CPU)
>max: 21 wallclock secs (21.04 usr + 0.00 sys = 21.04 CPU)
>sort: 8 wallclock secs ( 9.11 usr + 0.00 sys = 9.11 CPU)
Here were mine:
Benchmark: timing 100000 iterations of foreach, map, max, sort...
foreach: 3 wallclock secs ( 2.45 usr + 0.00 sys = 2.45 CPU) @
40816.33/s (n=100000)
map: 6 wallclock secs ( 5.47 usr + 0.00 sys = 5.47 CPU) @
18281.54/s (n=100000)
max: 1 wallclock secs ( 0.30 usr + 0.00 sys = 0.30 CPU) @
333333.33/s (n=100000)
(warning: too few iterations for a reliable count)
sort: 4 wallclock secs ( 3.40 usr + 0.00 sys = 3.40 CPU) @
29411.76/s (n=100000)
I guess it depends what version of List::Util you have. I know mine runs
compiled C code instead of Perl code so it should be the fastest.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I don't have to take this abuse from you -- I've got hundreds of people
waiting to abuse me.
-Bill Murray, "Ghostbusters"
------------------------------
Date: Thu, 05 Apr 2001 18:55:04 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: Re: NET::SMTP module problems
Message-Id: <3ACD21F8.AE20F4B8@qwest.net>
Alan Fleming wrote:
<snip>
> Anyway, I really need this module, FAST, 'cos my clients are getting miffed
> by my lack of software for them! :p
>
> If anybody could reply to me personally (I'll be too busy to check this
> forum again soon) with either info on where to get this module, or a copy of
> it, I'd be very greatful.
www.cpan.org contains all your perl module needs. They also have the cpan
module which when installed will help with getting and installing perl modules.
I suggest using this, in the long run it'll save time. :-)
> Thanks in advance,
>
> Alan
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Thu, 05 Apr 2001 23:53:43 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Newbies welcome
Message-Id: <slrn9cq586.qu.tjla@thislove.dyndns.org>
I was shocked! How could Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
say such a terrible thing:
>On Thu, 05 Apr 2001 07:38:58 -0500, Cameron Dorey <camerond@mail.uca.edu> wrote:
>>Bernard El-Hagin wrote:
>>>
>>> On Thu, 05 Apr 2001 10:57:47 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>>> >I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
>>> >say such a terrible thing:
>>> >>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>>> >>Wyzelli <wyzelli@yahoo.com> wrote:
>>> >>>
>>> >>>I'd like to see you cut down a Californian Redwod using a banana.
>>> >>
>>> >
>>> >You just lack the imagination required to perform the job. I would
>>> >electrically charge the frozen banana and then accelerate it to near
>>> >lightspeed in a particle accelerator which was aimed at the base of the
>>> >tree. A few passes and the trunk of the tree will separate from the
>>> >roots. Simple.
>>>
>>> Aren't you, at this point, cutting down a California Redwood using a
>>> banana *and* a particle accelerator?
>>
>>Actually, he didn't say "using _only_ a banana." I'd use the banana as
>>an energy source (for me) before I picked up an appropriately-sized
>>chain saw to finish the job (preparation is here a very important step).
>
>Why would you need a chainsaw when you've got a banana? Chemistry
>professors. Sheesh!
Actually the correct way to do it is to prop the banana against the
trunk of the tree when it is very young. This will cause the tree to
grow on a slant as it rests its weight on the banana. After a few years,
just whip the banana away and hey-presto.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Out of register space (ugh)"
-- vi
------------------------------
Date: Thu, 05 Apr 2001 19:13:40 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: Re: Newbies welcome
Message-Id: <3ACD2654.86FB02C@qwest.net>
Bernard El-Hagin wrote:
<snip>
> Aren't you, at this point, cutting down a California Redwood using a
> banana *and* a particle accelerator?
>
Yes, so the way to cut down the tree with a banana would be to smush the banana
into a ball...as tight as you possibly can. Then, using some sort of flinging
device ie: a realy big sling-shot type contraption, aim it towards the tree and
fire. Viola, the tree will fall.
I may be using a sling-shot type apparatus to accelerate the banana, but he never
specified how I was to use the banana. Also, in this example I used Einstein's
Theory of Relativity.
M=Mo/(sq(1-(v^2/c^2)))
Basicly, what this means is that the closer an object's velocity gets to the speed
of light, the higher it's mass. Barring that the banana won't fall apart (which is
why I said mash it as tight as you can, even wait a little while for it to dry) the
banana, if flung fast enough, will be heavy enough to make the tree fall.
:-P
btw. I suffer from an inferiority complex, because I'm a girl and guys have a
tendancy not to believe me because of it. Which is why I explain in detail what I
mean. So again:
:-P~~
>
> Cheers,
> Bernard
> --
> #requires 5.6.0
> perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Fri, 6 Apr 2001 12:22:05 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Newbies welcome
Message-Id: <UZ9z6.15$YK2.2905@vic.nntp.telstra.net>
"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn9cq586.qu.tjla@thislove.dyndns.org...
I am finding it amusing that such a fatuous comment by me (albeit a poorly
specified problem domain) generated so much comment (and mirth).
Wyzelli (point to Tad.. e, l and i are all closer to the front of the
alphabet than the back.. (assuming of course a standard western english
alphabet and no particle accelerators...Oh never mind <grin>)
--
@x='074117115116032097110111116104101114032080101114108032104097099107101114
'=~/(...)/g;
print chr for @x;
------------------------------
Date: Thu, 05 Apr 2001 18:13:04 -0700
From: John Callender <jbc@west.net>
Subject: Re: opening several Sendmail processes with Perl
Message-Id: <3ACD1820.64E2AE5A@west.net>
George Hardisty wrote:
>
> For each user I
> am basically starting a sendmail instance with "|/usr/lib/sendmail
> $address". The program gets sluggish and I am thinking there has to be a
> less expensive way to do this
You might try opening sendmail with the -odq option, which will
put the message into the queue rather than sending it
immediately. perlfaq9 has some suggestions on this, in the
section on "How do I send mail?"
http://language.perl.com/newdocs/pod/perlfaq9.html#How_do_I_send_mail_
I suppose you could also do something like having the script
check the load, or the number of sendmail processes, and going to
sleep for a while when one or the other gets too high.
John
------------------------------
Date: Fri, 06 Apr 2001 03:42:48 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: opening several Sendmail processes with Perl
Message-Id: <YWaz6.654$T3.192169472@news.frii.net>
In article <Yb4z6.29623$8y.8216549@typhoon.austin.rr.com>,
George Hardisty <ghardisty@asia-net.com> wrote:
>I maintain a list of about 95K users who want job information. I keep the
>list very clean of old addresses, etc. I have a program in Perl that calls
>a function to merge user data (for the dynamic url to unsubscribe, etc.)
>into the message for the day and send. I run through a loop of each iser
>(95K of them) and each time call the function MailMerge (below) that call
>the FieldSub routine.
>
Rather than forking for each message you may want to use Net::SMTP to
connect to the local MTA. Then transmit multiple envelopes per connecton.
You'll probably make heavy use of the 'mail', 'recipient', 'data' and 'reset'
methods in your loop.
chris
--
This space intentionally left blank
------------------------------
Date: Thu, 05 Apr 2001 16:07:30 -0700
From: Nick Pinckernell <nap@illx.org>
Subject: Re: Please Help
Message-Id: <3ACCFAB2.1040607@illx.org>
I'm assuming your trying to write out to a file.
If so, your forgetting the 'mode' for writing.
which is a > in front of the filename in your open
statement.
open(FILEHANDLE, ">$file");
_nick
Waarddebon wrote:
> Why doesn't this work ?
>
> $remote2="today";
> open (THEFILE,"/data1/hm/makers/bezoekers/$remote2");
> print THEFILE "hi";
> close THEFILE;
------------------------------
Date: Thu, 05 Apr 2001 19:18:28 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: Re: Please Help
Message-Id: <3ACD2774.7BAB0A16@qwest.net>
Waarddebon wrote:
> Why doesn't this work ?
>
> $remote2="today";
> open (THEFILE,"/data1/hm/makers/bezoekers/$remote2");
> print THEFILE "hi";
print THEFILE . "hi";
This will print the file with "hi" at the end.
>
> close THEFILE;
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Fri, 06 Apr 2001 03:52:17 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Please Help
Message-Id: <x7pueqsn0u.fsf@home.sysarch.com>
>>>>> "AG" == A Geekette <moiraine{NOSPAM}@qwest.net> writes:
AG> Waarddebon wrote:
>> Why doesn't this work ?
>>
>> $remote2="today";
>> open (THEFILE,"/data1/hm/makers/bezoekers/$remote2");
>> print THEFILE "hi";
AG> print THEFILE . "hi";
AG> This will print the file with "hi" at the end.
where did you get the idea that would happen? did you try it? the OP has
several problems that you don't even address.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Fri, 06 Apr 2001 00:10:53 +0200
From: Christoph Bergmann <info@java.seite.net>
Subject: problem with quoting or how to avoid \n at the the end of <<EOF ?
Message-Id: <3ACCED6D.7EF8@java.seite.net>
hi...
i have a variable which could contain all sorts of special chars, like
", ' \ \n etc. normally it would be easy to give it to a subroutine with
&somesub($val);
but i have the problem, that i want to give the above code to another
subroutine which eval's the code later (there are reasons why)...
&anothersub('&somesub($val)');
doesn't work, because "somesub" doesn't know $val when its local (and it
is and should be). i tried:
&anothersub("&somesub(<<'WHATEVER'
$val
WHATEVER
)");
which works nearly perfect, but there are two problems left:
1. the argument passed to "anothersub" now has always one \n more at the
end than $val really has, because WHATEVER has to be alone in a line.
2. if WHATEVER appears in $val the argument will stop there and the rest
will result in a syntax error. i could choose an extremely weird char
combination but its not really clean...
does anybody know a better solution?
thanx in advance!
best regards,
christoph bergmann
------------------------------
Date: Thu, 5 Apr 2001 18:46:47 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: problem with quoting or how to avoid \n at the the end of <<EOF ?
Message-Id: <Pine.GSO.4.21.0104051846020.23266-100000@crusoe.crusoe.net>
On Apr 6, Christoph Bergmann said:
>but i have the problem, that i want to give the above code to another
>subroutine which eval's the code later (there are reasons why)...
>
>&anothersub('&somesub($val)');
Don't use eval(), then. Use a code reference.
anothersub( sub { somesub($val) } );
Then:
sub anothersub {
my $cref = shift;
# ...
$cref->(); # executes the function
}
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
------------------------------
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 640
**************************************