I have come across an oddity while performing some development work with Perl 5.6.1 which I cannot explain - The oddity is highlighted by the following segment of code:
#!/usr/bin/perl
use Data::Dumper;
my $test = Test->new;
print Dumper( $test->test );
exit 0;
package Test;
use strict;
sub new
{
return bless {}, shift;
}
sub test
{
}
1;
__END__
Under 5.8.0 this script outputs nothing (as I would expect) - However under 5.6.1, the call to the package method test results in the return of the class object. For example:
bluebottle:~# perl test.pl
$VAR1 = bless( {}, 'Test' );
I have not had a chance as yet to test this with Activestate builds or older versions of Perl. Whilst this isn't a real issue holding up my development work, it is something which I am at a loss to explain. Can anyone enlighten me on this one?
perl -le 'print+unpack"N",pack"B32","00000000000000000000001001111010"'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.