Subject: | tricky documentation |
This statement is wrong and run silently:
my $document = MyApp::Note->new(
to_collection => [MyApp::To->new(text => 'Bob')],
from_collection => [MyApp::From->new(text => 'Alice')],
headings => [MyApp::Heading->new(text => 'Secret' )],
body_collection => [MyApp::Body->new(text=>'Shh!')],
The correct one is the following :
my $document = MyApp::Note->new(
tos => [MyApp::To->new(text => 'Bob')],
froms => [MyApp::From->new(text => 'Alice')],
headings => [MyApp::Heading->new(text => 'Secret' )],
bodys => [MyApp::Body->new(text=>'Shh!')],
and so on ...
But you can write :
$document->add_to( MyApp::To->new(text => 'Pierre')) ;
or
my $ele=MyApp::To->new(text=>'toto') ;
push (@{$document->{to_collection}},$ele ) ;
#push (@{$document->{tos}},$ele ) ; # don't work
Regards.
Charles