[18363] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 531 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 20 03:05:40 2001

Date: Tue, 20 Mar 2001 00:05:10 -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: <985075509-v10-i531@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 20 Mar 2001     Volume: 10 Number: 531

Today's topics:
    Re: assigning to other then $_ from for loop (Gwyn Judd)
        CGI.pm question/problem & other question. <jondecamp@home.com>
    Re: CGI.pm question/problem & other question. <ben.sugars@home.com>
    Re: CGI.pm question/problem & other question. <philipg@atl.mediaone.net>
    Re: check a pop3 mailbox without using additional modul (Damian James)
    Re: Die with 'use strict' <ydzhang@iastate.edu>
    Re: Help! Need script to execute a form POST <spohn@bigfoot.com>
    Re: how can I restart a regex within a substitution wit <rick.delaney@home.com>
    Re: How do/Can I ... A question on shared libraries. <rick.delaney@home.com>
    Re: How to rearrange the number output from "printf" or <joe+usenet@sunstarsys.com>
    Re: How to rearrange the number output from "printf" or <joe+usenet@sunstarsys.com>
        How to rearrange the number output from "printf" or "pr <CCEDMOND@mail.cityu.edu.hk>
    Re: How to rearrange the number output from "printf" or <gtoomey@usa.net>
    Re: how to swap 2 fields in a file <ben.sugars@home.com>
    Re: how to swap 2 fields in a file <godzilla@stomp.stomp.tokyo>
    Re: how to swap 2 fields in a file <wyzelli@yahoo.com>
        implementing perl coroutines (Amir Khosrowshahi)
    Re: Print "tar" Success or Failure (Garry Williams)
    Re: Print "tar" Success or Failure <whataman@home.com>
    Re: push, pop file handles to deal with recursive #incl <johnlin@chttl.com.tw>
    Re: push, pop file handles to deal with recursive #incl (Gwyn Judd)
    Re: use Net::SMTP (Garry Williams)
    Re: use Net::SMTP (Miguel Cruz)
    Re: Why do "Learning Perl" Books Do This? A Subroutine  <johnlin@chttl.com.tw>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Mar 2001 03:20:53 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: assigning to other then $_ from for loop
Message-Id: <slrn9bdj4k.6hn.tjla@thislove.dyndns.org>

I was shocked! How could Kim C <kimmfc@mydeja.com>
say such a terrible thing:
>Is there a way to assign to a declared variable with a
>'for(@somearray)' as can be done with a 'foreach
>$somevar(@somearray)'?

Well, for and foreach are exactly the same thing, so anything you can do
with one you should be able to do with the other.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
What a person believes is not as important as how a person believes.
-Timothy Virkkala


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

Date: Tue, 20 Mar 2001 02:43:35 GMT
From: Jon DeCamp <jondecamp@home.com>
Subject: CGI.pm question/problem & other question.
Message-Id: <3AB6C3CE.A9D9C72B@home.com>

Greetings,

Question #1:  A CGI script that I am writing in perl could probably go for the
handy-dandy-features of CGI.pm, but there's one thing that I can't find that it
can do.  This script takes in a list of variables/value pairs from the form, but
it doesn't care what the names of the variables are.  All I want to do is place
the variables in key=value pairs in a hash.

I have already done this using other means, but I would like if there was an
easy to do it with CGI.pm.  Normally I know that I would have to know the name
of the field from the form, but that ruins the dynamics of this script.  So if
anyone knows of a way to do this, please let me know.  Thank you.

Question #2:  In this script I pull a value from a file, let's say the value is
something like this:

$list[1] = "^b.*s$"

Where basically it's a regular expression.  I would like to use $list[1] in a
match or s/// operator as a regular expression, and not plain text.  Is this
possible?  So I can go

m/$list[1]/ && print;

then it will print lines that begin with "b" and ends with "s"?  Or is there
something tricky that I have to do?

Thank you in advance for any advise.

Mr-Pope



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

Date: Tue, 20 Mar 2001 04:08:46 GMT
From: Benjamin Sugars <ben.sugars@home.com>
Subject: Re: CGI.pm question/problem & other question.
Message-Id: <Pine.LNX.4.21.0103192259490.10449-100000@localhost.localdomain>

On Tue, 20 Mar 2001, Jon DeCamp wrote:

> Question #1:  A CGI script that I am writing in perl could probably go for the
> handy-dandy-features of CGI.pm, but there's one thing that I can't find that it
> can do.  This script takes in a list of variables/value pairs from the form, but
> it doesn't care what the names of the variables are.  All I want to do is place
> the variables in key=value pairs in a hash.

