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

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'); }