in reply to RE: RE: Re: Perl Safety
in thread Perl Safety

Well... I am getting at his module via:
use Package Package::get_data();
yet mysteriously in my code after I call Package::get_data() all of a sudden I have variables $x, $y, $z that are defined... now I would have expected theses variables to be Package::x Package::y Package::z, but there they are. I asked the engineer about this and he said that there wasn't any other way to pass multiple variables back through a return... when I suggested a hash he was particularly receptive to the idea...

Replies are listed 'Best First'.
RE: RE: RE: RE: Re: Perl Safety
by Adam (Vicar) on Aug 25, 2000 at 23:56 UTC
    untested psuedo-code
    use strict; # To make sure you use the right package names. package My_Wrapper; sub My_get_data { local $x, $y, $z; # I had 'my', but [tilly] is right. # Thats why I said, "I think." here. get_data( @_ ); return ( $x, $y, $z ); } package My_main my ( $x, $y, $z ) = My_Wrapper::My_get_data;
    That's a stab in the dark. I'm tired and I don't feel like taking the time to construct your situation for testing. But I think that is the direction to go. My_Wrapper will collect ugly globals, but they shouldn't propogate to My_main.
      thanks Adam, I'll play around with that and local and see if I can't beat something into submission... it certainly isn't a very attractive way to do it, but if it works I guess I can't complain too much...
      That has to be a local, the my is not visible to get_data. (Which is kinda the idea...) Possible gotcha. He may assume that some globals are set later.

      BTW if you will have to work with this kind of idiocy and cannot get relief, I suggest finding a more congenial workplace. They may take finding, but they do exist...