[29382] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 626 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 6 14:50:14 2007

Date: Fri, 6 Jul 2007 11:50:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Jul 2007     Volume: 11 Number: 626

Today's topics:
    Re: Trying to write a log function <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: Trying to write a log function <shmh@bigpond.net.au>
    Re: Trying to write a log function <shmh@bigpond.net.au>
    Re: Trying to write a log function <ts@dionic.net>
    Re: Trying to write a log function <jurgenex@hotmail.com>
    Re: Trying to write a log function <ts@dionic.net>
    Re: unlurking <bik.mido@tiscalinet.it>
    Re: unlurking <spamtrap@dot-app.org>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <mritty@gmail.com>
    Re: unlurking <tadmc@seesig.invalid>
    Re: unlurking <sbryce@scottbryce.com>
    Re: unlurking <sbryce@scottbryce.com>
    Re: unlurking <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Jul 2007 09:55:19 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Trying to write a log function
Message-Id: <b8Kii.4035$zA4.2815@newsread3.news.pas.earthlink.net>

On 07/03/2007 09:35 PM, Simon wrote:
> Hi guys!
> 
> Hope you can help.
> Im a newbie to this, but have some sample code that Im trying to understand.
> The goal is that I can successfully write a log function that writes 
> messages to a log file.
> Please bare with me as I dont fully understand the below code, which is 
> where I need your gurus expertise.
> Here is the code, which is not working, but Id like to try and find out how 
> i can get it to work to write messages to a log file.
> Any help appreciated.
> Thank you.
> 
> ====================================================================== code
> 
> sub Log {
> 
>    @g = localtime time;
>    open(LOG,">>$LogFile");
>    printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>    printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>    close(LOG);
> 
> }
> 
> sub WaitForInstall() {
> 
>    Log "   Waiting for installation to complete";
>    sleep 10;
>    $finished = 0;
>    while (!$finished) {
>       sleep 5;
>       $finished = 1;  # assume we're finished
>       open(PS,"$PSCMD|");
>       while (<PS>) {
> 
>          if ($_ =~ /$Product Setup/i) {
>             $finished = 0;  # not finished
>          }
>          elsif ($_ =~ /$Product/i) {
>             $finished = 0;  # not finished
>          }
>       }
>       close(PS);
>    }
> 
> }
> 
> 
> $LogFile = "C:\\logs\\$Product.log";
> 
> ====================================================================== code
> 
> So basically, what Im trying to do is, insert a Log function into particular 
> parts of the script, and wherever I insert the Log function, to write that 
> line to Product.log.
> The above is only a snippet.
> Any help will be great.
> I just dont know how to call the Log function, or how to actually write it 
> to be honest.
> The below is my objective.
> 
> 1) Write a log function (subroutine)
> 2) Being able to call that log subroutine anywhere in my script, and log 
> messages from that call to a text file.
> 
> Thanku in advance.
> 
> 
> 

These are the problems I see with your program so far:
$LogFile is defined too late for it to be useful for the Log function. 
The code in Log is too convoluted even though it probably just prints 
the time and some text. Parenthesis are needed with function calls if 
Perl hasn't been made aware ahead of time that the function is a function.

This site can help you learn about Perl:
http://perldoc.perl.org/perl.html

After reading that page, you should read "perlintro."


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

Date: Wed, 04 Jul 2007 10:16:50 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Trying to write a log function
Message-Id: <msKii.3187$4A1.1669@news-server.bigpond.net.au>

Hi Mumia!

Thank you so much for your input and help.
Appreciate your comments.
Thanks again :>)

"Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net> wrote in message 
news:b8Kii.4035$zA4.2815@newsread3.news.pas.earthlink.net...
> On 07/03/2007 09:35 PM, Simon wrote:
>> Hi guys!
>>
>> Hope you can help.
>> Im a newbie to this, but have some sample code that Im trying to 
>> understand.
>> The goal is that I can successfully write a log function that writes 
>> messages to a log file.
>> Please bare with me as I dont fully understand the below code, which is 
>> where I need your gurus expertise.
>> Here is the code, which is not working, but Id like to try and find out 
>> how i can get it to work to write messages to a log file.
>> Any help appreciated.
>> Thank you.
>>
>> ====================================================================== 
>> code
>>
>> sub Log {
>>
>>    @g = localtime time;
>>    open(LOG,">>$LogFile");
>>    printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>>    printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>>    close(LOG);
>>
>> }
>>
>> sub WaitForInstall() {
>>
>>    Log "   Waiting for installation to complete";
>>    sleep 10;
>>    $finished = 0;
>>    while (!$finished) {
>>       sleep 5;
>>       $finished = 1;  # assume we're finished
>>       open(PS,"$PSCMD|");
>>       while (<PS>) {
>>
>>          if ($_ =~ /$Product Setup/i) {
>>             $finished = 0;  # not finished
>>          }
>>          elsif ($_ =~ /$Product/i) {
>>             $finished = 0;  # not finished
>>          }
>>       }
>>       close(PS);
>>    }
>>
>> }
>>
>>
>> $LogFile = "C:\\logs\\$Product.log";
>>
>> ====================================================================== 
>> code
>>
>> So basically, what Im trying to do is, insert a Log function into 
>> particular parts of the script, and wherever I insert the Log function, 
>> to write that line to Product.log.
>> The above is only a snippet.
>> Any help will be great.
>> I just dont know how to call the Log function, or how to actually write 
>> it to be honest.
>> The below is my objective.
>>
>> 1) Write a log function (subroutine)
>> 2) Being able to call that log subroutine anywhere in my script, and log 
>> messages from that call to a text file.
>>
>> Thanku in advance.
>>
>>
>>
>
> These are the problems I see with your program so far:
> $LogFile is defined too late for it to be useful for the Log function. The 
> code in Log is too convoluted even though it probably just prints the time 
> and some text. Parenthesis are needed with function calls if Perl hasn't 
> been made aware ahead of time that the function is a function.
>
> This site can help you learn about Perl:
> http://perldoc.perl.org/perl.html
>
> After reading that page, you should read "perlintro." 




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

Date: Wed, 04 Jul 2007 10:17:21 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Trying to write a log function
Message-Id: <RsKii.3188$4A1.385@news-server.bigpond.net.au>

John!

Youre so kind to have spent some time on this for me.
I really appreciate your comments.
Thansk John.

Simon

"John W. Krahn" <dummy@example.com> wrote in message 
news:i_Fii.26076$xk5.3904@edtnps82...
> Simon wrote:
>>
>> Hope you can help.
>> Im a newbie to this, but have some sample code that Im trying to 
>> understand.
>> The goal is that I can successfully write a log function that writes 
>> messages to a log file.
>> Please bare with me as I dont fully understand the below code, which is 
>> where I need your gurus expertise.
>> Here is the code, which is not working, but Id like to try and find out 
>> how i can get it to work to write messages to a log file.
>> Any help appreciated.
>> Thank you.
>>
>> ====================================================================== 
>> code
>
> You should have these two lines at the beginning of your program and let 
> perl help you find mistakes:
>
> use warnings;
> use strict;
>
>
>> sub Log {
>>
>>    @g = localtime time;
>>    open(LOG,">>$LogFile");
>
> You should *ALWAYS* verify that your file opened correctly:
>
>     open LOG, '>>', $LogFile or die "Cannot open '$LogFile' $!";
>
> This would have caught the error that $LogFile has *no* value here because 
> it is not assigned a value until later in the program.
>
>
>>    printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>
> The correct way to get the year (as described in 'perldoc -f localtime') 
> is to add 1900 to the sixth element of the list returned from localtime so 
> that expression could be more concisely written as:
>
>     printf LOG "%04d/%02d/%02d %02d:%02d:%02d  %s\n", $g[ 5 ] + 1900, 
> $g[ 4 ] + 1, @g[ 3, 2, 1, 0 ], $_[ 0 ];
>
>
>>    printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>
> Same as above.
>
>
>>    close(LOG);
>>
>> }
>>
>> sub WaitForInstall() {
>>
>>    Log "   Waiting for installation to complete";
>>    sleep 10;
>>    $finished = 0;
>>    while (!$finished) {
>>       sleep 5;
>>       $finished = 1;  # assume we're finished
>>       open(PS,"$PSCMD|");
>
> You should *ALWAYS* verify that your file opened correctly:
>
>        open PS, '-|', $PSCMD or die "Cannot open pipe from '$PSCMD' $!";
>
>
>>       while (<PS>) {
>>
>>          if ($_ =~ /$Product Setup/i) {
>>             $finished = 0;  # not finished
>>          }
>>          elsif ($_ =~ /$Product/i) {
>>             $finished = 0;  # not finished
>>          }
>>       }
>>       close(PS);
>
> And with a pipe you should also verify that it closed correctly:
>
> close PS or warn $! ? "Error closing '$PSCMD' pipe: $!"
>                     : "Exit status $? from '$PSCMD'";
>
>
>>    }
>>
>> }
>
>
> John
> -- 
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order.                            -- Larry Wall 




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

