[23612] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5819 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 17 21:05:44 2003

Date: Mon, 17 Nov 2003 18:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 17 Nov 2003     Volume: 10 Number: 5819

Today's topics:
    Re: arrange form data in same order as on form <noreply@gunnar.cc>
    Re: bit sequence match (Jay Tilton)
    Re: Calling a different shell than the inherited one <usenet@morrow.me.uk>
        counting in long variable in perl <nospam@invalid.com>
    Re: counting in long variable in perl (Tad McClellan)
    Re: Creating UNICODE filenames with PERL 5.8 <abigail@abigail.nl>
    Re: Creating UNICODE filenames with PERL 5.8 <usenet@morrow.me.uk>
    Re: extract block of text <usenet@morrow.me.uk>
    Re: extract block of text <tore@aursand.no>
        Is there a quick way.... <bigus_34@yahoo.co.uk>
    Re: Is there a quick way.... <trammell+usenet@hypersloth.invalid>
    Re: Is there a quick way.... (Tad McClellan)
    Re: Learn Regex or Perl Frist? <ict@eh.org>
        MIME::Lite - HTML Message and pdf Attaching at the same <provicon@earthlink.net>
    Re: MIME::Lite Test with MSN Dial Up SMTP (David Efflandt)
    Re: PERL array of arrays <invalid@invalid.com.invalid>
    Re: PERL array of arrays (Tad McClellan)
    Re: PERL array of arrays (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 18 Nov 2003 02:42:02 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: arrange form data in same order as on form
Message-Id: <bpbtkb$1mk590$1@ID-184292.news.uni-berlin.de>

Alan J. Flavell wrote:
> Gunnar Hjalmarsson wrote:
>> If I didn't make some stupid mistake, the comparison shows that
>> the compilation+execution time for parsing a simple query string
>> with 4 name/value pairs is about 30 times longer when you use
>> CGI.pm compared to my code. CGI.pm needs about 0.2 seconds!
> 
> And how long does a typical do-nothing browser HTTP transaction and
> CGI invocation need in comparison?

<snip>

> the need is to review the overall process, including server
> invocation from the client and the subsequent CGI process creation,
> which I'm afraid your benchmarks don't do.

What the need is depends on what you are actually trying to measure.
The conclusion I make out from my benchmark is that the *absolute*
time it takes to parse a query string is significant if you use
CGI.pm, while it's negligible if you use my code. Whether the factor
is 20, 30 or 50 is something I pay little regard to since, as you
point out, I did not measure the whole process.

My program supports a certain kind of web application, and is
typically used on web sites that are hosted on shared servers.
Sometimes it's used in a way that results in thousands of calls per day.

Now, if you have a busy web site on a shared hosting account, there is
always a limit where the hosting provider says: "This is too much, our
other cusomers are affected adversely." That's why I'm anxious to
watch the server load, and to me, 0.2 seconds appears to be
significant if there are thousands of daily calls.

mod_perl is of course suitable in order to further reduce the server
load. It's just that it's very unusual that mod_perl is availabe on
shared web hosting accounts. Of course, you can always say that the
program should have been written in PHP instead. However, that's not
the case.

> In fact with some rough benchmarking of the overall process (using 
> LWP::Simple to run the tests against a local webserver), it seemed
> to me as if our (otherwise lightly-loaded) server could run about
> 14 invocations per second of wallclock with your economy-model
> script, compared with some 7 per second with CGI.pm, so - a factor
> of around 2 (wallclock) overall, compared with your measurement of
> 30 (cpu) for some portion of the process.  On Windows, I even got a
> factor approaching 3 between them for the overall process.  (Server
> in both cases was a version of Apache 1.3.*, on linux and on
> Win2000 respectively).
> 
> While I must admit the factor is somewhat larger than I had
> expected, this does rather put your measurement of a factor of 30
> into a rather more realistic context, I feel.

As regard "realistic", see above.

It surprises me that your server would allow 7 invocations per second
with CGI.pm when you run the whole process, while I found that it
would allow 5 times when only the Perl part is taken into account.
Maybe the server you used is significantly faster. Btw, are you sure
that you captured the compilation time?

Anyway, this is interesting additional info. Thanks, Alan! I suppose
it indicates that, provided that the factor is 2, I would double the
server load by starting to use CGI.pm. The difference appears to be
significant also when you look at it from this angle.

These benchmarks demonstrate that the design of CGI.pm is surprisingly
'expensive'.

> I will concede that any rule can have exceptions.  What I usually
> say about CGI.pm is that those who have genuinely got the expertise
> to *not* use CGI.pm will know why they are doing that, and will
> need no advice from me.  On the other hand anyone who's in a 
> position to seek advice is going to get my best advice (and you
> know what that's going to be, in the overwhelming proportion of
> cases).
> 
> I'm clearly aware that CGI.pm is in no way magical - the code
> doesn't do anything that one couldn't just as well code for
> oneself.  And the author admits that it's grown too big, and might
> benefit from being modularised.  I've found the odd bug in it
> myself on occasion.  So this is not the uncritical adulation that
> some trolls accuse us of. Nevertheless, it's overall the best thing
> available for doing CGI in Perl, because the author is actively
> working on it and is actively adapting it to the changing
> situation, to encapsulate the gathered knowledge of browser bugs,
> workarounds etc.
> 
> A proportion of extra CPU cycles isn't usually too high a price to
> pay for that.  And as we've seen - if it _is_ too high a price to
> pay, then the most productive place to make real savings is
> elsewhere.
> 
> Can we call a truce on this, then?

I hear what you say. :)  And it makes much sense.