What version of CGI.pm are you using?  Version 2.752 has a method called
Vars() which does what you want.

> Question #2:  In this script I pull a value from a file, let's say the value is
> something like this:
> 
> $list[1] = "^b.*s$"
> 
> Where basically it's a regular expression.  I would like to use $list[1] in a
> match or s/// operator as a regular expression, and not plain text.  Is this
> possible?

Look at the perlop manpage.  Pattern match and substitution operators are
subject to variable interpolation unless you delimit with single quotes,
so you should be in luck.  Of course you still need to pull in the value
from the file; I presume you've done that already?

Cheers,
-Ben

-- 
Benjamin Sugars <ben.sugars@home.com>



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

Date: Tue, 20 Mar 2001 04:00:19 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: CGI.pm question/problem & other question.
Message-Id: <nBAt6.150619$Z8.31348434@typhoon.southeast.rr.com>


Jon DeCamp <jondecamp@home.com> wrote in message
news:3AB6C3CE.A9D9C72B@home.com...
> Greetings,
>
> Question #1:  A CGI script that I am writing in perl could probably go for
the
[snip]

my $q = CGI->new;
my %params = map { $_ => $q->param($_) } $q->param;

> Question #2:  In this script I pull a value from a file, let's say the
value is

Try it and find out!

p




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

Date: 20 Mar 2001 02:18:41 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: check a pop3 mailbox without using additional modules
Message-Id: <slrn9bdffe.l0g.damian@puma.qimr.edu.au>

Allodoxaphobia chose 20 Mar 2001 01:39:10 GMT to say this:
>...
>On the same topic:  Can one install modules in their own $HOME
>(sub)directories and somehow point the perl sorce at that 
>executable in that directory?
>

This is a FAQ. See:

	perldoc -q 'How do I keep my own module/library directory?'

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Mon, 19 Mar 2001 21:31:41 -0600
From: YD <ydzhang@iastate.edu>
Subject: Re: Die with 'use strict'
Message-Id: <3AB6CF1D.E994618D@iastate.edu>

Because, before asign value to the variable $result (left hand or the
'='), the script evaulates the right hand side ( `ls foobar` or die
"Failed: $result\n") and encounters a global variale $result, this
confilicts with 'use strict;'.

two ways to fix:
my $result;
$result=`ls foobar` or die "Failed: $result\n";

or

use var qw($result);
$result=`ls foobar` or die "Failed: $result\n";



Peter Sundstrom wrote:

> I'm curious why 'use strict' complains about the following snippet
>
> #!/usr/local/bin/perl -w
> use strict;
>
> my $result=`ls foobar` or die "Failed: $result\n";
>
> $ ./foo
> Global symbol "result" requires explicit package name at ./foo line 4.
> Execution of ./foo aborted due to compilation errors.
>
> Is the die considered to be out of scope?



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

Date: Mon, 19 Mar 2001 23:05:01 -0600
From: Albert Spohn <spohn@bigfoot.com>
Subject: Re: Help! Need script to execute a form POST
Message-Id: <MPG.15209e95a3d9f67e989685@news.chartermi.com>

