Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm having issues accessing a CGI object in the main namespace from within a 'require'-ed file...For instance, this is my main script:
#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); require ""; # define a hash to contain any "global" objects or variables our %GLOBAL = ( 'query' => '', 'test' => 'foobar!' ); $GLOBAL{'query'} = new CGI; print CGI::header(); outputTest(); outputPOST();
and this is the library file it requires (
sub outputTest { print $main::GLOBAL{'test'}; } sub outputPOST { print $main::GLOBAL{'query'}->Vars; } 1;
running this as-is throws up an Internal Server Error, which is strange considering i'm using fatalsToBrowser. i'm sure the problem is with the CGI query object, because if I remove the outputPost subroutine, it runs fine.

am I just missing something vitally obvious?