Let me try to summarize my view on it out from a different angle:

Good advice is a good thing, and using Perl modules is a convenient
way to reuse code. Personally I use several modules, but when I'm able
to do something with just a couple of lines of Perl code, I sometimes
do so instead of loading hundreds of lines of code by using a module.
I don't feel that I risk getting bashed for doing so, and nobody
demands that I *prove* that my choices are right.

That is, there is one exception: The 'sacred cow' CGI.pm. Even if you
say that "the code doesn't do anything that one couldn't just as well
code for oneself" and "it's grown too big", your reasoning above
presupposes that you are able to explicitly justify your decision if
you choose to not use CGI.pm for parsing CGI data. That makes little
sense to me. The presumption that people don't know what they are
doing if they don't use CGI.pm is patronizing.

If the explanation is the security implications with CGI, I'd like to
see the focus moved to the desirable that you

- *learn* about the implied risks with CGI scripts,

- don't use code copied from random sources if you don't understand
how it works,

- carefully consider the risks with your own applications, and
validate the data accordingly, and

- enable taint mode.

I feel that these things, which I take for granted that we can agree
upon, tend to be forgotten in the 'campaign' for using CGI.pm.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Mon, 17 Nov 2003 23:07:38 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: bit sequence match
Message-Id: <3fb9545b.6993046@news.erols.com>

Edo <edady2002@yahoo.com> wrote:

: my @k1 = sort {$a <=> $b} keys %h1;
: my @k2 = sort {$a <=> $b} keys %h2;
: 
: my $look_for = pack('(B2)*' => @h1{ @k1 });
: my $look_in  = pack('(B2)*' => @h2{ @k2 });

Why did you change 'B6' to 'B2' ?
I thought the values in %h1 and %h2 contain six 0/1 characters, not two.

: #why can't we replace the above 2 lines with
: my $lookfor = join "", @h1{ @k1 };
: my $lookin = join "", @h2{ @k2 };
: #don't these do the same thing?

Not even close.  Do the values look at all similar when you print them?

: my @results;
: while( $lookin =~ /(?=\Q$lookfor\E)/g ) {
:       push @results,
:       {
: 	map { $_ => $h2{$_} }
: 	@k2[ $-[0] .. $-[0]+@k1-1 ]
:           };
: }
: 
: and could you place explain
: 	map { $_ => $h2{$_} }
: 	@k2[ $-[0] .. $-[0]+@k1-1 ]

