in reply to over ride CGI::new from existing package

And one for the road-

BEGIN { # External package in real practice. package MyCGI; use parent "CGI"; sub new { my $self = +shift->SUPER::new(@_); $self->param(OH => "HAI"); $self; } sub DESTROY { my $self = shift; warn "doing my own thing now..."; warn "parental destruction next..."; $self->SUPER::DESTROY; } } # use MyCGI; <-- If in another/real package file. use strict; use warnings; use Data::Dumper; print Dumper( MyCGI->new ); __END__ $VAR1 = bless( { '.parameters' => [ 'OH' ], 'use_tempfile' => 1, '.charset' => 'ISO-8859-1', '.fieldnames' => {}, 'param' => { 'OH' => [ 'HAI' ] }, 'escape' => 1 }, 'MyCGI' );

(Update: added DESTROY. Not quite sure it's the way to go but I am sure someone will chime in if it's not a good idea or quite right.