Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > A (probable) error in perltoot ( perl5/5.8.0/pod/perltoot.pod, line number 756 )

Reply
Thread Tools

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

 
 
Himanshu Garg
Guest
Posts: n/a
 
      09-19-2003
Dear Perl Programmers,

I tried out the code given in :-

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

The following line :-

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

gives the following output :-

Tommy is really Fullname=HASH(0x804c9b.

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.
 
Reply With Quote
 
 
 
 
Himanshu Garg
Guest
Posts: n/a
 
      09-21-2003
Dear Anno,

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

Thank You
Himanshu.

(Anno Siegel) wrote in message news:<bkfj4u$9sq$>...
> 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...ml#Aggregation
> >
> > The following line :-
> >
> > printf "%s is really %s.\n", $him->name, $him->fullname;
> >
> > gives the following output :-
> >
> > Tommy is really Fullname=HASH(0x804c9b.
> >
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
overridden method in perltoot cmic Perl Misc 2 08-13-2009 08:40 PM
class global variable?(from Perltoot document) jh3an Perl Misc 2 03-11-2008 04:46 PM
perltoot bug? himanshu.garg@gmail.com Perl Misc 0 07-11-2006 03:07 AM
OT: Number Nine, Number Nine, Number Nine Frisbee® MCSE 37 09-26-2005 04:06 PM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57