Dear Monks,

I am trying to become familiar with Damians Class::Std, and I am getting these redefine warnings when I run my code :
Subroutine UNIVERSAL::VERSION redefined at /usr/lib/perl5/5.8.0/i386-l +inux-thread-multi/DynaLoader.pm line 249. Subroutine UNIVERSAL::can redefined at /usr/lib/perl5/site_perl/5.8.0/ +Class/Std.pm line 506.
I've tried this on Perl 5.8.0 on RHEL 3, and 5.8.6 on Cygwin with the same result (although different line number in DynaLoader.pm).

I'm sure it is something stupid I'm doing, but can't figure out what. Here is my class definition :
package TestBase; use strict; use warnings; use Class::Std; { my %prop1 : ATTR( init_arg => 'prop1' get => 'prop1' set => 'prop1 +' ); my %prop2 : ATTR( init_arg => 'prop2' get => 'prop2' set => 'prop2 +' ); 1; }
and here is the script :
#!/usr/bin/perl -W use strict; use warnings; use TestBase; my $b = TestBase->new( { prop1 => 'hello', prop2 => 'world' } ); print $b->_DUMP ; print 'b->prop1 = ' . $b->get_prop1 . "\n"; print 'b->prop2 = ' . $b->get_prop2 . "\n"; $b->set_prop1('horrendo'); $b->set_prop2('revolver'); print $b->_DUMP ;
I know the warnings aren't fatal, but I would prefer they weren't there. I checked the code in Class::Std and just before the eval that generates the warning, there is a line
no warnings 'redefine';
I would have thought this would suppress the warning.

I appreciate your help.

Regards,

Steve

In reply to Class::Std redefine warnings by horrendo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.