I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-01-26 15:18:24-08 by gaetan
Default value
Hi all,
I am using OIO version 3.05
When I start the following program
package toto; use strict; use warnings; use Object::InsideOut; my @attr :Field :Default({}) ; sub set_attr { my $obj = shift; my ($key, $value) = @_; $attr[$$obj]->{$key} = $value; } sub print { my $obj = shift; foreach my $p (keys %{$attr[$$obj]}){ print "$p => $attr[$$obj]->{$p}\n"; } } package main; my $t1 = toto->new(); $t1->set_attr('keyt1', 'valt1'); my $t2 = toto->new(); $t2->set_attr('keyt2', 'valt2'); $t2->print(); 1;
the output of the program is
bash>perl ~/tmp/toto.pl keyt1 => valt1 keyt2 => valt2

Is it normal ? I was waiting for the following output
bash>perl ~/tmp/toto.pl keyt2 => valt2
Is it a restriction ?
Thanks
Gaetan
Direct Responses: 4171 | Write a response