Not this time.  This time we do it differently.

You give me your best explanation of the code, then, if the explanation
is mistaken, I will tell you what the mistakes are.

Some clues:
  The map function is explained in perlfunc.
  Array slicing is explained in perldata.
  @k1 is an array in scalar context.  That's also in perldata.
  $-[0] is explained in perlvar.
  The '..' range operator is explained in perlop.



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

Date: Mon, 17 Nov 2003 16:13:03 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Calling a different shell than the inherited one
Message-Id: <bpas2f$hpi$1@wisteria.csv.warwick.ac.uk>


dn_perl@hotmail.com (dn_perl@hotmail.com) wrote:
> I often use C-shell for reasons beyond my control.
> 
> I want to call 'sqlplus' from within a perl script while
> using c-shell. But I want the sqlplus to run in k-shell
> or bash-shell. How can I do this? This is just an academic doubt.
> 
> If I use :
> system("sqlplus username/password << EOH");
> sqlplus statement one
> sqlplus statement two
> EOH

This Won't Work. See perlopentut for what you actually want to do.

> ... then won't the sqlplus run within the inherited C shell?
> Or is there no such thing as the called sqlplus (or any other 
> called command) running within some shell?

If Perl calls the shell (it will only if the command contains shell
metacharacters) then it always calls /bin/sh.

Ben

-- 
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else *  ben@morrow.me.uk


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

Date: Mon, 17 Nov 2003 18:17:34 -0600
From: Wayne Fulton <nospam@invalid.com>
Subject: counting in long variable in perl
Message-Id: <stCdnREM9vK8-CSiRVn-tA@august.net>


A cgi counter (code that I copied from somewhere) was reseting to zero 
frequently.  My guess is that it was when it got to 65535, overflowing 
16 bits (I am not entirely sure of that, but it seems logical).

Code was:

sub incrementCount {
  $counterFile = "filenamehere.txt";
  if (-e $counterFile) {
    open(COUNT,"$counterFile") || die("Can't open $counterFile: $!\n");
  }
  $total = <COUNT>;
  chop $total;
  close(COUNT);
  $total++;
  open(COUNT,">$counterFile") || die "$0: can\'t open $counterFile: 
$!\n";
  print COUNT "$total\n";    
  close(COUNT); 
}

Since perl variables are not typed, I reasoned that it was the final 
print doing the 16 bit reset.    I changed it to

printf (COUNT "%lu\n", $total);

and seemingly have corrected the problem - it counts past 65535 now.

Questions:  

Why was it resetting in the first place?   I know mostly C, but I 
thought perl sensed what variable type was necessary?   Why was it 
truncated as short?  I assume this must be a print default, but I am 
unalbe to find reference to this in the Programming Perl 2nd book.

Probably a seek 0 would be more efficient than two opens/closes, but is 
this %lu format as good as any way of fixing the "short" problem?  

Comments appreciated.  Thanks.



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

Date: Mon, 17 Nov 2003 18:34:57 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: counting in long variable in perl
Message-Id: <slrnbriq9h.dt0.tadmc@magna.augustmail.com>

Wayne Fulton <nospam@invalid.com> wrote:
> 
> A cgi counter (code that I copied from somewhere) was reseting to zero 
> frequently.  


That can happen in a multitasking environment when you
don't implement file locking, and the crufty code you snarfed
doesn't do file locking.

It was clearly written by an amateur. Be careful with it...


> My guess is that it was when it got to 65535, overflowing 
> 16 bits (I am not entirely sure of that, but it seems logical).


I doubt that that is it.

Numbers are double precision floating point internal to perl,
they can go waaaaay beyond 65536.