In article <3ab6b767.430363880@news.ne.mediaone.net>, 
bdrobin@zdnetonebox.com says...
> Newbie here.....I have searched high and low and cannot figure out how
> to get my perl script to emulate a user filling in a username and
> password.   I have the user name and password, and need my perl script
> to login to the site so it can automatically access some of its
> resources.    Can someone help?
> 
> I believe this is the relevant code from the web page.
[...]
This is probably an overly general answer, but unless this type of thing 
is a one-shot deal for you, odds are you'll be well served by checking 
out the following book (or maybe the current O'Reilly equivilent since 
I'm thinking this one may be out of print):

http://www.oreilly.com/catalog/webclient/

in conjunction with the WWW related modules (I think LWP and HTTP would 
suffice for what you're trying to do):

http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=cat;catinfo=15

Once you get the hang of using modules the types of things you can do 
writing http clients (spelled out nicely in the book) is really pretty 
cool.  

Hope this helps,
Al







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

Date: Tue, 20 Mar 2001 02:59:07 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: how can I restart a regex within a substitution without leaving the
Message-Id: <3AB6CABD.D11175CD@home.com>

info@java.seite.net wrote:
> 
> In article <3AB2C9B4.69EABF12@home.com>, Rick Delaney
> <rick.delaney@home.com> writes:
> >[posted & mailed]
> >
> >Yes, look for "postponed" regular expression in perlre.
> >
> >  $x=~ s/((??{"$c"}))/$1 eq "#" ? ($c="b|#", "#") : "*"/ge;
> >
> 
> ah, i c...
> 
> does this have any speed drawbacks?
> 
> i mean, when the regex routine moves through the text, does it evaluate the
> code every single char?

Certainly, otherwise how will it know if it could match at that point? 
You will need to use "plain" regexp features to narrow down the engine's
searching.  Something like this for the above example:

    s/(?=[ab#])((??{"$c"}))/repl/g;

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 20 Mar 2001 04:08:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: How do/Can I ... A question on shared libraries.
Message-Id: <3AB6DB18.B16FDDB4@home.com>

[posted & mailed]

Blair Dean wrote:
> 
> Can I find out if a Perl installation was built to use shared libraries
> and if so, where those libraries would reside?

 perl -V:useshrplib

will tell you if it was built as a shared lib or not.

 perl -V:libperl

will tell you its name.  Both of these show up under the standard perl
-V.

 perl -V:shrpenv

may tell you where to find it.

`perldoc Config` for more perl configuration variables.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 20 Mar 2001 02:27:37 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to rearrange the number output from "printf" or "print" function  with comma
Message-Id: <m3n1ag3no6.fsf@mumonkan.sunstarsys.com>

CCEDMOND <CCEDMOND@mail.cityu.edu.hk> writes:

> Is there anybody know how to rearrange the number output from "printf"
> or "print" function with comma? That is, if the number is 1234567, the
> output should be "1,234,567". Is there any built-in function in perl for
> doing this?

See

  % perldoc -q "numbers with commas"

To "rearrange the number output from printf or print", I think you need
tied filehandles for this.  Here's one way to do it:

#!/usr/bin/perl -wl
use strict;
use FileHandle;

tie *STDOUT, "NumberFilter";
print 122345;
print 19895;
printf "number is %d", 9080;

package NumberFilter;
use base 'FileHandle';

sub TIEHANDLE { bless FileHandle->new( ">&STDOUT" ), shift }

sub PRINTF {
  my ($fh, $fmt) = @_;
  $fh->PRINT( sprintf $fmt, @_[2..$#_] );
}

sub AUTOLOAD {

  use vars qw/$AUTOLOAD/;
  no strict 'refs'; # so we can install new subs at runtime
  warn "AUTOLOADING $AUTOLOAD";

  $AUTOLOAD =~ s/.+:://;
  my $sub = $_[0]->can(lc $AUTOLOAD) or 
    die "Can't load '$AUTOLOAD'";

  *$AUTOLOAD = sub {
                      my ($fh, @out) = @_;
                      for (@out) {
                        1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
                      }

                      $sub->($fh, @out);

                   };
  &$AUTOLOAD;

}
__END__

HTH

Joe Schaefer
-- 
print in_str(shift, shift); #prints number of times $ARGV[1] occurs in $ARGV[0]
use Inline C => q{ int in_str(SV *x, SV *y){int cnt=0; char *hay=SvPV(x,PL_na);
char *ndl=SvPV(y,PL_na);if(!SvPOK(x)||!SvPOK(y)){return 0;}hay=strstr(hay,ndl);
while( hay != NULL ){ ++cnt; hay = strstr( hay + 1, ndl ); } return( cnt ); } }


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

Date: 20 Mar 2001 02:42:46 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to rearrange the number output from "printf" or "print" function  with comma
Message-Id: <m3g0g83myx.fsf@mumonkan.sunstarsys.com>

Joe Schaefer <joe+usenet@sunstarsys.com> writes:

> To "rearrange the number output from printf or print", I think you need
> tied filehandles for this.  Here's one way to do it:

[...]

>                         1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
                                    ^
                              drop the anchor:

                          1 while s/([-+]?\d+)(\d{3})/$1,$2/;

Oops.

-- 
Joe Schaefer      "Never interrupt your enemy when he is making a mistake."
                                               -- Napoleon Bonaparte


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

Date: Tue, 20 Mar 2001 12:38:41 +0800
From: CCEDMOND <CCEDMOND@mail.cityu.edu.hk>
Subject: How to rearrange the number output from "printf" or "print" function  with comma
Message-Id: <3AB6DED0.D5318D3F@mail.cityu.edu.hk>

Dear all,

Is there anybody know how to rearrange the number output from "printf"
or "print" function with comma? That is, if the number is 1234567, the
output should be "1,234,567". Is there any built-in function in perl for
doing this?

Best Regards,
01.03.20
Edmond



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

Date: Tue, 20 Mar 2001 17:09:55 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: How to rearrange the number output from "printf" or "print" function with comma
Message-Id: <ZaDt6.37044$v5.81071@newsfeeds.bigpond.com>

This function does the trick.

sub commify {
        local $_  = shift;
        1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
        return $_;
}

(The only advantage of Cobol over Perl - Cobol add commas automatically!!)

gtoomey
-------------
"CCEDMOND" <CCEDMOND@mail.cityu.edu.hk> wrote in message
news:3AB6DED0.D5318D3F@mail.cityu.edu.hk...
> Dear all,
>
> Is there anybody know how to rearrange the number output from "printf"
> or "print" function with comma? That is, if the number is 1234567, the
> output should be "1,234,567". Is there any built-in function in perl for
> doing this?
>
> Best Regards,
> 01.03.20
> Edmond
>




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

Date: Tue, 20 Mar 2001 02:18:42 GMT
From: Benjamin Sugars <ben.sugars@home.com>
Subject: Re: how to swap 2 fields in a file
Message-Id: <Pine.LNX.4.21.0103192109350.10449-100000@localhost.localdomain>

On Tue, 20 Mar 2001, ckw wrote:

> how do i swap 2 fields in a file

Depends on the format of the file.  I see there's a question called "How
do I extract selected columns from a string?" in the FAQ.  That might
help.

You'd probably also better read the perlfunc manpage for information on
open(), split(), print(), close(), et al.  If you're dealing with
fixed-width fields, you'd better read about unpack() too.

Cheers,
-Ben

-- 
Benjamin Sugars <ben.sugars@home.com>



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

Date: Mon, 19 Mar 2001 18:48:42 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: how to swap 2 fields in a file
Message-Id: <3AB6C50A.F3E64BCE@stomp.stomp.tokyo>

ckw wrote:
 
> how do i swap 2 fields in a file

> for eg
> abcdef                ghiji
> becomes
> ghiji                    abcdef


Here ya go, already done:

                      for eg
ghiji                 abcdef
                      becomes
abcdef                ghiji


Nice neat arrangement, yes?
Just copy and paste this in your file.


Godzilla!

* wonders why people post inane articles *


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

Date: Tue, 20 Mar 2001 16:17:19 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: how to swap 2 fields in a file
Message-Id: <rRCt6.14$zS.5478@vic.nntp.telstra.net>

"ckw" <nerdy@lycosasia.com> wrote in message
news:3ab6a8dd_2@news01.one.net.au...
> how do i swap 2 fields in a file
> for eg
> abcdef                ghiji
> becomes
> ghiji                    abcdef
>

($field1, $field2) = ($field2, $field1);

Wyzelli
--
@x='07411711511603209711011111610410111403208010111410803210409709910710
1114'=~/(...)/g;
print chr for @x;




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

Date: Tue, 20 Mar 2001 02:16:35 GMT
From: amirk@NO_SPAMamirk.com (Amir Khosrowshahi)
Subject: implementing perl coroutines
Message-Id: <slrn9bdf30.9s7.amirk@python.amirk.com>

there is a python wrapper to Edgar Toernig's C coroutine library
(http://www.nightmare.com/~rushing/copython/). has anyone tried to
implement a similar wrapper for perl, without using context switching
or threads?

it seems like there are plans to implement coroutines for perl 6
(http://dev.perl.org/rfc/27.html). does anyone know of possible work
in progress?

unfortunately, i dont know enough about XS and the perl stack to know
if something like this is feasible. 


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

Date: Tue, 20 Mar 2001 02:12:40 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9bdf4n.dni.garry@zfw.zvolve.net>

On Mon, 19 Mar 2001 23:11:08 GMT, What A Man ! <whataman@home.com> wrote:
> [aka BuckNaked1, I'm on PC, so I can quote properly.}
> 
>> >> Garry Williams wrote:
>> 
>> >> > BUCK NAKED1 wrote:
>> >> > I've tried...
>> >> > if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")==0) {
>> >> > print "SUCCESS";
>> >> > }
>> >> > else {print "FAILURE";
>> >> > };
>> >> > ..and this doesn't work. Why?
>> >
>> >> Probably because this tar doesn't return  a proper exit value.
>> >
>> > Hmmm... I thought I learned from the other thread where I asked about
>> > this that "tar" returned a value of "0" upon success, so why is an 
>> > exit value of "0" wrong?
>> 
>> Run the command from the command line and examine the exit code.
>> 
> I've been thru this with another poster. Tar returns nothing on success,
> which would be false or 0. Is an exit value different than a return
> value?



The other poster was *wrong*.  

Every command returns an exit value.  (There is no way for a command
to return "nothing".)  You can print it by using the following command
from most shells: 

  echo $?

A command's exit status has nothing to do with what it happens to
print to its STDOUT or its STDERR.  

In Perl, the exit status of a command that is executed with the qx//
operator or the system() operator is placed in $?, too.  You can check
it.  Read the system section of the perlfunc manual page to find out
how to interpret it.  



>> > mkdir $tmpdir, 0705;
>> > `tar -zxf $tmpfile -C $tmpdir 2>&1, Tarfile has been Extracted\n`==0 ||
>> 
>> This make no sense.  qx// will return the *output* of the command, not
>> the exit code. 
> So, I don't need the ==0. OK.


Okay.  The backtick operator (qx//) returns the _output_ of the
command; the stuff it prints to STDOUT.  So it makes no sense to
compare it numerically to zero.  


>> I doubt that will ever be the number zero (at least
>> from the tar commands that I know).
> Again I get child status 1 or 3 on failure, and nothing(0) on tar
> success. What do you think I should get for return values?

Zero is *not* nothing.  

If by "child status" you mean that is the value in $? after a system()
or backtick operator, then great!  The return value of zero *is*
success.  Unfortunately, zero is *false* in Perl.  So your code needs
to reflect that.  The code above does *not* check the exit status of
the tar command.  It checks the output that tar produced on its STDOUT
and STDERR for truth.  If it prints anything, it will be true.  


-- 
Garry Williams


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

Date: Tue, 20 Mar 2001 05:09:04 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Print "tar" Success or Failure
Message-Id: <3AB6E66B.250B4059@home.com>

Garry Williams wrote:
> 

> >> Run the command from the command line and examine the exit code.
> >>

> Every command returns an exit value.  (There is no way for a command
> to return "nothing".)  You can print it by using the following command
> from most shells:
> 
>   echo $?

I got nothing for success and 1 for failure. One time I got a 255. I
don't know what that was.
> 

> In Perl, the exit status of a command that is executed with the qx//
> operator or the system() operator is placed in $?, too.  You can check
> it.  Read the system section of the perlfunc manual page to find out
> how to interpret it.

I've read it, but I'll read it again.'
>


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

Date: Tue, 20 Mar 2001 09:04:39 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <996a8c$89h@netnews.hinet.net>

"Gwyn Judd" wrote
> A solution that works seems to be to replace your 'my $f' with 'undef $f'.

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.
 ...
(Why line 4? Even if I remark out the local *F inside the loop)

When I came to the lines, push - local - reopen, I encountered the same
problem with the same reason.  It seemed to me, this is not doable at all...

Is it possible to use bare word file handle here?

Thank you very much.

John Lin






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

Date: Tue, 20 Mar 2001 03:19:12 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <slrn9bdj1f.6hn.tjla@thislove.dyndns.org>

I was shocked! How could John Lin <johnlin@chttl.com.tw>
say such a terrible thing:
>"Gwyn Judd" wrote
>> A solution that works seems to be to replace your 'my $f' with 'undef $f'.

I'm not sure that is possible. Anyway bare-word filehandles are icky if
you can use lexical filehandles (not that I do, but that is another
matter :) )

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Bigamy is having one spouse too many. Monogamy is the same.


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

Date: Tue, 20 Mar 2001 02:19:49 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: use Net::SMTP
Message-Id: <slrn9bdfi5.dni.garry@zfw.zvolve.net>

On Mon, 19 Mar 2001 01:56:26 -0500, jtjohnston
<jtjohnston@courrier.usherb.ca> wrote:

> I'm in over my head. I'm just looking for a simple way with Perl to send
> email from a <form>. use Net::SMTP has been a bust so far. Any suggestions
> for perl on a windows box?

You have an example that will work from the command line.  Just run it
and look at the log like I did.  Don't go to the Web server until
you've debugged it.  

-- 
Garry Williams


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

Date: Tue, 20 Mar 2001 06:57:07 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: use Net::SMTP
Message-Id: <7bDt6.826$Vl6.394199@typhoon1.ba-dsg.net>

Graeme Miller <graeme.m@which.net> wrote:   
>>     $smtp->to('$email');
>
> doesn't look right. I think you meant to use double quotes so that $email
> would interpolate.
 
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.

>    $smtp->datasend("From: $from\n");
>    $smtp->datasend("To: $to\n");

Now here you do need them, because they're no longer part of the envelope   
but part of the message itself.

miguel


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

Date: Tue, 20 Mar 2001 09:18:10 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <996b1o$9o4@netnews.hinet.net>

"Abigail" wrote,
> Abigail
> --
> my $qr = /^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
>    $qr =~ s/$qr//g;
> print $qr, "\n";

Dear,

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.

John Lin





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

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 531
**************************************


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