[18365] in Perl-Users-Digest
Perl-Users Digest, Issue: 533 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 20 09:10:38 2001
Date: Tue, 20 Mar 2001 06:10:19 -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: <985097419-v10-i533@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 20 Mar 2001 Volume: 10 Number: 533
Today's topics:
Re: many "used only once, possible typo" warnings in CG <webmaster@webdragon.munge.net>
Re: many "used only once, possible typo" warnings in CG <bart.lateur@skynet.be>
out of memory during load... <peter.turcan@minerva-is.sk>
Re: out of memory during load... <wyzelli@yahoo.com>
Re: out of memory during load... <ubl@schaffhausen.de>
print perldoc-pages nicely <wessner@hps.fzk.de>
Re: push, pop file handles to deal with recursive #incl <bart.lateur@skynet.be>
Re: push, pop file handles to deal with recursive #incl nobull@mail.com
Re: readdir out of memory (Rafael Garcia-Suarez)
Re: reading location header from lwp (Rafael Garcia-Suarez)
recursive use re eval <Jerome.Abela@free.fr>
Re: split fields in sub? <peb@bms.umist.ac.uk>
Re: split fields in sub? (Anno Siegel)
Re: too late for -T nobull@mail.com
Re: too late for -T <wyzelli@yahoo.com>
Re: too late for -T <tom@power.net.uk>
Re: use Net::SMTP <graeme.m@which.net>
Re: use Net::SMTP <bart.lateur@skynet.be>
Re: Why do "Learning Perl" Books Do This? A Subroutine <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Mar 2001 08:16:20 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: many "used only once, possible typo" warnings in CGI.pm using import_names("UT");
Message-Id: <9973kk$mpm$1@216.155.33.39>
In article <md09bt8v5q3rcafsb3tqpthg8gtv1e3lao@4ax.com>, Bart Lateur
<bart.lateur@skynet.be> wrote:
| Malcolm Dew-Jones wrote:
|
| >step 2, in the various scripts that use the variables
| >
| > # declare all the variables names, note the syntax is
| > # slightly different than normal "use var" usage
| >
| > use vars @my_global_variables ;
| >
| Note that the stuff on that line is executed, as plain perl, and passed
| as parameters to vars->import, as soon as this lmine is compiled. For
| example, this works too:
|
| use lib grep -d, "/path/a/lib", "/path/b/lib", "/path/c/lib";
|
|
| So, @my_global_vars must already be properly filled when the compiler
| gets to this line. But if you fill its contents in the initialisation
| code of modules that you used, as intended, that will have happened.
|
| Neat trick. It teaches people to go beyond standard programmer's
| thinking. It defeats the purpose of "use strict", so I'm not sure how
| much of an improvement it would be over not using strict at all, but
| it's (kinda) neat. "strict" doesn't checked fully qualified variable
| names, anyway.
so is it possible to do something like
#!perl -w
use strict;
@main::global_variables = qw($var1 @var2 %var3);
use vars @main::global_variables;
package MyOtherPackage;
use vars @main::global_variables;
package main;
effectively?
it passes the 'check syntax' and 'run' phases here under 5.004, but I'm
not sure if they wind up clobbering each other or not, somehow,
eventually..
Can any of you heavier gurus shed some light on this? Or is this, in
effect, the essence of your suggestion? :-)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Tue, 20 Mar 2001 11:22:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: many "used only once, possible typo" warnings in CGI.pm using import_names("UT");
Message-Id: <1afebt0a78rln3lkaejrduecfvakmsp3h6@4ax.com>
Scott R. Godin wrote:
>so is it possible to do something like
>
>#!perl -w
>use strict;
>
>@main::global_variables = qw($var1 @var2 %var3);
>use vars @main::global_variables;
>
>package MyOtherPackage;
>use vars @main::global_variables;
>
>package main;
>
>effectively?
No you missed a thing. The array must already be filled at the time the
compiler find the "use" statement that depends on it. If that global
variable was initialized inside a module that you used, it would work.
But withing one script file, you need to put it in a BEGIN block.
I expect this to work:
BEGIN {
@main::global_variables = qw($var1 @var2 %var3);
}
use vars @main::global_variables;
--
Bart.
------------------------------
Date: Tue, 20 Mar 2001 11:18:22 +0100
From: "Peter Turcan" <peter.turcan@minerva-is.sk>
Subject: out of memory during load...
Message-Id: <997as9$gob$1@ID-66615.news.dfncis.de>
hi all
I have the following procedure for converting of text file.
as parameter I pass name of text file. Problem is, that file is huge ( 19MB)
and if I want to convert it I vahe to split it to files per 10000 lines.
where can be problem? I don't save anything from file
there are also some initialisation procedures, but without influence on
memory.
thank you for help
#-------------------- begin --------------
sub mkcmt {
$infile = $_[0];
open (infile) || die "error opening input file: $infile";
$r=0;
foreach (<infile>) {
chomp;
$opbc = substr($_,0,2);
$opcode = substr($_,2,8);
$tim1 = substr($_,21,4);
$eng1 = substr($_,25,2);
$tim2 = substr($_,27,4);
$eng2 = substr($_,31,2);
$tim3 = substr($_,33,4);
$eng3 = substr($_,37,2);
$tim4 = substr($_,39,4);
$eng4 = substr($_,43,2);
$tetnum = 0;
$opb = $opbc.$eng1;
if (length($op{$opb}) > 0 and $tim1 > "0000" ) {
print outfile2 "\"$opcode\" \"\" \"$opb\" \"1\" ";
print outfile2 "\"\" \"\" $tim1 \n";
$t++;
}
$opb = $opbc.$eng2;
if (length($op{$opb}) > 0 and $tim2 > "0000" ) {
print outfile2 "\"$opcode\" \"\" \"$opb\" \"1\" ";
print outfile2 "\"\" \"\" $tim2 \n";
$t++;
}
$opb = $opbc.$eng3;
if (length($op{$opb}) > 0 and $tim3 > "0000" ) {
print outfile2 "\"$opcode\" \"\" \"$opb\" \"1\" ";
print outfile2 "\"\" \"\" $tim3 \n";
$t++;
}
$opb = $opbc.$eng4;
if (length($op{$opb}) > 0 and $tim4 > "0000" ) {
print outfile2 "\"$opcode\" \"\" \"$opb\" \"1\" ";
print outfile2 "\"\" \"\" $tim4 \n";
$t++;
}
if ($_{$opcode} != 1 ) {
$_{$opcode} = 1;
bar($a++);
$cod1 = substr($opcode,0,2);
$cod2 = substr($opcode,2,4);
$cod3 = substr($opcode,6,2);
$tim = $tim1;
$tim = ($tim1 > $tim2)?$tim1:$tim2;
$tim = ($tim1 > $tim3)?$tim1:$tim3;
$tim = ($tim1 > $tim4)?$tim1:$tim4;
print outfile "\"$opcode\" \"$line1{$cod1}\" yes ";
print outfile " \"$line2{$cod2}\"";
print outfile " \"$line1{$cod1}\"";
print outfile " \"$line2{$cod2}\"";
print outfile " \"$line3{$cod3}\"";
print outfile " \"$line3{$cod3}\"";
print outfile " $tim 01/01/00 yes ";
print outfile "\n";
$r++;
}
}
close $infile;
}
#------------------- END -------------------
--
Peter Turcan
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter Turcan peter.turcan@minerva-is.sk ICQ#76032190
Minerva Slovensko, a. s. TEL +421.(0)855.5400722
Sokolska 7 / ZVOLEN / 96001 FAX +421.(0)855.5400720
MOBILE: +420.(0)903.552880
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Tue, 20 Mar 2001 20:47:14 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: out of memory during load...
Message-Id: <Z_Gt6.5$dX.1905@vic.nntp.telstra.net>
"Peter Turcan" <peter.turcan@minerva-is.sk> wrote in message
news:997as9$gob$1@ID-66615.news.dfncis.de...
> hi all
>
> I have the following procedure for converting of text file.
> as parameter I pass name of text file. Problem is, that file is huge (
19MB)
> and if I want to convert it I vahe to split it to files per 10000 lines.
>
> where can be problem? I don't save anything from file
> there are also some initialisation procedures, but without influence on
> memory.
>
> #-------------------- begin --------------
> sub mkcmt {
> $infile = $_[0];
my $infile = shift;
> open (infile) || die "error opening input file: $infile";
Assuming that the file to be opened is passed to this sub as the first
argument, this would be better written as:
open (IN, "$infile") || die "error opening input file: $infile : $!";
Gives you an identifiable filehandle, and a meaningful error on failure.
> $r=0;
my $r = 0; # could we choose a better name so we know what $r is?
> foreach (<infile>) {
while (<IN>){
The foreach (assuming we got that file handle to read properly) would read
the whole file into an array, and the iterate over the array assigning each
element in turn to $_.
The while will read the file one line at a time, assigning it to $_.
The former approach is better for speed, but really bad on memory usage (as
you have found.)
> chomp;
> $opbc = substr($_,0,2);
> $opcode = substr($_,2,8);
> $tim1 = substr($_,21,4);
> $eng1 = substr($_,25,2);
> $tim2 = substr($_,27,4);
> $eng2 = substr($_,31,2);
> $tim3 = substr($_,33,4);
> $eng3 = substr($_,37,2);
> $tim4 = substr($_,39,4);
> $eng4 = substr($_,43,2);
> $tetnum = 0;
> $opb = $opbc.$eng1;
None of these variables are lexically scoped. It would be better for them
all to be decalred with 'my'.
It would be iteresting to see some sample data to know if that could be done
better.
> if (length($op{$opb}) > 0 and $tim1 > "0000" ) {
Here you are accessing a global variable declared somewhere else
($op{$opb}). Potentially bad. Better to have passed a reference to the hash.
Also, you are doing a numeric greater than test between $tim1 and the string
'0000' which happens to be numerically 0. Do you mean $tim > 0 or are you
looking for stringwise comparison with '0000'. (I don't know what your data
looks like so I can't guess).
> print outfile2 "\"$opcode\" \"\" \"$opb\" \"1\" ";
> print outfile2 "\"\" \"\" $tim1 \n";
Leaning toothpick syndrome. Read up on quotelike operators, particularly
qq().
outfile2 is assumed to be already open??? (Filehandles are all caps by
convention)
print OUTFILE2 qq("$opcode" "" "$opb" "1" "" "" $tim1 \n);
That handles both print statement lines in one AND is easier to read
> $t++;
Was $t set somewhere else? What are we counting? Good variable names help
with debugging.
Ditto on those comments for the other segments of your subroutine. All can
be improved significantly.
However, I think your major problem is the foreach/while method of reading
the file above.
<Other segments snipped for brevity>
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Tue, 20 Mar 2001 12:07:38 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: out of memory during load...
Message-Id: <3AB739FA.F4C03301@schaffhausen.de>
Peter Turcan schrieb:
>
> hi all
>
> I have the following procedure for converting of text file.
> as parameter I pass name of text file. Problem is, that file is huge ( 19MB)
> and if I want to convert it I vahe to split it to files per 10000 lines.
>
> where can be problem? I don't save anything from file
> there are also some initialisation procedures, but without influence on
> memory.
Without looking at the code, your problem probably is that your
algorithm's memory
usage increases with each line of the file, meaning you store each line
in memory.
You should try to handle each line separately and than let perl forget
about it which
means all references to it must be deleted. If you need to know
something abour other
lines when you compute a line, you need to think of a way to find out
when you dont
need a certain line anymore, so you can delete it from memory.
->malte
------------------------------
Date: Tue, 20 Mar 2001 14:44:25 -0800
From: Dirk Wessner <wessner@hps.fzk.de>
Subject: print perldoc-pages nicely
Message-Id: <3AB7DD49.C0939DCE@hps.fzk.de>
Hello to everyone.
How can I print perldoc pages nicely
formatted on a Postscript printer?
The only thing that worked a bit
was
perldoc -t | groff >lpr
but this doesnt look nice.
Thanks for help
Dirk Wessner
------------------------------
Date: Tue, 20 Mar 2001 11:38:56 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <g9gebtgc9lmp4v9ti22icencrmbhorv6t1@4ax.com>
John Lin wrote:
>Yes, it works. Great!!! Now I am ready for the "bare word F" version.
>
>my @stack;
>local *F;
>open F,'a.txt' or die $!;
>do {
> while(<F>) {
> if(/#include <(.*)>/) {
> push @stack,*F;
> local *F; # fails, with or without this line, or undef *F;
> open F,$1 or die $!;
> }
> else { print }
> }
>} while defined (*F = pop @stack);
>
>The result is:
>Undefined value assigned to typeglob at line 4, <F> line 3.
>Undefined value assigned to typeglob at line 4, <F> line 3.
>...
I wouldn't trust local on typeglobs and expect it to do the right thing.
In my experience, it often doesn't work.
Try
use FileHandle;
and make $f, the handle, a "new Filehandle". You can safely stack those.
--
Bart.
------------------------------
Date: 20 Mar 2001 12:30:30 +0000
From: nobull@mail.com
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <u91yrsmxll.fsf@wcl-l.bham.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> > open $f,'a.txt' or die $!;
> > do {
> > while(<$f>) {
> > if(/#include <(.*)>/) {
> > push @stack,$f;
> > open $f,$1 or die $!;
>
> You're stacking away the filehandle but keeping it in $f anyhow,
> so open() does its usual implicit close. When you pop it back from
> the stack it's still closed. Insert "my $f" between "push" and
> "open" (untested).
s/my/undef/
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 20 Mar 2001 11:17:48 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: readdir out of memory
Message-Id: <slrn9bef30.tmq.rgarciasuarez@rafael.kazibao.net>
mike at NOSPAM whatibelieve dot org wrote in comp.lang.perl.misc:
>
> Problem:
> this command causes machines to run out of memory.
>
> > perl -e 'opendir (SCF_DIR, "_SCF"); @scf_files=(readdir(SCF_DIR)); print @scf_files;'
> results in:
> Out of memory!
Have you tried to use readdir in scalar context? As in :
perl -le 'opendir DIR,".";print while $_=readdir DIR'
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Tue, 20 Mar 2001 11:20:29 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: reading location header from lwp
Message-Id: <slrn9bef7n.tmq.rgarciasuarez@rafael.kazibao.net>
Eric wrote in comp.lang.perl.misc:
> I done this before but i lost the script :(
>
> I make a POST request with lwp
> the server i make the request to will then redirect me to another location
> with a Location: header
> how do i read the location header from lwp
> i tried this one but it doesnt work
> print $res->headers->location;
Have you checked that LWP does not do the redirect for you ? You can
read in the LWP::UserAgent doc about request(), simple_request() and
redirect_ok().
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/perl/biscuit.html
------------------------------
Date: Tue, 20 Mar 2001 12:49:33 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: recursive use re eval
Message-Id: <3AB750BD.44D21BE2@free.fr>
Hi, there !
"use re 'eval'" does not seem to work on recusive eval groups:
- This code works:
use re 'eval';
$re='(??{"."})';
"aaa" =~ /$re/;
- But this code doesn't work:
use re 'eval';
$re='.(??{$re})';
"aaa" =~ /$re/;
Does anyone have any idea to make this code sample work ?
Jerome.
--
()
/\
------------------------------
Date: Tue, 20 Mar 2001 10:34:52 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: split fields in sub?
Message-Id: <3AB7324C.91BC816D@bms.umist.ac.uk>
Daniel wrote:
>
> just wondering if there is a way to
> have the split in a sub so I can call from other subs?
> So far I have not been able to get this to work.
> I would appreciate any ideas. Thanks.
<snip code>
#!/usr/bin/perl -w
^^
use strict;
^^^^^^^^^^^
many people in this group will ignore a post without evidence of some
error checking on behalf of the poster.
> sub split_db {
> ($sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price) =
> split(/\|/,$_);
> return ($_);
> }
I'm sure split is working fine. You're not doing anything with the
items returned by the split function.
perhaps you meant
sub split_db {
my @split_results = split(/\|/, $_);
return @split_results;
}
or even more succinct
sub split_db {
return (split(/|\/));
}
which makes me think that you don't need a subroutine for the split at
all.
for ($i=$pos;$i<$max;$i++) {
@database_rows = &split_db($database_rows[$i]);
print "$sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price";
}
how about
for(@database_rows){
my ($sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price) =
split(/\|/);
print "$sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price\n";
}
HTH
Paul
------------------------------
Date: 20 Mar 2001 10:39:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: split fields in sub?
Message-Id: <997c05$arj$1@mamenchi.zrz.TU-Berlin.DE>
According to Daniel <dp@dsoft.com>:
> just wondering if there is a way to
> have the split in a sub so I can call from other subs?
> So far I have not been able to get this to work.
> I would appreciate any ideas. Thanks.
>
>
> local(@database_rows);
Are you using local() for a particular reason here? If not, use
my() instead.
> @database_rows = &load_productdb;
> my($max) = $pos + $numtolist;
> if ($max > $SIZE2) {
> $max = $SIZE2;
> }
> for ($i=$pos;$i<$max;$i++) {
Make that "for ( my $i = ...". The more common a variable name ($i,
in this instance, is extremely common), the more it deserves to be
protected by a lexical scope. Of course, all variable names are
somewhat common, so all variables deserve this protection.
> @database_rows = &split_db($database_rows[$i]);
Here you are assigning a new value to the array you are iterating
over (@database_rows). It's unlikely that you really want to
do that.
> print "$sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price";
>
> }
Now to your actual question: The routine split_db.
> sub split_db {
> ($sku, $name, $partnum, $descrip, $cpu, $stock, $list, $price) =
> split(/\|/,$_);
You don't seem quite decided what split_db should actually do. On the
one hand, you are assigning the split parts to a list of package-global
names. This should work as intended, but would be considered poor
programming style. It is generally a bad idea to have a sub work on
data that aren't visible at he place of the call.
Further, a bit above, you are calling split_db() with a parameter,
but inside split_db you never bother to take care of the parameter.
Instead you seem to assume its value automatically appears in $_.
This is not the case.
> return ($_);
On the other hand, you are returning $_, the string you just have split.
But split() doesn't change the underlying string, so you would only
return the routine's single parameter, out as in.
>
> }
>
Your split_db could look somewhat like this:
sub split_db {
split /\|/, shift;
}
but then, if that is all split_db is doing, why bother?
Anno
------------------------------
Date: 20 Mar 2001 12:16:51 +0000
From: nobull@mail.com
Subject: Re: too late for -T
Message-Id: <u97l1kmy8c.fsf@wcl-l.bham.ac.uk>
"Géry" <ducateg@info.bt.co.uk> writes:
> Does anyone know why?
Has "anyone" looked in the Perl manual (perldiag) at the explaination
of this error message?
If so then yes, "anyone" knows why.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 20 Mar 2001 22:26:16 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: too late for -T
Message-Id: <QrIt6.9$dX.2512@vic.nntp.telstra.net>
"Eli the Bearded" <elijah@workspot.net> wrote in message
news:eli$0103191405@qz.little-neck.ny.us...
> In comp.lang.perl.misc, Géry <ducateg@info.bt.co.uk> wrote:
> > I have tried to run a Perl script on Ms IIS server v4. I want to run
with
> > the tainted security option -T. IIS complains about it and returns the
> > message "Too late for -T ...".
> >
> > Does anyone know why?
>
> I don't know exactly what IIS is doing, but I have a theory.
<snip>
> So I think that IIS is trying to just run your script with a
> command line like "perl iis-script", and that is causing the
> problem.
>
> I can't suggest a way to fix this, however.
>
IIS calls perl.exe from an association in the applications configuration
panel for the scripts directory in the web site properties.
That call normally looks like:
d:\perl\bin\perl.exe %s %s
Where the %s are the script name and the other parameters (GET/POST)
respectively.
I suggest that this line needs to be modified to be:
d:\perl\bin\perl.exe -T %s %s
But I am not near my server in order to try...
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Tue, 20 Mar 2001 13:16:02 +0000
From: Tom Scheper <tom@power.net.uk>
Subject: Re: too late for -T
Message-Id: <pulebt0cb1jreavqhakb5n1igej82v0l4h@4ax.com>
On Mon, 19 Mar 2001 10:23:18 -0000, "Géry" <ducateg@info.bt.co.uk>
shed a beam of light on us:
>I have tried to run a Perl script on Ms IIS server v4. I want to run with
>the tainted security option -T. IIS complains about it and returns the
>message "Too late for -T ...".
>
>Does anyone know why?
It probably means it's after six. Because it's free software,
additional functionality ceases outside office hours. In theory, if
you try again in the morning it should be alright.
-=Cornelis
------------------------------
Date: Tue, 20 Mar 2001 09:09:39 -0000
From: "Graeme Miller" <graeme.m@which.net>
Subject: Re: use Net::SMTP
Message-Id: <9976mc$nbl$1@yarrow.open.ac.uk>
Thanks for that Miguel. I was assuming that the module just passed the
newline on and that the SMTP server needed it, but having made your
suggested changes it works fine.
"Miguel Cruz" <mnc@admin.u.nu> wrote in message
news:7bDt6.826$Vl6.394199@typhoon1.ba-dsg.net...
> Graeme Miller <graeme.m@which.net> wrote:
> Why not just:
>
> $smtp->to($email);
>
> > $smtp->mail("$from\n");
> > $smtp->to("$to\n");
>
> Likewise, these newlines just get stripped off right away by Net::SMTP.
> Why put them in? They're certainly not part of valid addresses.
------------------------------
Date: Tue, 20 Mar 2001 12:07:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: use Net::SMTP
Message-Id: <n0iebtgmv6d79s5ipdf0uavr4tubf7s8kb@4ax.com>
jtjohnston wrote:
>I'm running Perl on a mini-server from a cd rom:
>http://www.indigostar.com/microweb.htm and need to send data from a
><textarea> which can include \r\n Sambar's mailit.exe requires temp files. I
>cannot on a cd :)
But Microweb is Win32 only. Can't you use the TEMP environment variable
to know where to put the temporary files?
--
Bart.
------------------------------
Date: Tue, 20 Mar 2001 11:34:42 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <mgfebtss4qmtt24absdqft110da0vfp556@4ax.com>
John Lin wrote:
>"Abigail" wrote,
>> Abigail
>> --
>> my $qr = /^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
>> $qr =~ s/$qr//g;
>> print $qr, "\n";
>The result is:
>Use of uninitialized value in pattern match (m//) at line 1.
>
>Although I don't understand this code,
>when I replace with qr/.../ at the first line, it works.
It looks to me like you discovered a typo, and fixed it.
Here's how it works: the regex contains 3 alternatives. The first one
removes everything up to and including the second semicolon, the second
alternative won't ever match because the leading semicolon is already
gone, and the third alternative deletes everything from the first
semicolon it finds, right after "Hacker", up to the end of the string.
--
Bart.
------------------------------
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 533
**************************************