>   if (-e $counterFile) {
>     open(COUNT,"$counterFile") || die("Can't open $counterFile: $!\n");


There is a race there.

(and I don't see what the point of the -e file test is either.)


>   chop $total;


Looks like the code is 8 years old or so.

In contemporary Perl that is done with:

   chomp $total;


>   close(COUNT);
>   open(COUNT,">$counterFile") || die "$0: can\'t open $counterFile: 
> $!\n";


There is yet another race.


> Why was it resetting in the first place?   


Because of a race, most likely.


> Probably a seek 0 would be more efficient than two opens/closes,


It isn't a question of efficiency.

It is a question of what can work and what cannot work.

The code you posted cannot work (in a multitasking environment).


> Comments appreciated.  Thanks.


Throw that code where it belongs (in the trash) and rewrite it
to use file locking.


   perldoc -q "\block"

       How can I lock a file?

       Why can't I just open(FH, ">file.lock")?

       I still don't get locking.  I just want to incre­
       ment the number in the file.  How can I do this?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 17 Nov 2003 23:16:24 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Creating UNICODE filenames with PERL 5.8
Message-Id: <slrnbrilm8.6vj.abigail@alexandra.abigail.nl>

Allan Yates (allan@yates.ca) wrote on MMMDCCXXX September MCMXCIII in
<URL:news:d6f51524.0311170636.2f956afa@posting.google.com>:
\\  I have been having distinct trouble creating file names in PERL
\\  containing UNICODE characters. I am running ActiveState PERL 5.8 on
\\  Windows 2000.

Neither Perl, nor Unicode are acronyms, so they aren't spelled in
all caps. If you do, it's like you are shouting. And that's rude.


Abigail
-- 
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};


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

Date: Mon, 17 Nov 2003 16:47:14 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Creating UNICODE filenames with PERL 5.8
Message-Id: <bpau2i$j31$1@wisteria.csv.warwick.ac.uk>

allan@yates.ca (Allan Yates) wrote:
> I have been having distinct trouble creating file names in PERL

Perl or perl, not PERL.

> containing UNICODE

I'm not so sure about UNICODE...

> For a simple test, I picked a UNICODE character that could be
> displayed by Windows Explorer. I can select the character(U+0636) from
> 'charmap' and cut/paste into a filename on Windows Explorer and the
> character displays the same as it does in 'charmap'. This proves that
> I have the font available.
> 
> When I attempt to create the same filename with PERL, I end up with a
> filename two characters long: ض

OK, your problem here is that Win2k is being stupid about Unicode: any
sensible OS that understood UTF8 would be fine :). My guess would be
that Windows stores filenames in utf16 with a BOM, and if it doesn't
find a BOM it assumes ASCII/'Windows ANSI'... so try this:

use Encode;

>   $name = chr(0x0636);

$name = encode "utf16", $name;

>   if (!open(FILE,">uni_names/$name")) {
>      print STDERR "Could not open ($!): $name\n";
>   }
> 
>   close (FILE);

If that works, then we could really do with an addition to the 'open'
pragma to do it for you: use open NAMES => "utf16";... hmmm.

If it fails, delete your file in uni_names and create one by
copy/pasting that character out of charmap. Then run

#!/usr/bin/perl

use warnings;
use bytes;

