Hello fellow monks!
If you have time please take a look at the following code and answer the commented question.
Thanks!
eval {
my $foo = new SomeClass;
$SIG{__WARN__} = sub { die @_ };
$foo->initialize;
$foo->run;
};
if ($@) {
print "content-type: text/html\n\n$@";
exit;
}
package SomeClass;
sub new {
bless { }, shift;
}
sub initialize {
my $self = shift;
require CGI;
$self->{cgi} = new CGI;
return $self;
}
sub run {
my $self = shift;
SomeOtherClass::SomeSub($self); # Is there any other way of sendin
+g $self to SomeOtherClass without doing it this way? Note: I know I c
+ould use @IAS and make SomeOtherClass a SomeClass but I'd rather not
+create a new instance of the cgi module if it can't be helped.
}
package SomeOtherClass;
sub SomeSub {
my $self = shift;
print $self->{cgi}->header, 'Hello World!';
}