Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

(Guildenstern ) REx4: Win32::MemoryInfo

by Guildenstern (Deacon)
on Aug 31, 2000 at 20:02 UTC ( #30579=note: print w/replies, xml ) Need Help??

in reply to RE: RE: RE: Win32::MemoryInfo
in thread Win32::MemoryInfo

Okay. I see what you're saying about the parameters now. I was thinking of doing something like this:
my %meminfo = { TotalPhys=>0, AvailPhys=>0 }; MemoryStatus(\%meminfo,"KB");

but it seemed like too much work to make the user do, and setting hash values to 0 might be confusing. It would lessen the task of checking the parameter list, though, and we still have a hash reference which I agree is better than returning a specifically ordered list. Maybe I can include both options?

Negaterd character class uber alles!

Replies are listed 'Best First'.
RE (tilly) 5: Win32::MemoryInfo
by tilly (Archbishop) on Sep 01, 2000 at 21:57 UTC
    Silly trick:
    my %args = %default, @_; foreach my $arg (keys %args) { unless (exists $allowed{$arg}) { croak("Unrecognized argument '$arg' passed to MemoryStatus."); } }
    Just put all possible defaults in %default and the user can override any combination they want, and your %allowed check will catch most typos and misunderstandings of the API.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://30579]
[LanX]: choroba: another way of gaining XP is up-voting my posts ... (works always!)
[moritz]: works always, one third of the time! :-)
[LanX]: Bah mine are different. Proof otherwise!
[choroba]: Re: Zen and the art of ignoring XP
LanX with a sufficiently large test sample of 1000 votes
[Discipulus]: LanX XP is a game! look at me.. ;=)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2017-09-26 11:41 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.