Date: Wed, 04 Jul 2007 12:23:26 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Trying to write a log function
Message-Id: <468b832e$0$641$5a6aecb4@news.aaisp.net.uk>

Mumia W. wrote:

> On 07/03/2007 09:35 PM, Simon wrote:
>> Hi guys!
>> 
>> Hope you can help.
>> Im a newbie to this, but have some sample code that Im trying to
>> understand. The goal is that I can successfully write a log function that
>> writes messages to a log file.
>> Please bare with me as I dont fully understand the below code, which is
>> where I need your gurus expertise.
>> Here is the code, which is not working, but Id like to try and find out
>> how i can get it to work to write messages to a log file.
>> Any help appreciated.
>> Thank you.
>> 
>> ======================================================================
>> code
>> 
>> sub Log {
>> 
>>    @g = localtime time;
>>    open(LOG,">>$LogFile");
>>    printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n",
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>>    printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n",
>> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr
>> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
>>    close(LOG);
>> 
>> }
>> 
>> sub WaitForInstall() {
>> 
>>    Log "   Waiting for installation to complete";
>>    sleep 10;
>>    $finished = 0;
>>    while (!$finished) {
>>       sleep 5;
>>       $finished = 1;  # assume we're finished
>>       open(PS,"$PSCMD|");
>>       while (<PS>) {
>> 
>>          if ($_ =~ /$Product Setup/i) {
>>             $finished = 0;  # not finished
>>          }
>>          elsif ($_ =~ /$Product/i) {
>>             $finished = 0;  # not finished
>>          }
>>       }
>>       close(PS);
>>    }
>> 
>> }
>> 
>> 
>> $LogFile = "C:\\logs\\$Product.log";
>> 
>> ======================================================================
>> code
>> 
>> So basically, what Im trying to do is, insert a Log function into
>> particular parts of the script, and wherever I insert the Log function,
>> to write that line to Product.log.
>> The above is only a snippet.
>> Any help will be great.
>> I just dont know how to call the Log function, or how to actually write
>> it to be honest.
>> The below is my objective.
>> 
>> 1) Write a log function (subroutine)
>> 2) Being able to call that log subroutine anywhere in my script, and log
>> messages from that call to a text file.
>> 
>> Thanku in advance.
>> 
>> 
>> 
> 
> These are the problems I see with your program so far:
> $LogFile is defined too late for it to be useful for the Log function.
> The code in Log is too convoluted even though it probably just prints
> the time and some text. Parenthesis are needed with function calls if
> Perl hasn't been made aware ahead of time that the function is a function.
> 
> This site can help you learn about Perl:
> http://perldoc.perl.org/perl.html
> 
> After reading that page, you should read "perlintro."

I agree, and I would add:

Opening and closing the file on every call to Log() is expensive. One
usually opens it once and then keeps the file handle around.

In this case, it might be considered "good manners" to have the program
respond to SIGHUP to close and reopen the log file for the benefit of
logrotation, though logrotate can work around this if necessary.

Hint to the OP: Try POSIX::strftime()

Cheers

Tim


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

Date: Wed, 04 Jul 2007 11:26:19 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Trying to write a log function
Message-Id: <vtLii.4268$105.3065@trndny08>

Tim Southerwood wrote:
> Opening and closing the file on every call to Log() is expensive.

True.

> One
> usually opens it once and then keeps the file handle around.

Depends. If you want to capture the last breath of your program before it 
dies an untimely death then you don't want to risk loosing its last words in 
an unsaved buffer.

jue 




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

Date: Wed, 04 Jul 2007 12:58:09 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Trying to write a log function
Message-Id: <468b8b52$0$642$5a6aecb4@news.aaisp.net.uk>

Jürgen Exner wrote:

> Tim Southerwood wrote:
>> Opening and closing the file on every call to Log() is expensive.
> 
> True.
> 
>> One
>> usually opens it once and then keeps the file handle around.
> 
> Depends. If you want to capture the last breath of your program before it
> dies an untimely death then you don't want to risk loosing its last words
> in an unsaved buffer.
> 
> jue

That's fair, but then it would still be cheaper to sysopen the file with
O_SYNC
and call syswrite(). Imagine that the program gets into a whinge-loop an
spews messages at the rate of 100's per second which isn't unknown. A basic
step like this can make a noticeable difference.

