Re: Line Numbering

2003-08-04 Thread Rob Dixon

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Thank you everyone for your suggestions.
>
> This is getting more and more interesting.  The script I am looking at
> actually worked once!!
>
> I tried to use dianostics to no avail.  I got the following message:
>
> syntax error at sys:\perl\lib/diagnostics.pm line 171, near "use 5.005_64"
>
> I then did a perl -v and got:
>
> version 5.003_07 
>
> Am I right in thinking I have a problem with versioning here??

Yes. The 'use' statement is requiring at least version 5.005_64 for the
compilation to go ahead. What you're running is 5.003_07 which isn't
late enough.

I'd be very surprised if there was a significant difference between
these two version to stop your program running. Try just commenting
out the 'use' line and see where that gets you. If there's syntax
that the older version doesn't understand then the warnings and
errors will soon tell you.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Line Numbering

2003-08-04 Thread johnstonp
Thank you everyone for your suggestions.

This is getting more and more interesting.  The script I am looking at 
actually worked once!! 

I tried to use dianostics to no avail.  I got the following message:

syntax error at sys:\perl\lib/diagnostics.pm line 171, near "use 5.005_64"

I then did a perl -v and got:

version 5.003_07 

Am I right in thinking I have a problem with versioning here??

After a bit of checking on www.novell.com I found a doc that suggested I 
use - perl -d script.pl
to debug.  That seemed to work well.  I now have some error messages I can 
work with.  I will have a punch at it over the next couple of days, and 
yell if I cant get anywhere




[EMAIL PROTECTED] wrote on 01/08/2003 18:29:05:

> write 
> 
> use diagnostics;
> 
> gives you more information about errors
> 
> Marcos
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 8:15 AM
> To: [EMAIL PROTECTED]
> Subject: Line Numbering
> 
> 
> Hi all,
> 
> I've been thrown in the deep end to try and work out what the problem 
with 
> a perl script running on Novell Bordermanager.  I'm probably going to 
have 
> a few stupid questions over the next few days.  Please forgive me before 

> hand, and dont laugh too much!   I am trying to bolster my knowledge via 

> the on-line library at learn.perl.org, perldoc, and a couple of online 
> tutorials I found.
> 
> Whilst troubleshooting the script (using -w and -c) I get references to 
> line xxx..
> 
> My stupid question number one is:  When Perl processes the script, how 
> does it identify the lines of code?  ie.. If an error occurs at line 
125, 
> is that the 125'th line of actual code, or does it count every single 
line 
> in the script from the beginning including remm'ed statements, blank 
lines 
> etc...??
> 
> My reason for asking, is that with -w  I get "use of uninitiaized value 
> at..." errors which do not make much sense at the line numbers 
> mentioned...
> 
> 
> 
> Peter A Johnston CLP
> Network Services Administrator
> 
> Peters & Brownes Group
> 22 Geddes Street, Balcatta, 6021,  WA,  Australia
> 
> [EMAIL PROTECTED]
> 
> There's no point in being grown up if you can't be childish sometimes.
> -- Dr. Who 


Re: Line Numbering

2003-08-01 Thread Rob Dixon
[EMAIL PROTECTED] wrote:
> Hi all,
>
> I've been thrown in the deep end to try and work out what the problem with
> a perl script running on Novell Bordermanager.  I'm probably going to have
> a few stupid questions over the next few days.  Please forgive me before
> hand, and dont laugh too much!   I am trying to bolster my knowledge via
> the on-line library at learn.perl.org, perldoc, and a couple of online
> tutorials I found.
>
> Whilst troubleshooting the script (using -w and -c) I get references to
> line xxx..
>
> My stupid question number one is:  When Perl processes the script, how
> does it identify the lines of code?  ie.. If an error occurs at line 125,
> is that the 125'th line of actual code, or does it count every single line
> in the script from the beginning including remm'ed statements, blank lines
> etc...??
>
> My reason for asking, is that with -w  I get "use of uninitiaized value
> at..." errors which do not make much sense at the line numbers
> mentioned...

Take note of the source file that the line number refers to it will say
something like

  at myfile.pl line 99

but a mistake in your program can cause errors in the module files it uses.
Also, if you have a file open for reading Perl will also report the number
of the record you last read from the file. Don't confuse this with a source
file line number which will also be in the message.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Line Numbering

2003-08-01 Thread Marcos . Rebelo
write 

use diagnostics;

gives you more information about errors

Marcos

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 8:15 AM
To: [EMAIL PROTECTED]
Subject: Line Numbering


Hi all,

I've been thrown in the deep end to try and work out what the problem with 
a perl script running on Novell Bordermanager.  I'm probably going to have 
a few stupid questions over the next few days.  Please forgive me before 
hand, and dont laugh too much!   I am trying to bolster my knowledge via 
the on-line library at learn.perl.org, perldoc, and a couple of online 
tutorials I found.

Whilst troubleshooting the script (using -w and -c) I get references to 
line xxx..

My stupid question number one is:  When Perl processes the script, how 
does it identify the lines of code?  ie.. If an error occurs at line 125, 
is that the 125'th line of actual code, or does it count every single line 
in the script from the beginning including remm'ed statements, blank lines 
etc...??

My reason for asking, is that with -w  I get "use of uninitiaized value 
at..." errors which do not make much sense at the line numbers 
mentioned...



Peter A Johnston CLP
Network Services Administrator

Peters & Brownes Group
22 Geddes Street, Balcatta, 6021,  WA,  Australia

