Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 21186
Status: new
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: bitcard [...] kevin.lebleu.info
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: v0.0.8
Fixed in: (no value)



Subject: Documentation doesn't address use of Class::Std in a derived class of a base that does not use it
Hi, The documentation does not address whether or not use of Class::Std in a derived class of a base that does not use Class::Std is possible. If it is possible, it should show you how, and mention any limitations. If it is not possible, it should document that fact as a limitation. It appears, from reading the code, that it is not possible without redefining new because it will never call the constructor of the base class. (unless the constructor was named BUILD) I tried the approach of defining my own new (since the documentation states this is only *almost* always an error, not always), however when I do that I get the warning "Subroutine new redefined". Other than that, defining my own new as shown below appears to be working for my case. (I have no BUILD, START, or initialized attributes, otherwise I would need to somehow bring in those behaviors from Class::Std::new.) Of course, I may be missing other issues with this approach as well. package myclass; use base qw( XML::SAX::Base ); use Class::Std; { no warnings qw(redefine); # Add comment here explaining why I am redefining new. sub new { my $class = shift; return bless $class->SUPER::new(@_), $class; } } # Methods and attribute declarations are here. Thanks, Kevin P.S. I love Perl Best Practices, I wish I had found out about this book sooner.