[31533] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2792 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 27 16:09:30 2010

Date: Wed, 27 Jan 2010 13:09:12 -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           Wed, 27 Jan 2010     Volume: 11 Number: 2792

Today's topics:
    Re: Net::SMTP and SMTP AUTH <anfi@onet.eu>
        Net::SMTP vs MX (hymie!)
    Re: Net::SMTP vs MX <OJZGSRPBZVCX@spammotel.com>
    Re: Net::SMTP vs MX <spamtrap@shermpendley.com>
        permalink to latest devel release of perl? <no.email@please.post>
    Re: print array with separator? <OJZGSRPBZVCX@spammotel.com>
    Re: print array with separator? <derykus@gmail.com>
    Re: print array with separator? <jurgenex@hotmail.com>
    Re: print array with separator? <rvtol+usenet@xs4all.nl>
    Re: print array with separator? <OJZGSRPBZVCX@spammotel.com>
    Re: strip all but second second line from bottom and th <someone@example.com>
    Re: When to use "use strict;"? <bugbear@trim_papermule.co.uk_trim>
    Re: When to use "use strict;"? <usenet05@drabble.me.uk>
    Re: When to use "use strict;"? <OJZGSRPBZVCX@spammotel.com>
    Re: When to use "use strict;"? <tadmc@seesig.invalid>
    Re: When to use "use strict;"? <ben@morrow.me.uk>
    Re: When to use "use strict;"? <tadmc@seesig.invalid>
    Re: When to use "use strict;"? <jl_post@hotmail.com>
    Re: When to use "use strict;"? <OJZGSRPBZVCX@spammotel.com>
    Re: When to use "use strict;"? <jurgenex@hotmail.com>
    Re: When to use "use strict;"? <spamtrap@shermpendley.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 27 Jan 2010 19:42:11 +0100
From: Andrzej Adam Filip <anfi@onet.eu>
Subject: Re: Net::SMTP and SMTP AUTH
Message-Id: <0flzmsv18g-A1R@roger.huge.strangled.net>

hymie@lactose.homelinux.net (hymie!) wrote:
> I'm using Net::SMTP to send e-mail from a CGI script on a hosted web
> page.
>
> Unfortunately, the hosting company does not allow me to use its
> SMTP server for the queueing of outgoing e-mail.  I am required to
> use the recipient's MX host in my Net::SMTP->new() call.
> [...]
> Is there some easier method that I'm missing?

Unless you intend to send big amounts of "mail" it would be safer to
send messages via external email account e.g. gmail.

Net::SMTP does support SMTP AUTH but it does not support STARTTLS.

-- 
[pl>en Andrew] Andrzej Adam Filip : anfi@onet.eu : Andrzej.Filip@gmail.com
Twenty Percent of Zero is Better than Nothing.
  -- Walt Kelly


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

Date: Wed, 27 Jan 2010 17:57:57 GMT
From: hymie@lactose.homelinux.net (hymie!)
Subject: Net::SMTP vs MX
Message-Id: <F8%7n.44517$s%.972@newsfe18.iad>

Greetings, all.

I'm using Net::SMTP to send e-mail from a CGI script on a hosted web
page.

Unfortunately, the hosting company does not allow me to use its
SMTP server for the queueing of outgoing e-mail.  I am required to
use the recipient's MX host in my Net::SMTP->new() call.

This creates a couple of problems.  The easiest one to solve is that
sending e-mail to (say) four people requires four complete runs
through my mail-sending routine.  So I've got this:
  my %MAILTO = (
                'hymie@l.homelinux.net' => 'mx1.mailhop.org',
                'e_b_h@yahoo.com' => 'a.mx.mail.yahoo.com',
                );
  foreach my $addr (sort keys %MAILTO)
  {
    my $smtp = Net::SMTP->new($MAILTO{$addr});
    blah blah blah blah
  }

But that's not the biggest problem.

yahoo.com , for example, has eight different MX hosts, any number of
which may or may not be working at any given time.  If I understand
correctly, I need to pick one of the 8 MX records, hard-code it into
my script; and when it comes time to send e-mail, hope that this
particular MX host is up and running.

So now I'm looking at something along these lines (untested):
  my %MAILTO = (
                'hymie@l.h.net' => [ 'mx1.mailhop.org'] ,
                'e_b_h@yahoo.com' => [
                                        'a.mx.mail.yahoo.com',
                                        'b.mx.mail.yahoo.com',
                                        'c.mx.mail.yahoo.com',
                                        'd.mx.mail.yahoo.com',
                                        'e.mx.mail.yahoo.com',
                                        'f.mx.mail.yahoo.com',
                                        'g.mx.mail.yahoo.com',
                                        'h.mx.mail.yahoo.com'
                                      ] 
                );
  foreach my $addr (sort keys %MAILTO)
  {
    my $sent_here=0;
    foreach my $mx (@{$MAILTO{$addr}})
    {
      $smtp = Net::SMTP->new($mx);
      next unless $smtp;
      blah blah blah blah
      $sent_here=1;
      last;
    }
    if (!$sent_here)
    {
      do something
    }
  }

Is there some easier method that I'm missing?

Thanks.

--hymie!    http://lactose.homelinux.net/~hymie    hymie@lactose.homelinux.net
-------------------------------------------------------------------------------


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

Date: Wed, 27 Jan 2010 19:25:03 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
To: hymie! <hymie@lactose.homelinux.net>
Subject: Re: Net::SMTP vs MX
Message-Id: <op.u67er1zomk9oye@frodo>

On Wed, 27 Jan 2010 18:57:57 +0100, hymie! <hymie@lactose.homelinux.net>  
wrote:

