On Saturday 26 Jun 2010 10:20:04 Octavian Rasnita wrote:
> Hi,
>
> I have tried the following sample of using inner/augment from the Moose
> manual:
>
> package Document;
>
> use Moose;
>
> sub as_xml {
> my $self = shift;
>
> my $xml = "<document>\n";
> $xml .= inner();
> $xml .= "</document>\n";
>
> return $xml;
> }
>
> package Report;
>
> use Moose;
> extends 'Document';
>
> augment 'as_xml' => sub {
> my $self = shift;
>
> my $xml = "<report>\n";
> $xml .= inner();
> $xml .= "</report>\n";
>
> return $xml;
> };
>
> package main;
>
> Report->new->as_xml;
>
> The single result given is:
>
> Use of uninitialized value in concatenation (.) or string at
> E:\lucru\moose\3\test.pl line 25.
>
> The line 25 is:
>
> $xml .= inner();
>
> (from the augment modifier)
>
> Am I missing something from the sample script?
>
Well, I think Report::as_xml() is trying to call its inner() function that
returns undef because it's undefined. Perhaps you want to define it somewhere.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl
God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.
Please reply to list if it's a mailing list post - http://shlom.in/reply .