A (probable) error in perltoot ( perl5/5.8.0/pod/perltoot.pod, line number 756 )

Discussion in 'Perl Misc' started by Himanshu Garg, Sep 19, 2003.

  1. Dear Perl Programmers,

    I tried out the code given in :-

    http://www.perldoc.com/perl5.8.0/pod/perltoot.html#Aggregation

    The following line :-

    printf "%s is really %s.\n", $him->name, $him->fullname;

    gives the following output :-

    Tommy is really Fullname=HASH(0x804c9b8).

    This happens because fullname returns an object reference as follows :-

    sub fullname
    {
    my $self = shift;
    return $self->{FULLNAME};
    }

    Therefore the line should probably be :-

    printf "%s is really %s.\n", $him->name, $him->fullname->as_string;

    Please correct me if I am wrong.

    Thank You
    Himanshu.
     
    Himanshu Garg, Sep 19, 2003
    #1
    1. Advertising

  2. Dear Anno,

    Thanks for the prompt reply. I have submitted the patch to bugs.perl.org.

    Thank You
    Himanshu.

    -berlin.de (Anno Siegel) wrote in message news:<bkfj4u$9sq$-Berlin.DE>...
    > Himanshu Garg <> wrote in comp.lang.perl.misc:
    > > Dear Perl Programmers,
    > >
    > > I tried out the code given in :-
    > >
    > > http://www.perldoc.com/perl5.8.0/pod/perltoot.html#Aggregation
    > >
    > > The following line :-
    > >
    > > printf "%s is really %s.\n", $him->name, $him->fullname;
    > >
    > > gives the following output :-
    > >
    > > Tommy is really Fullname=HASH(0x804c9b8).
    > >
    > > This happens because fullname returns an object reference as follows :-
    > >
    > > sub fullname
    > > {
    > > my $self = shift;
    > > return $self->{FULLNAME};
    > > }
    > >
    > > Therefore the line should probably be :-
    > >
    > > printf "%s is really %s.\n", $him->name, $him->fullname->as_string;
    > >
    > > Please correct me if I am wrong.

    >
    > Looks like you're right. Not a biggie, but you could send in a patch.
    >
    > Anno
     
    Himanshu Garg, Sep 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ajax Chelsea

    Is array of POD still a POD type?

    Ajax Chelsea, Dec 1, 2003, in forum: C++
    Replies:
    1
    Views:
    355
    Ron Natalie
    Dec 1, 2003
  2. perltoot bug?

    , Jul 11, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    116
  3. ranrodrig
    Replies:
    2
    Views:
    346
    Sisyphus
    Jan 20, 2007
  4. jh3an
    Replies:
    2
    Views:
    145
  5. cmic

    overridden method in perltoot

    cmic, Aug 13, 2009, in forum: Perl Misc
    Replies:
    2
    Views:
    133
Loading...

Share This Page