Cheers

Tim


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

Date: Wed, 04 Jul 2007 09:43:16 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unlurking
Message-Id: <cuhm83pc384ccv3302erh1r2img727qakk@4ax.com>

On Tue, 3 Jul 2007 19:13:54 -0400, "Wade Ward" <invalid@invalid.nyet>
wrote:

>>>> It depends on (i) what your notion is, which you don't explain and
>>>> (ii) what you suspect Perlities(?) to think it is, which you also
>>>> don't explain.
>>>My background is algebra, of which group theory is a bulwark.  They're
>>>different ideas entirely.
>>
>> In fact the complete classification of newsgroups is considerably
>> simpler than that of finite simple groups, for example. But yours
>> still stands out as a misplaced piece of humour IMHO.
>If it is humor, I hope it is topical here.  The classification puts the heat 
>on computer scientists to catch up.

As far as I'm concerned humour is fine. Sarcasm even, especially in
reply to stupid questions. But since mine was a very precise question
aimed at helping you, you may have answered it just fine, and then
include the funny remark. Or the other way round. Also, fun and wit
are good and all, but without exaggerating: the main topic remains
Perl, and if the noise/signal ratio be the noise humour or rants or
whatever, it may get on the nerves of quite a lot of people.

>>>OP has _Programming Perl_ and _Perl in a nutshell_ in hand.  Do these 
>>>count
>>>as standard references?
>>
>> The former, certainly. The latter, I don't know.
>The topic of the thread really was "unlurking," and, with reference in hand, 
>I'll start over.  If you have an aversion to silly-sounding questions, I 

Yep, that would be better.

>suggest that such a person killfile me now, as opposed to when I'm poring a 
>perl reference and don't want to be told that I'm an idiot.

I don't see (yet) good reasons to killfile you. OTOH I'm not really
sure if I understand your comment: are you suggesting I'm telling
you're an idiot because I answered "The former, certainly. The latter,
I don't know." If so, then I don't know how possibly. In any case, re
books... they're fine and all. But I don't think they're *strictly*
necessary. My own experience differs, and granted: I'm far from being
a Perl guru, but I guess I'm a pretty decent Perl programmer both for
fun and as a professional one. Actually I've only had in my hands a
very old (Perl 4, I think, in Perl 5 times) copy of the Llama Book
which drove me for the very few steps. All the rest I learnt from
here, perldoc and to a minor extent, Perl Monks. Well, and for
application specific stuff, at work.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 04 Jul 2007 04:23:28 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: unlurking
Message-Id: <m26450d1bz.fsf@dot-app.org>

"Wade Ward" <invalid@invalid.nyet> writes:

> Why do I want strict as opposed to lenient in a 
> syntax where, besides hello world, I get nothing but punishment?

Get real - it's not "punishment", it's valuable feedback.

When the "check engine" light on your car lights up, what do you do? Do
you disconnect the light because it's "punishing" you, and hope that the
problem somehow fixes itself? Or do you fix the engine problem?

sherm--


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

Date: Wed, 4 Jul 2007 04:22:59 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <TqCdnVgB1dy_xBbbnZ2dnUVZ_vCknZ2d@comcast.com>


"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
news:cuhm83pc384ccv3302erh1r2img727qakk@4ax.com...
> On Tue, 3 Jul 2007 19:13:54 -0400, "Wade Ward" <invalid@invalid.nyet>
> wrote:

>>> In fact the complete classification of newsgroups is considerably
>>> simpler than that of finite simple groups, for example. But yours
>>> still stands out as a misplaced piece of humour IMHO.
>>If it is humor, I hope it is topical here.  The classification puts the 
>>heat
>>on computer scientists to catch up.
>
> As far as I'm concerned humour is fine. Sarcasm even, especially in
> reply to stupid questions. But since mine was a very precise question
> aimed at helping you, you may have answered it just fine, and then
> include the funny remark. Or the other way round. Also, fun and wit
> are good and all, but without exaggerating: the main topic remains
> Perl, and if the noise/signal ratio be the noise humour or rants or
> whatever, it may get on the nerves of quite a lot of people.

