CGI
view release on metacpan or search on metacpan
$self->_setup_symbols(@_);
my ($callpack, $callfile, $callline) = caller;
if ( $callpack eq 'CGI::Fast' ) {
# fixes GH #11 (and GH #12 in CGI::Fast since
# sub import was added to CGI::Fast in 9537f90
# so we need to move up a level to export the
# routines to the namespace of whatever is using
# CGI::Fast
($callpack, $callfile, $callline) = caller(1);
}
# To allow overriding, search through the packages
# Till we find one in which the correct subroutine is defined.
my @packages = ($self,@{"$self\:\:ISA"});
for $sym (sort keys %EXPORT) {
my $pck;
my $def = $DefaultClass;
for $pck (@packages) {
if (defined(&{"$pck\:\:$sym"})) {
# FUNCTIONS TO OVERRIDE:
# Turn a string into a filehandle
sub to_filehandle {
my $thingy = shift;
return undef unless $thingy;
return $thingy if UNIVERSAL::isa($thingy,'GLOB');
return $thingy if UNIVERSAL::isa($thingy,'FileHandle');
if (!ref($thingy)) {
my $caller = 1;
while (my $package = caller($caller++)) {
my($tmp) = $thingy=~/[\':]/ ? $thingy : "$package\:\:$thingy";
return $tmp if defined(fileno($tmp));
}
}
return undef;
}
# send output to the browser
sub put {
my($self,@p) = self_or_default(@_);
return \%in;
}
# These are some tie() interfaces for compatibility
# with Steve Brenner's cgi-lib.pl routines
sub ReadParse {
local(*in);
if (@_) {
*in = $_[0];
} else {
my $pkg = caller();
*in=*{"${pkg}::in"};
}
tie(%in,CGI);
return scalar(keys %in);
}
sub PrintHeader {
my($self) = self_or_default(@_);
return $self->header();
}
lib/CGI/Carp.pm view on Meta::CPAN
$main::SIG{__DIE__} =\&CGI::Carp::die if $routines{'fatalsToBrowser'};
$CGI::Carp::NO_TIMESTAMP = 1 if $routines{'noTimestamp'};
}
# These are the originals
sub realwarn { CORE::warn(@_); }
sub realdie { CORE::die(@_); }
sub id {
my $level = shift;
my($pack,$file,$line,$sub) = caller($level);
my($dev,$dirs,$id) = File::Spec->splitpath($file);
return ($file,$line,$id);
}
sub stamp {
my $frame = 0;
my ($id,$pack,$file,$dev,$dirs);
if (defined($CGI::Carp::PROGNAME)) {
$id = $CGI::Carp::PROGNAME;
} else {
do {
$id = $file;
($pack,$file) = caller($frame++);
} until !$file;
}
if (! $CGI::Carp::FULL_PATH) {
($dev,$dirs,$id) = File::Spec->splitpath($id);
}
return "$id: " if $CGI::Carp::NO_TIMESTAMP;
my $time = scalar(localtime);
return "[$time] $id: ";
}
lib/CGI/Carp.pm view on Meta::CPAN
# Cut and paste from CGI.pm so that we don't have the overhead of
# always loading the entire CGI module.
sub to_filehandle {
my $thingy = shift;
return undef unless $thingy;
return $thingy if UNIVERSAL::isa($thingy,'GLOB');
return $thingy if UNIVERSAL::isa($thingy,'FileHandle');
if (!ref($thingy)) {
my $caller = 1;
while (my $package = caller($caller++)) {
my($tmp) = $thingy=~/[\':]/ ? $thingy : "$package\:\:$thingy";
return $tmp if defined(fileno($tmp));
}
}
return undef;
}
1;
( run in 1.662 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )