Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: How can I keep object arguments private

by walto (Pilgrim)
on May 24, 2010 at 08:37 UTC ( #841340=note: print w/replies, xml ) Need Help??

in reply to Re: How can I keep object arguments private
in thread How can I keep object arguments private

Thanks a lot FalseVinylShrub and ikegami for your detailed answers!!

There is no need to keep the method options in the object. So, as you pointed, it is a good idea to keep them in a variable. Since I want to distinguish between fullname and warnings I store this values in a hash
$country_warnings->{$country_code}->{'fullname'} =$country; $country_warnings->{$country_code}->{'warnings'} = \%warn; return $country_warnings;
Doing this gets me a return value that I want: MeteoalarmCountry::countries->{fullname} and ...:countries->{warnings}. I have no need to keep this values in the object.
And you are perfectly right it is also a good idea to check if $country_code is defined before assigning values to this key.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2021-01-25 01:42 GMT
Find Nodes?
    Voting Booth?