>>[just for kicks]
> I don't see (yet) good reasons to killfile you. OTOH I'm not really
> sure if I understand your comment: are you suggesting I'm telling
> you're an idiot because I answered "The former, certainly. The latter,
> I don't know." If so, then I don't know how possibly. In any case, re
> books... they're fine and all. But I don't think they're *strictly*
> necessary. My own experience differs, and granted: I'm far from being
> a Perl guru, but I guess I'm a pretty decent Perl programmer both for
> fun and as a professional one. Actually I've only had in my hands a
> very old (Perl 4, I think, in Perl 5 times) copy of the Llama Book
> which drove me for the very few steps. All the rest I learnt from
> here, perldoc and to a minor extent, Perl Monks. Well, and for
> application specific stuff, at work.
I wouldn't want to do comp.lang.perl.misc without you.
-- 
WW 




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

Date: Wed, 04 Jul 2007 05:09:44 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: unlurking
Message-Id: <1183550984.397288.102100@o61g2000hsh.googlegroups.com>

On Jul 4, 2:42 am, "Wade Ward" <inva...@invalid.nyet> wrote:
> Why do I want strict as opposed to lenient in a
> syntax where, besides hello world, I get nothing but punishment?

Please find the error in this code.

#!/usr/bin/perl
my $ONE = "hello";
my $TWO = "world";
if ($ONE =~ /l/) {
  print "$0NE $TW0\n";
}
___END__


use strict would have told you what it was immediately.

Paul Lalli



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

Date: Wed, 04 Jul 2007 12:42:12 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: unlurking
Message-Id: <slrnf8n0h9.rf7.tadmc@tadmc30.sbcglobal.net>

Wade Ward <invalid@invalid.nyet> wrote:
>
> "Scott Bryce" <sbryce@scottbryce.com> wrote in message 
> news:oY-dndmJO4ZbaRfbnZ2dnUVZ_sLinZ2d@comcast.com...
>> Wade Ward wrote:
>>
>>> One of the errors I was getting said "since you're using strict...." 
>>> Commenting it out was an attempt to remove an error,
>>
>> The error was not telling you not to use strict. It is telling you that 
>> what you did is an error if you use strict. The best practice is to use 
>> strict, then fix any errors that Perl reports.

> And when I've got unshakeable errors, they're unshakeable.  


Then you post here:

   I'm getting this error message from strict, what do I do to fix it?


> I wish I could 
> report them faithfully.  


What is stopping you?


> Why do I want strict as opposed to lenient in a 
> syntax where, besides hello world, I get nothing but punishment?


If you had used strict correctly, it would have found a bug in
your program.

Helping you find your bugs is not punishment.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Wed, 04 Jul 2007 07:35:19 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: unlurking
Message-Id: <wMydnQZcHa-KPxbbnZ2dnUVZ_ruknZ2d@comcast.com>

Wade Ward wrote:

> And when I've got unshakeable errors, they're unshakeable.

Difficult to find, maybe, but not unshakable.

> I wish I could report them faithfully.

I'm not sure what you mean by that, but I'll guess. You are running your 
script in a DOS window, so you can't copy and paste the error messages. 
Find a good editor that will allow you to launch the script from the 
editor and capture the output back into the editor. I use UltraEdit. 
There are others with the same feature.

> Why do I want strict as opposed to lenient in a 
> syntax where, besides hello world, I get nothing but punishment?

Strict forces you to write cleaner code, which will make debugging easier.


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

Date: Wed, 04 Jul 2007 07:37:57 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: unlurking
Message-Id: <wMydnQFcHa8oPxbbnZ2dnUVZ_rvinZ2d@comcast.com>

Wade Ward wrote:

> Let's assume that to be true.  Doesn't the mere fact that I have to
> ask how I would know if there were an error in creating an object in
> perl preclude me from knowledge thereof?


There is something wrong with your logic.

If there was an error creating the object, you want to know that. 
Otherwise you will be looking for the error in the wrong place.

Error messages are good. They tell you what needs to be fixed. Otherwise 
you have to guess.


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

Date: Wed, 04 Jul 2007 20:57:15 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unlurking
Message-Id: <narn83l3m4nlqepr107iu9qisjch896jp8@4ax.com>

On Wed, 04 Jul 2007 07:35:19 -0600, Scott Bryce
<sbryce@scottbryce.com> wrote:

>I'm not sure what you mean by that, but I'll guess. You are running your 
>script in a DOS window, so you can't copy and paste the error messages. 

Huh?!? Mine can:

: C:\temp>perl -le "1++2"
: Number found where operator expected at -e line 1, near "++2"
:         (Missing operator before 2?)
: Can't modify constant item in postincrement (++) at -e line 1, near "1++"
: syntax error at -e line 1, near "++2"
: Execution of -e aborted due to compilation errors.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 626
**************************************


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