baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
my problem is that i have to use hash as a standard interface for communication with some methods, but sometimes my method just checks if something is declared (like a flag) or not (it doesn't have to be initialized (it could but it doesn't have to be))
so my question is how can i make my method understand if i write :
any suggestions ?$self->test('database'); and $self->test(database => 'name.db'); sub test { my ($self,---) = @_; my %arg = ---- if (--- eq 'HASH'); this obviously doesn't work, but how to make it work !!! } $self->test(database => 'T'); is something i would like to avoid
thnx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash interface
by GrandFather (Saint) on Mar 06, 2009 at 09:52 UTC | |
by shmem (Chancellor) on Mar 06, 2009 at 10:12 UTC | |
by GrandFather (Saint) on Mar 06, 2009 at 10:47 UTC | |
by shmem (Chancellor) on Mar 06, 2009 at 11:14 UTC |