[EMAIL PROTECTED]

There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Line Numbering

2003-08-01 Thread Janek Schleicher
johnston wrote at Fri, 01 Aug 2003 14:15:18 +0800:

> My stupid question number one is:  When Perl processes the script, how 
> does it identify the lines of code?  ie.. If an error occurs at line 125, 
> is that the 125'th line of actual code, or does it count every single line 
> in the script from the beginning including remm'ed statements, blank lines 
> etc...??

Perl counts in most cases the lines like your editor does too. (Including
comments, heredocs and so on). Only evaled parts of your code get their
own counting, but I assume (hope) that beginners don't work often with
eval.

Sometimes the line is not what we humans might expect. E.g. if
if (...) {

} elsif { ... } {

}
has a runtime error or warning in the elsif condition part, Perl might
show the line nr of the if.

But compared to other languages, Perl is very correct finding the right
error or warning line.

> My reason for asking, is that with -w  I get "use of uninitiaized value 
> at..." errors which do not make much sense at the line numbers 
> mentioned...

Show us the code and the warning and we'll explain.


Greetings,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Line Numbering

2003-08-01 Thread johnstonp
Hi all,

I've been thrown in the deep end to try and work out what the problem with 
a perl script running on Novell Bordermanager.  I'm probably going to have 
a few stupid questions over the next few days.  Please forgive me before 
hand, and dont laugh too much!   I am trying to bolster my knowledge via 
the on-line library at learn.perl.org, perldoc, and a couple of online 
tutorials I found.

Whilst troubleshooting the script (using -w and -c) I get references to 
line xxx..

My stupid question number one is:  When Perl processes the script, how 
does it identify the lines of code?  ie.. If an error occurs at line 125, 
is that the 125'th line of actual code, or does it count every single line 
in the script from the beginning including remm'ed statements, blank lines 
etc...??

My reason for asking, is that with -w  I get "use of uninitiaized value 
at..." errors which do not make much sense at the line numbers 
mentioned...



Peter A Johnston CLP
Network Services Administrator

Peters & Brownes Group
22 Geddes Street, Balcatta, 6021,  WA,  Australia

[EMAIL PROTECTED]

There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who 


Re: Line numbering.

2002-03-18 Thread zentara

On Sun, 17 Mar 2002 08:44:12 -0500, [EMAIL PROTECTED] (Gkotsovilis) wrote:

>How do you keep line numbering straight in a perl script.

A cool way is to use an undocumented module called
Filter::NumberLines

 Here's the URL of this filter:
 http://www.perlmonks.org/index.pl?node_id=125831


It lets you put line numbers in your perl programs (just like basic),
and the program still runs perfectly.





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Line numbering.

2002-03-17 Thread Jonathan E. Paton

> Perhaps you learnt to program with something like
> Apple Basic like I did when I was
> 10 years old on the Apple IIe
> which requires line numbers.

Or the BBC Micro, or the commodore 64, or the
Spectrum or the .

> Perl doesn't need them.

But you can have them if you want them:

#!/usr/bin/perl -w
while () {
if (/^(\d+) (.*)$/) {
$code{$1} = $2 . ';';
} else {
next if /^\s*$/;
warn "Error, invalid line:\n";
die  "$_\n";
}
}
$code .= $code{$_} foreach (sort keys %code);
eval $code;

__DATA__
10 print "Enter a word, then press return: "
20 $value = <>
30 print "You entered:" . $value

__END__

Jonthan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Line numbering.

2002-03-17 Thread Timothy Johnson

 
Whoa.  That brings back memories.  The scary thing is that two years ago I
was working at a place that still had their entire inventory/purchasing/HR
system was programmed in BASIC.  They didn't seem to get it when I pointed
out that anyone could press ^C, GOTO the line were the passwords were
accepted, and impersonate anyone on the network.  The scary part?  They were
working on a way to connect the system to the Internet.

-Original Message-
From: Mark Maunder
To: gkotsovilis
Cc: [EMAIL PROTECTED]
Sent: 3/17/02 8:22 AM
Subject: Re: Line numbering.

Perhaps you learnt to program with something like Apple Basic like I did
when I was 10 years old on the Apple IIe which requires line numbers. Perl doesn't need them.

gkotsovilis wrote:

> How do you keep line numbering straight in a perl script.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Line numbering.

2002-03-17 Thread Mark Maunder

Perhaps you learnt to program with something like Apple Basic like I did
when I was 10 years old on the Apple IIe which requires line numbers. Perl doesn't need them.

gkotsovilis wrote:

> How do you keep line numbering straight in a perl script.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Line numbering.

2002-03-17 Thread Jonathan E. Paton

> How do you keep line numbering straight
> in a perl script.

No code example?  I can only assume you want:

while (<>) {
printf "%.5d: %s", $., $_;
}

or maybe:

while (<>) {
printf "%5s: %s", $., $_;
}

or even:

perl -n -e 'printf"%.5d: %s",$.,$_'

Clear description of your requirements is
important, since our ESP ability (mine in
particular) is quite lacking.

Take care,

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Line numbering.

2002-03-17 Thread Jenda Krynicky

From: gkotsovilis <[EMAIL PROTECTED]>

> How do you keep line numbering straight in a perl script.

Beg your pardon?

What line numbering? How is it not straight? What do you do, what 
do you expect and what do you get?

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Line numbering.

2002-03-17 Thread gkotsovilis

How do you keep line numbering straight in a perl script.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]