>   my %MAILTO = (
>                 'hymie@l.h.net' => [ 'mx1.mailhop.org'] ,
>                 'e_b_h@yahoo.com' => [
>                                         'a.mx.mail.yahoo.com',

I would at least use something from  
http://search.cpan.org/search?query=mx&mode=all to query the MX records  
dynamically.

> Is there some easier method that I'm missing?

http://search.cpan.org/~sriopen/Sendmail-0.1/lib/Net/DNS/Sendmail.pm seems  
to be exactly what you need.


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

Date: Wed, 27 Jan 2010 15:14:11 -0500
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: Net::SMTP vs MX
Message-Id: <m27hr39ugc.fsf@shermpendley.com>

hymie@lactose.homelinux.net (hymie!) writes:

> Unfortunately, the hosting company does not allow me to use its
> SMTP server for the queueing of outgoing e-mail.

Ouch. Honestly, I'd find a better hosting company - you really should
not have to jump through these kinds of hoops to do something as
simple as sending an email.

sherm--


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

Date: Wed, 27 Jan 2010 19:21:13 +0000 (UTC)
From: kj <no.email@please.post>
Subject: permalink to latest devel release of perl?
Message-Id: <hjq3n9$lsn$1@reader1.panix.com>




Is there some fixed URL that always points to the latest devel
release of perl?

Also, is there some *fixed* string (i.e. invariant irrespective of
the number of the latest perl version) that one could use as the
argument of the get/make/test/install cpan shell commands, and that
would download/build/test/install the latest devel release of perl?

TIA!

~K


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

Date: Wed, 27 Jan 2010 09:40:46 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
Subject: Re: print array with separator?
Message-Id: <op.u66np8hvmk9oye@frodo>

On Wed, 27 Jan 2010 02:42:47 +0100, Ben Morrow <ben@morrow.me.uk> wrote:

> $_ ought to be an alias to a constant.

 From "perldoc map":

"Note that $_ is an alias to the list value, so it can be used to modify  
the elements of the LIST. While this is useful and supported, it can cause  
bizarre results if the elements of LIST are not variables. Using a regular  
foreach loop for this purpose would be clearer in most cases."

 From "perldoc grep":

"Note that $_ is an alias to the list value, so it can be used to modify  
the elements of the LIST. While this is useful and supported, it can cause  
bizarre results if the elements of LIST are not variables. Similarly, grep  
returns aliases into the original list, much as a for loop's index  
variable aliases the list elements. That is, modifying an element of a  
list returned by grep (for example, in a foreach , map or another grep)  
actually modifies the element in the original list. This is usually  
something to be avoided when writing clear code."


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

Date: Wed, 27 Jan 2010 11:39:38 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: print array with separator?
Message-Id: <4e10fcc7-785e-4d18-931d-99575f7d552b@l30g2000yqb.googlegroups.com>

On Jan 25, 8:23=A0pm, "Uri Guttman" <u...@StemSystems.com> wrote:
> >>>>> "JB" =3D=3D John Bokma <j...@castleamber.com> writes:
>
> =A0 JB> I wouldn't use it though, but like Abigail, IIRC, once wrote, the=
re is
> =A0 JB> no reason to have a problem with map in void context because we u=
se
> =A0 JB> other functions in void context without problems (like print).
>
> the point with map in void context is not efficiency but in conveying
> meaning to the reader. map is intended to generate a list, not execute
> side effects. for modifier does the same thing and is meant for side
> effects as it doesn't generate a list. perl has many related things like
> this and you should choose the one with better semantics for your
> intentions. map generates lists so use it that way. for modifier doesn't
> generate lists so use it for side effects.
>

However 'perldoc -q void'  has an addendum about map being context
aware since 5.8.1.  And there's no  "ahem, but map is intended to
generate a list" to disparage its use in void content.

I prefer the for modifier but wish 'void' was a keyword for side-
effects only map use. Then I suppose there'd be crazies who'd use
void with print or delete too :).


--
Charles DeRykus


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

Date: Wed, 27 Jan 2010 11:50:40 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: print array with separator?
Message-Id: <j661m5hukfpgcd5dbibd9ugoqutnh9gb2t@4ax.com>

"C.DeRykus" <derykus@gmail.com> wrote:
>I prefer the for modifier but wish 'void' was a keyword for side-
>effects only map use. 

Doesn't 
	undef = map .....
work (I didn't try it)?

jue


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

Date: Wed, 27 Jan 2010 20:51:07 +0100
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: print array with separator?
Message-Id: <4b60992c$0$22941$e4fe514c@news.xs4all.nl>

Jochen Lehmeier wrote:

>  From "perldoc grep":
> 
> "Note that $_ is an alias to the list value, so it can be used to modify 
> the elements of the LIST. While this is useful and supported, it can 
> cause bizarre results if the elements of LIST are not variables. 
> Similarly, grep returns aliases into the original list, much as a for 
> loop's index variable aliases the list elements. That is, modifying an 
> element of a list returned by grep (for example, in a foreach , map or 
> another grep) actually modifies the element in the original list. This 
> is usually something to be avoided when writing clear code."

Yeah, though I'd rather see an error if an immutable is violated.


But wait, it does:

perl -e'grep ++$_, -2..2'

perl -e'grep ++$_, -2,-1,0,1,2'
Modification of a read-only value attempted at -e line 1.

perl -e'grep ++$_, @{[ -2,-1,0,1,2 ]}'

So -2..2 just iterates mutables.

-- 
Ruud


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

Date: Wed, 27 Jan 2010 21:03:10 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
Subject: Re: print array with separator?
Message-Id: <op.u67jbk0smk9oye@frodo>

On Wed, 27 Jan 2010 20:51:07 +0100, Dr.Ruud <rvtol+usenet@xs4all.nl> wrote:

> perl -e'grep ++$_, -2..2'
>
> perl -e'grep ++$_, -2,-1,0,1,2'
> Modification of a read-only value attempted at -e line 1.
>
> perl -e'grep ++$_, @{[ -2,-1,0,1,2 ]}'
>
> So -2..2 just iterates mutables.

Aye.

perl -e 'for (0,0) { print ++$_ for (1..2) }'
2323

So, the expression "1..2" is evaluated to an array at runtime, not compile  
time (if it were evaluated at compile time, the result would be "2334"  
instead of "2323"). No read-only values involved. Same goes for @{[...]}.  
I guess perl could optimize both constructs at compile time, but obviously  
doesn't, so it does not need to throw an error about read-only values.


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

Date: Wed, 27 Jan 2010 00:14:44 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: strip all but second second line from bottom and then strip that!!!!
Message-Id: <VBS7n.336$uH1.162@newsfe25.iad>

yelipolok<kjl@aol.com> wrote:
> I cannot figure it out, but I know it's very simple for perl.
> 
> Here's the text, below the cut mark.  There's a typical \n at the end
> of each line.
> 
> --
> info depth 9
> info depth 9
> info depth 9 seldepth 30 score cp 31 lowerbound time 59 nodes 80142
> nps 1358000 pv f6f3 e2f3
> info depth 9
> info depth 9 seldepth 30 score cp 17  time 61 nodes 82240 nps 1348000
> pv f6f3 e2f3 c6d4 f3e3
> info depth 10
> info depth 10 seldepth 32 score cp 25 lowerbound time 91 nodes 126058
> nps 1385000 pv f6f3 e2f3
> info depth 10
> info depth 10 seldepth 32 score cp 33 lowerbound time 111 nodes 156296
> nps 1408000 pv f6f3 e2f3
> info depth 10
> info depth 10 seldepth 33 score cp 34  time 144 nodes 205129 nps
> 1424000 pv f6f3 e2f3 c6d4 f3e3
> info depth 10 seldepth 33 score cp 34  time 154 nodes 216834 nps
> 1408000 pv f6f3 e2f3 c6d4 f3e3
> bestmove f6f3 ponder e2f3
> --
> 
> I want to strip it all EXCEPT for the the line second from bottom and
> then just the part from "pv to the end of line"
> 
> Result being:    f6f3 e2f3 c6d4 f3e3

use File::ReadBackwards;

my $bw = File::ReadBackwards->new( 'filename' )
     or die "Cannot read 'filename' $!";

while ( defined( my $line = $bw->readline ) ) {
     if ( $line =~ /\bpv ([\s0-9a-fA-F]+)/ ) {
         print $1;
         last;
         }
     }




John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway


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

Date: Wed, 27 Jan 2010 09:23:15 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: When to use "use strict;"?
Message-Id: <k5SdnSPU282em_3WnZ2dnUVZ8kdi4p2d@brightview.co.uk>

Charlton Wilbur wrote:
>>>>>> "PY" == Peng Yu <pengyu.ut@gmail.com> writes:
> 
>     PY> I was told to always use "use strict;" in another thread in this
>     PY> newsgroup. However, I checked Programming Perl. It seems that
>     PY> "use strict" is not necessary for small program.
> 
> If you need to ask, you aren't experienced enough to know when you don't
> need it.  And if you are experienced enough to know when you don't need
> it, you've also been bitten by stupid bugs often enough to always use it
> anyway.

what he said!

    BugBear


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

Date: Wed, 27 Jan 2010 16:59:30 GMT
From: Graham Drabble <usenet05@drabble.me.uk>
Subject: Re: When to use "use strict;"?
Message-Id: <Xns9D0DACD93AC04grahamdrabblelineone@drabble.me.uk>

On 26 Jan 2010 Charlton Wilbur <cwilbur@chromatico.net> wrote in
news:867hr4al7p.fsf@mithril.chromatico.net: 

>>>>>> "PY" == Peng Yu <pengyu.ut@gmail.com> writes:
> 
>     PY> I was told to always use "use strict;" in another thread
>     in this PY> newsgroup. However, I checked Programming Perl. It
>     seems that PY> "use strict" is not necessary for small
>     program. 
> 
> If you need to ask, you aren't experienced enough to know when you
> don't need it.  And if you are experienced enough to know when you
> don't need it, you've also been bitten by stupid bugs often enough
> to always use it anyway.

I would agree. Does anyone know why so much of the code available from 
perldoc (the FAQ and the module docs) is not written so that it can be 
used under strict?

I've lost count of the number of times I've copied something in from 
the manual, run it and then cursed when strict throws it out.

-- 
Graham Drabble
http://www.drabble.me.uk/


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

Date: Wed, 27 Jan 2010 18:30:01 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
Subject: Re: When to use "use strict;"?
Message-Id: <op.u67b8bu6mk9oye@frodo>

On Wed, 27 Jan 2010 17:59:30 +0100, Graham Drabble  
<usenet05@drabble.me.uk> wrote:

> I've lost count of the number of times I've copied something in from
> the manual, run it and then cursed when strict throws it out.

Do you have examples of what you mean?


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

Date: Wed, 27 Jan 2010 13:02:48 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: When to use "use strict;"?
Message-Id: <slrnhm1387.5bh.tadmc@tadbox.sbcglobal.net>

Jochen Lehmeier <OJZGSRPBZVCX@spammotel.com> wrote:
> On Wed, 27 Jan 2010 17:59:30 +0100, Graham Drabble  
><usenet05@drabble.me.uk> wrote:
>
>> I've lost count of the number of times I've copied something in from
>> the manual, run it and then cursed when strict throws it out.
>
> Do you have examples of what you mean?


    perldoc -q efficiently


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Wed, 27 Jan 2010 18:49:29 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: When to use "use strict;"?
Message-Id: <pee637-spt.ln1@osiris.mauzo.dyndns.org>


Quoth Graham Drabble <usenet05@drabble.me.uk>:
> On 26 Jan 2010 Charlton Wilbur <cwilbur@chromatico.net> wrote in
> news:867hr4al7p.fsf@mithril.chromatico.net: 
> 
> I would agree. Does anyone know why so much of the code available from 
> perldoc (the FAQ and the module docs) is not written so that it can be 
> used under strict?

In general the answer is 'because that documentation either predates
'my' altogether, or predates the universal reccomendation to use
strict'. Patches are always welcome.

Ben



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

Date: Wed, 27 Jan 2010 13:15:39 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: When to use "use strict;"?
Message-Id: <slrnhm140a.5ei.tadmc@tadbox.sbcglobal.net>

Tad McClellan <tadmc@seesig.invalid> wrote:
> Jochen Lehmeier <OJZGSRPBZVCX@spammotel.com> wrote:
>> On Wed, 27 Jan 2010 17:59:30 +0100, Graham Drabble  
>><usenet05@drabble.me.uk> wrote:
>>
>>> I've lost count of the number of times I've copied something in from
>>> the manual, run it and then cursed when strict throws it out.
>>
>> Do you have examples of what you mean?
>
>
>     perldoc -q efficiently


And a one-liner to find even more (though there are lots of false hits):

    perl -ne 'print "$ARGV: $_" if /^\s+[\$@%]\w+/' \
        /usr/lib/perl5/5.10.0/pod/perlfaq[1-9].pod


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Wed, 27 Jan 2010 11:20:29 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: When to use "use strict;"?
Message-Id: <64732ec5-f3a4-4e78-9133-c6d5e4209301@k35g2000yqb.googlegroups.com>

> On Wed, 27 Jan 2010 17:59:30 +0100, Graham Drabble wrote:
> > I've lost count of the number of times I've copied something in from
> > the manual, run it and then cursed when strict throws it out.

On Jan 27, 10:30 am, "Jochen Lehmeier" <OJZGSRPBZ...@spammotel.com>
wrote:
> Do you have examples of what you mean?


   "perldoc Getopt::Long" shows this example:

   use Getopt::Long;
   my $data   = "file.dat";
   my $length = 24;
   my $verbose;
   $result = GetOptions ("length=i" => \$length,    # numeric
                         "file=s"   => \$data,      # string
                         "verbose"  => \$verbose);  # flag

Notice that $data, $length, and $verbose are declared with "my", but
$result is not.  As a result, if you copy-and-paste this code into a
program that has "use strict;" you'll probably see an error that
$result was not declared.

   (Of course, you could argue that $result was declared earlier in
the program, but then you could make that argument for $data, $length,
and $verbose as well.)

   I will usually put the "use strict;" and "use warnings;" lines
right into the SYNOPSIS section of the perldocs I write, if only to
instill a sense of "this module works best with 'strict' and
'warnings'" into users who are too inexperienced to know better.  To
be honest, I'm not sure if that's a good habit or not (including them
in the perldocs, that is), but I figure if it gets a user to start
using 'strict' and 'warnings' (where they otherwise wouldn't), then
the positive of doing that outweighs the negative.

   -- Jean-Luc


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

Date: Wed, 27 Jan 2010 20:46:54 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
Subject: Re: When to use "use strict;"?
Message-Id: <op.u67ikgqpmk9oye@frodo>

On Wed, 27 Jan 2010 20:20:29 +0100, jl_post@hotmail.com  
<jl_post@hotmail.com> wrote:

> Notice that $data, $length, and $verbose are declared with "my", but
> $result is not.

>    (Of course, you could argue that $result was declared earlier in
> the program, but then you could make that argument for $data, $length,
> and $verbose as well.)

I would say that this kind of example is just that - an example. Or a  
specification. It shows how to use the module, but whether some variable  
used in the example has a "my" in front of it does not really matter. You  
would certainly need to edit the code anyway, since your code will MOST  
probably not need a "length", "file", "verbose" parameter. ;-)

>    I will usually put the "use strict;" and "use warnings;" lines
> right into the SYNOPSIS section of the perldocs I write,

I only include the barest necessary code as a "wrapper" around whatever I  
want to show. I assume that the reader of some module documentation knows  
about strict, warnings, my etc. OTOH, I have no public modules, either,  
and know the people who use mine.

My minimum form of POD is usually like this:

=head2 someFunc

    ($xyz,$abc) = MyModule::someFunc($def,$ghi);

Blablabla ...

=cut

This outputs the "signature" of the function prominently at the top, i.e.,  
it tells the user what arguments I expect and what I return (of course, if  
the sub is a difficult one, more examples may be added). But whether or  
not "my" is in there does not really matter at all. The user is free to  
cut&paste that "signature" to avoid some little amount of typing, but he  
will usually already have other variable names in place, so the usefulness  
of "cut&paste-ready" code seems limited, to me.

> be honest, I'm not sure if that's a good habit or not (including them
> in the perldocs, that is), but I figure if it gets a user to start
> using 'strict' and 'warnings' (where they otherwise wouldn't), then
> the positive of doing that outweighs the negative.

Yup, I guess it's philosophical. But I would very seldomly cut&paste some  
code from the documentation with the intent of using it without any  
further editing - it would in 99% of the cases simply not match my needs  
(one notable exception is "perldoc -f localtime" - I frequently cut&paste  
that beautiful line which includes the return values ;-) ).


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

Date: Wed, 27 Jan 2010 11:48:22 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: When to use "use strict;"?
Message-Id: <7l51m5d5a21itj98ebm7ml6e6tils5ch8b@4ax.com>

"jl_post@hotmail.com" <jl_post@hotmail.com> wrote:
[Use of strict() in perldoc/perlfaq]

>[...]To
>be honest, I'm not sure if that's a good habit or not (including them
>in the perldocs, that is), but I figure if it gets a user to start
>using 'strict' and 'warnings' (where they otherwise wouldn't), then
>the positive of doing that outweighs the negative.

I second your doubts. An explanation for how a specific feature works or
the algorithmic idea for how to solve a specific problem is not the
right place to also introduce (or even just re-enforce) a concept that
has nothing to do with that feature or that algorithm.
Those explanations and code samples should be reduced to the bare
minimum necessary for the issue at hand. Otherwise you are creating a
diversion and confusion: why did the author do this, it appears as if it
has nothing to do with my problem? What am I missing? 

jue


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

Date: Wed, 27 Jan 2010 15:11:02 -0500
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: When to use "use strict;"?
Message-Id: <m2bpgf9ull.fsf@shermpendley.com>

Graham Drabble <usenet05@drabble.me.uk> writes:

> I would agree. Does anyone know why so much of the code available from 
> perldoc (the FAQ and the module docs) is not written so that it can be 
> used under strict?
>
> I've lost count of the number of times I've copied something in from 
> the manual, run it and then cursed when strict throws it out.

How many times did you write a strict-compatible example to replace
such code, and send it to p5p? That's how problems get fixed around
here. :-)

sherm--


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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2792
***************************************


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