package JPI::Common; use strict; use warnings; use CGI; { my $q; sub new_cgi { $q = CGI->new() unless defined $q; return $q; } } 1; #### package JPI::Test; use strict; use warnings; use JPI::Common; my $q = JPI::Common->new_cgi(); sub change_value { $q->param('test','value changed'); } 1; #### #!/usr/bin/perl -w use strict; use JPI::Common; use JPI::Test; my $q = JPI::Common->new_cgi(); $q->param('test','initial value'); print $q->header(), 'Before: ', $q->param('test'), "\n"; JPI::Test->change_value(); print 'After: ', $q->param('test'), "\n"; #### Before: initial value After: value changed