opendir my $U, "uni_names";
my @n = readdir $U;
$, = $\ = "\n";
print map { "$_: " . join ' ', map { ord } split // } @n;

__END__

and tell me what it says.

Ben

-- 
And if you wanna make sense / Whatcha looking at me for?          (Fiona Apple)
                            * ben@morrow.me.uk *


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

Date: Mon, 17 Nov 2003 16:51:28 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: extract block of text
Message-Id: <bpauag$j31$2@wisteria.csv.warwick.ac.uk>


s99999999s2003@yahoo.com (mike) wrote:
> i have some data contained in a file like this:
> 
<snip>
> /* ----------------- Heading2 ----------------- */
> 
> line: Heading2	type: c
> command: echo "hi" 
> owner: me@company.com
> machine: server
> 
> 
> /* ----------------- Heading3 ----------------- */
<snip>

> how can i extract the data from "Heading2" to "Heading3"
[without the blank lines]

<untested>

perl -ne'next if /^\s*$/; print if m|/* -+ Heading2| .. m|/* -+ Heading3|'

Ben

-- 
It will be seen... that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher arises among them who... convinc[es] them that their
 ...institutions are not based on... morality. [Samuel Butler] ben@morrow.me.uk


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

Date: Tue, 18 Nov 2003 02:45:40 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: extract block of text
Message-Id: <pan.2003.11.17.21.26.57.639834@aursand.no>

On Mon, 17 Nov 2003 11:08:10 -0800, Sara wrote:
>> while ($line=<filein>) {
>> [...]

> Bleech- if you're looping through this data line by line you might as
> well use Basic or Fortran..

There are times when it's a wise thing to loop through data.


-- 
Tore Aursand <tore@aursand.no>


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

Date: Mon, 17 Nov 2003 23:43:21 -0000
From: "Bigus" <bigus_34@yahoo.co.uk>
Subject: Is there a quick way....
Message-Id: <w2dub.1903$4Y6.317@newsfep4-winn.server.ntli.net>

 .. you know when you have a HTML form with a load of fields on it where the
user enters various details. The user doesn't fill in a mandatory field or
enters something in an incorrect format, so you want to return the form to
them as they filled it out but with a suitable message telling them where
they went wrong?

Is there a quick way to do that? At the moment I have a HTML template with
subsitution codes in the value parts of each form element, and to feed it
back to the user I perform a load of s///; regexps to re-populate the
fields.. is there a module that does thi automatically?

Thanks
Bigus




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

Date: Tue, 18 Nov 2003 00:01:39 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: Is there a quick way....
Message-Id: <slrnbriob3.e11.trammell+usenet@hypersloth.el-swifto.com.invalid>

On Mon, 17 Nov 2003 23:43:21 -0000, Bigus <bigus_34@yahoo.co.uk> wrote:
> . you know when you have a HTML form with a load of fields on it where the
> user enters various details. The user doesn't fill in a mandatory field or
> enters something in an incorrect format, so you want to return the form to
> them as they filled it out but with a suitable message telling them where
> they went wrong?
> 
> Is there a quick way to do that? At the moment I have a HTML template with
> subsitution codes in the value parts of each form element, and to feed it
> back to the user I perform a load of s///; regexps to re-populate the
> fields.. is there a module that does thi automatically?
> 

HTML::FillInForm



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

Date: Mon, 17 Nov 2003 18:21:28 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is there a quick way....
Message-Id: <slrnbripg8.drg.tadmc@magna.augustmail.com>

Bigus <bigus_34@yahoo.co.uk> wrote:

> Subject: Is there a quick way....


Please put the subject of your article in the Subject of your article.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 18 Nov 2003 11:20:47 +1000
From: Iain Truskett <ict@eh.org>
Subject: Re: Learn Regex or Perl Frist?
Message-Id: <slrnbripd6.7bn.ict@dellah.org>

* Don Kim <nihilistcoder@yahoo.com>:
>  "James Willmore" <jwillmore@remove.adelphia.net> wrote in message
>  news:20031116135434.0db71dcf.jwillmore@remove.adelphia.net...

[...]
> > Being an owner of the book mentioned I can say this -
> > unless you're going to be doing what the author has done
> > with regular expressions, save your money.  If you
> > *must* have a book, get the pocket book by the same
> > title ($12(?) versus $30(?) for the full book).

> Actually, I already purchased the book, but I got it used
> for $12 so it was worth it.  I hear you though, I'm sick
> of buying books only to find it wasn't useful to me. :-(

http://iain.truskett.id.au/MiniOwlBook for my view on the
pocket reference.

As you have "Mastering Regular Expressions" (there are 2
editions and I'm not sure which you have, but for beginners
both are good) you have one of the best introductions to
regex around. If you can follow the book, you'll not only
know regex, you'll _understand_ regex and how they work and
why they give the results they do. Which is far better than
just knowing the syntax.

If you're going to learn Perl, it's good to learn regex as
well. Most tutorials cover them fairly early on.

If you're going to learn regex, you may as well learn Perl
as it's a great language to use to play with regex, and has
one of the best implementations.


cheers,
-- 
Iain.


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

Date: Mon, 17 Nov 2003 23:43:46 GMT
From: "John B. Kim" <provicon@earthlink.net>
Subject: MIME::Lite - HTML Message and pdf Attaching at the same time
Message-Id: <S2dub.4061$sb4.1770@newsread2.news.pas.earthlink.net>

I run the code below, and it works perfectly fine:
==================================================
use strict;
use MIME::Lite;
use Net::SMTP;
my $from = 'askjinu@yahoo.com';
my @addweek1 = qw(askjinu@yahoo.com provicon@earthlink.net
                                   askjinu@yahoo.com askjinu@yahoo.com);
my $Fnameweek1 = 'issue1.pdf';
my $subject='Study Guide from JinuAcademy';

for my $address (@addweek1) {
my $msg = MIME::Lite->new (
               From     => $from,
               To       => $address,
               Subject  => $subject,
               Data     => "This is a wonderful world. ".
                                "MIME::Lite is working out fine.".
                                "with pdf attachment" );
$msg->attach (
               Type     => 'x-pdf',
               Path     => "c:\\guide\\$Fnameweek1",
               ReadNow  => 1,
               Filename => $Fnameweek1);
MIME::Lite->send('smtp', 'smtp.earthlink.net');
$msg->send();
}
=======================================================
Now I want to send HTML message, and changed the code above as below:
=======================================================
use strict;
use MIME::Lite;
use Net::SMTP;
my $from = 'askjinu@yahoo.com';
my @addweek1 = qw(askjinu@yahoo.com
                                    askjinu@yahoo.com);
my $Fnameweek1 = 'issue1.pdf';
my $subject='Study Guide from JinuAcademy';

for my $address (@addweek1) {

my $msg = MIME::Lite->new (
               From     => $from,
               To       => $address,
               Subject  => $subject,
               Type     =>'multipart/related');
$msg->attach (
               Type => 'text/html',
               Data => qq{<body>Here's my message.</body>});
$msg->attach (
               Type     => 'x-pdf',
               Path     => "c:\\guide\\$Fnameweek1",
               ReadNow  => 1,
               Filename => $Fnameweek1);
MIME::Lite->send('smtp', 'smtp.earthlink.net');
$msg->send();
}
=================================================
The problem with above code is that the message comes as HTML, but pdf file
attachment does not go through.  It simply does not carry out the file
attachment.

Can anybody tell me how I should change above code so that the message is in
HTML and the pdf attachment goes through?

Any help will be deeply appreciated.

Thanks.

John




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

Date: Tue, 18 Nov 2003 00:20:41 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: MIME::Lite Test with MSN Dial Up SMTP
Message-Id: <slrnbripeo.25o.efflandt@typhoon.xnet.com>

On Mon, 17 Nov 2003 04:06:37 GMT, John B. Kim <provicon@earthlink.net> wrote:
> I am having trouble with the code below:
>=================================================
> use MIME::Lite;
> use Net::SMTP;
> 
> $msg = MIME::Lite->new(
>                   From     =>'jbyungro@msn.com',
>                   To       =>'jbyungro@msn.com',
>                   Subject  =>'Helloooooo, nurse!',
>                   auth     =>"john@msn.com, 00777777",
>                   Data     =>"How's it goin', eh?"
>                        );
> 
> MIME::Lite->send('smtp', 'smtp.email.msn.com');
> 
> $msg->send();
>=====================================================
> However, when I run the code below, I get the following error message:
> ----------------------------------------------------------------------------
> -------------------------------
> .. SMTP MAIL command failed:
> ..5.7.3 Requested action aborted; mailbox unavailable
> ----------------------------------------------------------------------------
> -------------------------------
> Above code works perfectly fine in my office with earthlink DSL.  And when I
> run the code above with my MSN dial connection at home, I am not getting it
> through.
> 
> One difference with earthlink and MSN is that with MSN, I have to 'Log On
> using Secure Password Authentication (SPA)' while earthlink DSL does not
> require that.

On Earthlink are you using the same smtp.email.msn.com, or Earthlink's 
smtp?

SPA is proprietary Microsoft auth required to send mail from MSN Dialup.  
I think only Outlook variations and Agent mail clients can do that (might
be others).

MSN dialup blocks port 25 other than to their outgoing smtp.  But you can 
only use SMTP if you have an MSN POP3 account, which you cannot do if you 
use MSN Explorer (except maybe if it is an earlier version than 6?).

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


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

Date: Tue, 18 Nov 2003 09:27:54 +1000
From: Schlick <invalid@invalid.com.invalid>
Subject: Re: PERL array of arrays
Message-Id: <bpblhq$imk$1@bunyip.cc.uq.edu.au>

Tad McClellan wrote:

> BKennedy <b_t_k@hotmail.com> wrote:
> 
> 
>>I've done some reading 
> 
> 
> 
> Did it include:
> 
>    perldoc perllol
> 
> ??

Perl Laughs Out Loud? Perl Lots of Love?

Oh, right - Perl Lists of Lists.

How could someone who didn't know exactly where to look possibly 
overlook _that_?

Now for some actual help for the original poster...

# Sub for making list 'A'
sub make_random_list {
	# Push random numbers onto an array reference
	my $ret = [];
	# I hate $_ - I don't use $i, but there
	# are no possible side-effects
	for my $i (0..9) {
		push @$ret, int(rand(101));
	}
	return $ret;
}

# Sub for making list 'B' - list of lists
sub make_random_lol {
	my $ret = [];
	# Use make_random_list to make an array ref
	# and then push that ref onto another array
	# (also accessed by a reference)
	for my $i (0..9) {
		push @$ret, make_random_list();
	}
	return $ret;
}

# Sub for printing list 'B'
sub print_random_lol {
	my $lol = make_random_lol();
	my $i = 0;
	# Loop through the 'outer' list
	for my $l (@$lol) {
		# $l is a list - pretty print it
		# using join
		print "List $i: [", join(", ", @$l), "]\n";
		++$i;
	}
}

Tad is right though - the perldocs contain a wealth of information. The 
problem is that the 'index' is absolutely woeful. You either need to 
know the name of the function you want to use, an exact question or word 
from a question (but don't use "email" - it won't work unless you use 
the faq term "mail") or the summary name that has been given to a 
certain section, eg 'perllol', 'perldsc', 'perltooc' etc.

BTW - guess what 'perlbot' describes. Hint: it has nothing to do with 
Bots or the bottom of anything.

The very first thing you should do is:

	perldoc perl

This gives you the 'index', but also a description of what's in each of 
the docs. The description is far and away the most useful part of 
perldoc's 'index'.

Quoting "You obviously didn't read manual 4a chapter 6 section 12 
subsection 2 paragraph 3 line 1" isn't all that handy.



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

Date: Mon, 17 Nov 2003 18:14:41 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: PERL array of arrays
Message-Id: <slrnbrip3h.drg.tadmc@magna.augustmail.com>

Schlick <invalid@invalid.com.invalid> wrote:
> Tad McClellan wrote:
>> BKennedy <b_t_k@hotmail.com> wrote:
>> 
>> 
>>>I've done some reading 
>> 
>> 
>> Did it include:
>> 
>>    perldoc perllol
>> 
>> ??
> 
> Perl Laughs Out Loud? Perl Lots of Love?
> 
> Oh, right - Perl Lists of Lists.
> 
> How could someone who didn't know exactly where to look possibly 
> overlook _that_?


I did say or imply that he overlooked that.

It looked to me like he did not know about it.

I told him about it.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 17 Nov 2003 18:17:22 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: PERL array of arrays
Message-Id: <slrnbrip8i.drg.tadmc@magna.augustmail.com>

Schlick <invalid@invalid.com.invalid> wrote:


> the perldocs contain a wealth of information. The 
> problem is that the 'index' is absolutely woeful.


Perl is open source.

It is improved by volunteers.

If you see something wrong with Perl, pitch in to help fix it.

(or are you suggesting that "someone else" do the work you want done?)

Let us know when you have the new and improved index ready...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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


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