Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re (tilly) 1: Readonly variable

by tilly (Archbishop)
on Feb 26, 2001 at 22:44 UTC ( #60926=note: print w/replies, xml ) Need Help??


in reply to Readonly variable

Most of the time when I have seen complaints that a variable is readonly when it wasn't obvious why, I found that it was due to a bug in my program (improperly accessing a loop variable that was global from within a sub.

After I got in the habit of aggressively making things private with my, and catching that with strict, I stopped ever running into that message.

YMMV

Replies are listed 'Best First'.
Re: Re (tilly) 1: Readonly variable
by princepawn (Parson) on Feb 27, 2001 at 00:21 UTC
    use strict; use diagnostics;
    are excellent companions to use strict
      You probably meant to turn on warnings as the second companion?

      While those are good companions, based on my experience when I see that message I take a WAG that the message is really a sign of a non-obvious problem. At least that is how that message has worked for me. Sometimes having Perl tell you why it is giving you the message is not as useful as having someone with some scars tell you what the likely error is that caused that message...

        But I thought that at least part of the point of diagnostics.pm was for people with scars to collect the likely list of reasons for each error.

                - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2022-05-22 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?