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 3 of 5 Topic 997 of 1076
Post > Topic >>

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

by mbarto@[EMAIL PROTECTED] (Michael Barto) Oct 4, 2007 at 06:56 PM

--------------020504000406070802000507
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Thanks for the reply, I realize this is painful.
Perl Version:

Last login: Thu Oct  4 18:53:15 on ttyp1
Welcome to Darwin!
pwbk2003:~ mbarto$ perl -version

This is perl, v5.8.6 built for darwin-thread-multi-2level
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License 
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete do***entation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.org/,
the Perl Home Page.

pwbk2003:~ mbarto$


Tried "use" after I declared my with %use and $dbh. Still fails and 
strict and -w are turned off. Removing the global "my's", it works but 
only with strict and -w are turned off.

Bruce Van Allen wrote:
> 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 
>     use vars qw/$dbh %hash/;
> instead?
>
>
> Best,
>
>  - Bruce
>  
> __bruce__van_allen__santa_cruz__ca__
>
>   

-- 
------------------------------------------------------------------------
*Michael Barto*
Software Architect

	LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA  92649
http://www.logiqwest.com/

	    	mbarto@[EMAIL PROTECTED]
 <mailto:mbarto@[EMAIL PROTECTED]
>
Tel:  714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949

*'tis a gift to be simple*
------------------------------------------------------------------------
This e-mail may contain LogiQwest proprietary information and should be 
treated as confidential.


--------------020504000406070802000507
Content-Type: multipart/related;
 boundary="------------080902060801030204080709"


--------------080902060801030204080709
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks for the reply, I realize this is painful. <br>
Perl Version:<br>
<br>
<tt>Last login: Thu Oct&nbsp; 4 18:53:15 on ttyp1<br>
Welcome to Darwin!<br>
pwbk2003:~ mbarto$ perl -version<br>
<br>
This is perl, v5.8.6 built for darwin-thread-multi-2level<br>
(with 3 registered patches, see perl -V for more detail)<br>
<br>
Copyright 1987-2004, Larry Wall<br>
<br>
Perl may be copied only under the terms of either the Artistic License
or the<br>
GNU General Public License, which may be found in the Perl 5 source
kit.<br>
<br>
Complete do***entation for Perl, including FAQ lists, should be found
on<br>
this system using `man perl' or `perldoc perl'.&nbsp; If you have access
to
the<br>
Internet, point your browser at <a class="moz-txt-link-freetext"
href="http://www.perl.org/">http://www.perl.org/</a>,
the Perl Home
Page.<br>
<br>
pwbk2003:~ mbarto$ </tt><br>
<br>
<br>
Tried "use" after I declared my with %use and $dbh. Still fails and
strict and -w are turned off. Removing the global "my's", it works but
only with strict and -w are turned off.<br>
<br>
Bruce Van Allen wrote:
<blockquote

cite="mid:r02010500-1049-4481883672D011DCAF78000A2794A806@[EMAIL PROTECTED]
"
 type="cite">
  <pre wrap="">On 10/4/07 Michael Barto wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">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"
    </pre>
  </blockquote>
  <pre wrap=""><!---->&gt;from these variables assignments, the program
works. What is going on?
  </pre>
  <blockquote type="cite">
    <pre wrap="">I might point out that the start of the subroutine that
is causing the
problem starts like this.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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 
    use vars qw/$dbh %hash/;
instead?


Best,

 - Bruce
 
__bruce__van_allen__santa_cruz__ca__

  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html;" http-equiv="Content-Type">
<title></title>
<div class="moz-signature">
<div class="moz-signature">
<table border="0" cellpadding="0" cellspacing="0" width="490">
  <tbody>
    <tr>
      <td colspan="4" width="490">
      <hr color="#cccccc"></td>
    </tr>
    <tr>
      <td colspan="3" align="left" valign="top" width="390"><font
 face="arial, helvetica, sans-serif"><font size="3"><b>Michael
Barto</b><br>
      </font><font size="2">Software Architect<br>
      <br>
      </font></font></td>
      <td rowspan="2" align="right" valign="middle" width="100"><img
 alt="LogiQwest Circle" src="cid:part1.09050504.08080804@[EMAIL PROTECTED]
