Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: "my variabl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 997 of 1076
Post > Topic >>

Re: "my variable" at global level not being passed

by bva@[EMAIL PROTECTED] (Bruce Van Allen) Oct 4, 2007 at 04:19 PM

On 10/4/07 Michael Barto wrote:

>I am working with an old Perl Library (program module) written in
>Perl4 and Perl  5 depending who was "hacking the code". My program
>that calls it, uses -w and strict and has identified many syntax
>errors and so forth in the old library which I fixed. My problem is
>that this library needs two variables passed as globals to it to use
>in one of the subroutines, One of them is the $dbh variable created
>when the database is open. Another is a hash. Both these variables
>were initiated at the Main top most level of the program with "my".
>Unfortunately, this causes an error and the libraries does not see the
>global. If I turn off strict and the -w options and remove the "my"
>from these variables assignments, the program works. What is going on?
>I might point out that the start of the subroutine that is causing the
>problem starts like this.

What version of perl is the revised program going to run under?

Did you add the my() declaration to the two variables, or was it already
there?

What happens if you declare them with=20
    use vars qw/$dbh %hash/;
instead?


Best,

 - Bruce
=20
__bruce__van_allen__santa_cruz__ca__
 




 5 Posts in Topic:
"my variable" at global level not being passed
mbarto@[EMAIL PROTECTED]   2007-10-04 15:57:31 
Re: "my variable" at global level not being passed
bva@[EMAIL PROTECTED] (B  2007-10-04 16:19:33 
Re: "my variable" at global level not being passed
mbarto@[EMAIL PROTECTED]   2007-10-04 18:56:53 
Re: "my variable" at global level not being passed
sherm@[EMAIL PROTECTED]   2007-10-04 22:06:56 
Re: "my variable" at global level not being passed
jeremiah@[EMAIL PROTECTED  2007-10-05 12:54:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 0:21:42 CST 2008.