Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RE (3): BrainPain-Help

by tilly (Archbishop)
on Aug 10, 2000 at 20:16 UTC ( #27318=note: print w/ replies, xml ) Need Help??


in reply to RE: Re: BrainPain-Help
in thread BrainPain-Help

But you are still right to complain about the my. The name that is advertised in the debugging statement refers to a package variable and not to the variable actually being printed. This indicates some confusion. Plus my and mod_perl (tyop fix, had been CGI) when not understood correctly leads to lack of sharing which is a deep problem.

I know why it is a problem in Perl, and I think I have a sense of why there is no good fix for the problem, but I cannot articulate it very well.

For those who don't know, if you have a my around a sub and the my is executed multiple times, you then wind up with multiple copies of the my variable (one per invocation), and there are deep naming problems making it impossible to give a clean answer as to which copy of the my goes with the globally named sub.

Perl doesn't answer it, it just gives you a "Cannot stay shared" warning and proceeds to not do what you might expect. If you use my variables like globals in your script in mod_perl, you will hit this because mod_perl executes your script on each call. Execute it twice and now all of those global mys are not shared properly and you have serious voodoo.

This is a very good reason to be in the habit of using vars when you really are thinking of globals. (Based on first principles I would want to check in 5.6 whether carelessness with "our" could also hit this problem. I honestly don't know the answer.)

/tell tilly if anyone needs clarification on this.


Comment on RE (3): BrainPain-Help
RE: RE (3): BrainPain-Help
by coreolyn (Parson) on Aug 10, 2000 at 20:31 UTC

    I'm so sorry for the confusion I created with the way I labled my debugging scripts!

    While I am using mod perl and the script interfaces several home grown object packages, the fact is that the References in this snippent are read by me as follows:

      ChangeAdm::Review::Requestor = $Requestor
      ChangeAdm = Current Script/package
      Review = Current Subroutine
      Requestor = The variable I'm debugging.

    I hadn't considered the confusion that might have created.

    my apologies.

    coreolyn Duct tape devotee.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2014-12-28 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls