Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Wait a minute --- what's wrong with these lines ?! These look perfectly fine!
$WAI is an object, which I call getMem() which returns a hashref, I then address a piece of the hashref with ->{'MemTotal'} and take that inside the object's converter function kBToMB().
Is this bad ?? What's a better way to achieve the same thing?
----------------------------
$WAI is an object, which I call getMem() which returns a hashref, I then address a piece of the hashref with ->{'MemTotal'} and take that inside the object's converter function kBToMB().
Is this bad ?? What's a better way to achieve the same thing?
----------------------------
sub get_memory_tot { return $WAI->kBToMB( %{$WAI->getMem()}->{'MemTotal'} ); } sub get_memory_free { return $WAI->kBToMB( %{$WAI->getMem()}->{'MemFree'} ); } sub get_swap { return $WAI->kBToMB( %{ $WAI->getMem() }->{'SwapTotal'}); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: "Using a hash as a reference is deprecated" -- Baloney !
by kennethk (Abbot) on May 11, 2011 at 20:15 UTC | |
Re: "Using a hash as a reference is deprecated" -- Baloney !
by NetWallah (Canon) on May 11, 2011 at 20:17 UTC | |
Re: "Using a hash as a reference is deprecated" -- Baloney !
by ikegami (Patriarch) on May 11, 2011 at 20:24 UTC | |
by Anonymous Monk on May 11, 2011 at 20:40 UTC | |
Re: "Using a hash as a reference is deprecated" -- Baloney !
by LanX (Saint) on May 11, 2011 at 20:23 UTC |
Back to
Seekers of Perl Wisdom