"
 height="80" width="81"><br>
      </td>
    </tr>
    <tr>
      <td align="left" valign="top" width="220"><font
 face="arial, helvetica, sans-serif"> <font color="#003366"
size="2">LogiQwest
Inc.<br>
16458 Bolsa Chica Street, # 15<br>
Huntington Beach, CA&nbsp;&nbsp;92649<br>
      <a
href="http://www.logiqwest.com/">http://www.logiqwest.com/</a><br>
      <br>
      </font></font></td>
      <td width="10">&nbsp;&nbsp;&nbsp;</td>
      <td align="left" valign="top" width="160"><font
 face="arial, helvetica, sans-serif"><font color="#003366" size="2"><a
 href="mailto:mbarto@[EMAIL PROTECTED]
">mbarto@[EMAIL PROTECTED]
><br>
Tel:&nbsp;&nbsp;714 377 3705<br>
Fax:&nbsp;714 840 3937<br>
Cell: 714 883 1949<br>
      <br>
      </font></font></td>
    </tr>
    <tr>
      <td colspan="4" align="right" width="490"><font color="#ff6633"
 face="arial, helvetica, sans-serif" size="2"><strong>'tis a gift to be
simple</strong></font>
      <hr color="#cccccc"> </td>
    </tr>
    <tr>
      <td colspan="4" align="center" width="490"> <font
 face="arial, helvetica, sans-serif" size="1">This e-mail may contain
LogiQwest
proprietary information and should be treated as confidential.</font>
</td>
    </tr>
  </tbody>
</table>
</div>
</div>
</div>
</body>
</html>

--------------080902060801030204080709
Content-Type: image/gif; x-mac-type="47494666"; x-mac-creator="70727677";
 name="circle.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.09050504.08080804@[EMAIL PROTECTED]
>
Content-Disposition: inline;
 filename="circle.gif"

R0lGODlhUQBQAJEAAAAAAP////1HA////yH5BAEAAAMALAAAAABRAFAAAAL/jI+pyybSopy0
OvWy3bwfmGSPR5bMGIrmaqEhpqWgM7Ocii0uggexvdm9WrsfsCLk3VLHW43ZjCp5T6qsijSu
fiKt75qcdI/cMYzaI6ZLRvP54w56Pen4FI11eZPzRtwO9wYD0jcoh9OF5aN4UhOm89hoBtHH
KEWXeLFGo3PZkeg4xxcpZqmmtfkFhllIAbgYJvRa2hqRCRn7NCuRmvXaO2jqR0p7C1trBZlc
CgWGqJInvIxMM9MKesxIjAYnDdvNO7Z74jfkWhT+TN3t3WmTGlk0PrwuiRofCmyrX1zV68/P
Xjtnun4ZIhGQ3h6DQZrdCQSRYLBYTrjRAreo2p+E/1mWhbOoB1S+cg0vhcSG0R0eT43AGStU
kOM7ayg2ntpGhqZFdio14gTyqIcxj8cQGsVFaOgHcphYaJik1BNKJy+jqlKTrY3IZxLZUep5
jpNYK/KWOlsVbRWUkDIyRlS0JunVdBQvmJ3i7+7BpfWsPjQp61tLr6YGfnqq1hxPluc2imK8
ZahfyKwkAyJWU6dZN5nH4oH6r7Bcpno150LpV7SSghm/jkWMVNastKqgYbudGdjlf8rIZpsr
e/PFxK6Q0MEabLDiiHaZzU0Xey9z5rn3HF64sHcOiJOpan3MJu/2n1k/g23+cXnk76O0N6NN
Gnn57f30cofNivB55dOvrFzXTx9ReVBWzUr7KSMMeb60ZUIdABEIj3vPeUagT3xIGF9/UUxl
31qucfUbYJWQ81SJJmpiWFP7KVghhm6JsWKLtmQ4QigyluRQbX/dyItxE/LYIGspAknSjlEU
AAA7
--------------080902060801030204080709--

--------------020504000406070802000507--
 




 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:47:22 CST 2008.