non fixed number of properties in constructor

2006-07-19 Thread Ken Perl
hi there, I find a difficulty when writing the constructor which may has dynamic and non fixed number of properties, say we want to construct a new class Account, package Account; sub new { my $class = shift; my $self = { currency_us=>undef, currency_fr =>undef, }; bless

Re: non fixed number of properties in constructor

2006-07-19 Thread Rob Dixon
Ken Perl wrote: I find a difficulty when writing the constructor which may has dynamic and non fixed number of properties, say we want to construct a new class Account, package Account; sub new { my $class = shift; my $self = { currency_us=>undef, currency_fr =>undef, };

Re: non fixed number of properties in constructor

2006-07-19 Thread Ken Perl
ok, let me explain what I mean. $account = new Account; then I can get the currency of the two countries, $account->currency_us; $account->currency_fr; after I freeze the code, a new country jumps out, suppose i need support Iraq, but now I can't use this, $account->currency_iraq; If I want to su

Re: non fixed number of properties in constructor

2006-07-19 Thread Mumia W.
On 07/19/2006 05:04 AM, Ken Perl wrote: ok, let me explain what I mean. $account = new Account; then I can get the currency of the two countries, $account->currency_us; $account->currency_fr; after I freeze the code, a new country jumps out, suppose i need support Iraq, but now I can't use this,

RE: non fixed number of properties in constructor

2006-07-19 Thread Charles K. Clarkson
Ken Perl wrote: : ok, let me explain what I mean. : $account = new Account; : then I can get the currency of the two countries, : $account->currency_us; : $account->currency_fr; : : after I freeze the code, a new country jumps out, suppose i need : support Iraq, but now I can't use this, : $accou

Re: non fixed number of properties in constructor

2006-07-19 Thread D. Bolliger
Hi Ken Ken Perl am Mittwoch, 19. Juli 2006 12:04: > ok, let me explain what I mean. Better done by inline/bottom posting, if you already got a bottom answer :-) > $account = new Account; > then I can get the currency of the two countries, > $account->currency_us; > $account->currency_fr; > > aft

Re: non fixed number of properties in constructor

2006-07-20 Thread Ken Perl
I almost got the ideas with all your replies, thanks. On 7/20/06, D. Bolliger <[EMAIL PROTECTED]> wrote: Hi Ken Ken Perl am Mittwoch, 19. Juli 2006 12:04: > ok, let me explain what I mean. Better done by inline/bottom posting, if you already got a bottom answer :-) > $account = new Account; >