in reply to Re: How could we "implement" Open Classes in Perl ?
in thread How could we "implement" Open Classes in Perl ?

Thank you for this great example.
  • Comment on Re^2: How could we "implement" Open Classes in Perl ?

Replies are listed 'Best First'.
Re^3: How could we "implement" Open Classes in Perl ?
by Your Mother (Archbishop) on Jun 28, 2008 at 04:46 UTC

    Since you have direct access to the package via its namespace, you don't even need the package switching. This works too–

    use CGI; my $cgi = CGI->new; print $cgi->foo(), "\n"; sub CGI::foo { my $self = shift; return $self->p('foo'); }