⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgi.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 5 页
字号:
	   if ($EXPORT{':any'} || 	       $EXPORT{'-any'} ||	       $EXPORT{$base} || 	       (%EXPORT_OK || grep(++$EXPORT_OK{$_},&expand_tags(':html')))	           && $EXPORT_OK{$base}) {	       $code = $CGI::DefaultClass->_make_tag_func($func_name);	   }       }       croak("Undefined subroutine $AUTOLOAD\n") unless $code;       local ($@,$!);       eval "package $pack; $code";       if ($@) {	   $@ =~ s/ at .*\n//;	   croak("$AUTOLOAD: $@");       }    }           CORE::delete($sub->{$func_name});  #free storage    return "$pack\:\:$func_name";}sub _selected {  my $self = shift;  my $value = shift;  return '' unless $value;  return $XHTML ? qq(selected="selected" ) : qq(selected );}sub _checked {  my $self = shift;  my $value = shift;  return '' unless $value;  return $XHTML ? qq(checked="checked" ) : qq(checked );}sub _reset_globals { initialize_globals(); }sub _setup_symbols {    my $self = shift;    my $compile = 0;    # to avoid reexporting unwanted variables    undef %EXPORT;    foreach (@_) {	$HEADERS_ONCE++,         next if /^[:-]unique_headers$/;	$NPH++,                  next if /^[:-]nph$/;	$NOSTICKY++,             next if /^[:-]nosticky$/;	$DEBUG=0,                next if /^[:-]no_?[Dd]ebug$/;	$DEBUG=2,                next if /^[:-][Dd]ebug$/;	$USE_PARAM_SEMICOLONS++, next if /^[:-]newstyle_urls$/;	$XHTML++,                next if /^[:-]xhtml$/;	$XHTML=0,                next if /^[:-]no_?xhtml$/;	$USE_PARAM_SEMICOLONS=0, next if /^[:-]oldstyle_urls$/;	$PRIVATE_TEMPFILES++,    next if /^[:-]private_tempfiles$/;	$TABINDEX++,             next if /^[:-]tabindex$/;	$CLOSE_UPLOAD_FILES++,   next if /^[:-]close_upload_files$/;	$EXPORT{$_}++,           next if /^[:-]any$/;	$compile++,              next if /^[:-]compile$/;	$NO_UNDEF_PARAMS++,      next if /^[:-]no_undef_params$/;		# This is probably extremely evil code -- to be deleted some day.	if (/^[-]autoload$/) {	    my($pkg) = caller(1);	    *{"${pkg}::AUTOLOAD"} = sub { 		my($routine) = $AUTOLOAD;		$routine =~ s/^.*::/CGI::/;		&$routine;	    };	    next;	}	foreach (&expand_tags($_)) {	    tr/a-zA-Z0-9_//cd;  # don't allow weird function names	    $EXPORT{$_}++;	}    }    _compile_all(keys %EXPORT) if $compile;    @SAVED_SYMBOLS = @_;}sub charset {  my ($self,$charset) = self_or_default(@_);  $self->{'.charset'} = $charset if defined $charset;  $self->{'.charset'};}sub element_id {  my ($self,$new_value) = self_or_default(@_);  $self->{'.elid'} = $new_value if defined $new_value;  sprintf('%010d',$self->{'.elid'}++);}sub element_tab {  my ($self,$new_value) = self_or_default(@_);  $self->{'.etab'} ||= 1;  $self->{'.etab'} = $new_value if defined $new_value;  my $tab = $self->{'.etab'}++;  return '' unless $TABINDEX or defined $new_value;  return qq(tabindex="$tab" );}################################################################################################ THESE FUNCTIONS ARE AUTOLOADED ON DEMAND ###################################################################################################$AUTOLOADED_ROUTINES = '';      # get rid of -w warning$AUTOLOADED_ROUTINES=<<'END_OF_AUTOLOAD';%SUBS = ('URL_ENCODED'=> <<'END_OF_FUNC',sub URL_ENCODED { 'application/x-www-form-urlencoded'; }END_OF_FUNC'MULTIPART' => <<'END_OF_FUNC',sub MULTIPART {  'multipart/form-data'; }END_OF_FUNC'SERVER_PUSH' => <<'END_OF_FUNC',sub SERVER_PUSH { 'multipart/x-mixed-replace;boundary="' . shift() . '"'; }END_OF_FUNC'new_MultipartBuffer' => <<'END_OF_FUNC',# Create a new multipart buffersub new_MultipartBuffer {    my($self,$boundary,$length) = @_;    return MultipartBuffer->new($self,$boundary,$length);}END_OF_FUNC'read_from_client' => <<'END_OF_FUNC',# Read data from a file handlesub read_from_client {    my($self, $buff, $len, $offset) = @_;    local $^W=0;                # prevent a warning    return $MOD_PERL        ? $self->r->read($$buff, $len, $offset)        : read(\*STDIN, $$buff, $len, $offset);}END_OF_FUNC'delete' => <<'END_OF_FUNC',#### Method: delete# Deletes the named parameter entirely.####sub delete {    my($self,@p) = self_or_default(@_);    my(@names) = rearrange([NAME],@p);    my @to_delete = ref($names[0]) eq 'ARRAY' ? @$names[0] : @names;    my %to_delete;    foreach my $name (@to_delete)    {        CORE::delete $self->{$name};        CORE::delete $self->{'.fieldnames'}->{$name};        $to_delete{$name}++;    }    @{$self->{'.parameters'}}=grep { !exists($to_delete{$_}) } $self->param();    return;}END_OF_FUNC#### Method: import_names# Import all parameters into the given namespace.# Assumes namespace 'Q' if not specified####'import_names' => <<'END_OF_FUNC',sub import_names {    my($self,$namespace,$delete) = self_or_default(@_);    $namespace = 'Q' unless defined($namespace);    die "Can't import names into \"main\"\n" if \%{"${namespace}::"} == \%::;    if ($delete || $MOD_PERL || exists $ENV{'FCGI_ROLE'}) {	# can anyone find an easier way to do this?	foreach (keys %{"${namespace}::"}) {	    local *symbol = "${namespace}::${_}";	    undef $symbol;	    undef @symbol;	    undef %symbol;	}    }    my($param,@value,$var);    foreach $param ($self->param) {	# protect against silly names	($var = $param)=~tr/a-zA-Z0-9_/_/c;	$var =~ s/^(?=\d)/_/;	local *symbol = "${namespace}::$var";	@value = $self->param($param);	@symbol = @value;	$symbol = $value[0];    }}END_OF_FUNC#### Method: keywords# Keywords acts a bit differently.  Calling it in a list context# returns the list of keywords.  # Calling it in a scalar context gives you the size of the list.####'keywords' => <<'END_OF_FUNC',sub keywords {    my($self,@values) = self_or_default(@_);    # If values is provided, then we set it.    $self->{'keywords'}=[@values] if @values;    my(@result) = defined($self->{'keywords'}) ? @{$self->{'keywords'}} : ();    @result;}END_OF_FUNC# These are some tie() interfaces for compatibility# with Steve Brenner's cgi-lib.pl routines'Vars' => <<'END_OF_FUNC',sub Vars {    my $q = shift;    my %in;    tie(%in,CGI,$q);    return %in if wantarray;    return \%in;}END_OF_FUNC# These are some tie() interfaces for compatibility# with Steve Brenner's cgi-lib.pl routines'ReadParse' => <<'END_OF_FUNC',sub ReadParse {    local(*in);    if (@_) {	*in = $_[0];    } else {	my $pkg = caller();	*in=*{"${pkg}::in"};    }    tie(%in,CGI);    return scalar(keys %in);}END_OF_FUNC'PrintHeader' => <<'END_OF_FUNC',sub PrintHeader {    my($self) = self_or_default(@_);    return $self->header();}END_OF_FUNC'HtmlTop' => <<'END_OF_FUNC',sub HtmlTop {    my($self,@p) = self_or_default(@_);    return $self->start_html(@p);}END_OF_FUNC'HtmlBot' => <<'END_OF_FUNC',sub HtmlBot {    my($self,@p) = self_or_default(@_);    return $self->end_html(@p);}END_OF_FUNC'SplitParam' => <<'END_OF_FUNC',sub SplitParam {    my ($param) = @_;    my (@params) = split ("\0", $param);    return (wantarray ? @params : $params[0]);}END_OF_FUNC'MethGet' => <<'END_OF_FUNC',sub MethGet {    return request_method() eq 'GET';}END_OF_FUNC'MethPost' => <<'END_OF_FUNC',sub MethPost {    return request_method() eq 'POST';}END_OF_FUNC'TIEHASH' => <<'END_OF_FUNC',sub TIEHASH {    my $class = shift;    my $arg   = $_[0];    if (ref($arg) && UNIVERSAL::isa($arg,'CGI')) {       return $arg;    }    return $Q ||= $class->new(@_);}END_OF_FUNC'STORE' => <<'END_OF_FUNC',sub STORE {    my $self = shift;    my $tag  = shift;    my $vals = shift;    my @vals = index($vals,"\0")!=-1 ? split("\0",$vals) : $vals;    $self->param(-name=>$tag,-value=>\@vals);}END_OF_FUNC'FETCH' => <<'END_OF_FUNC',sub FETCH {    return $_[0] if $_[1] eq 'CGI';    return undef unless defined $_[0]->param($_[1]);    return join("\0",$_[0]->param($_[1]));}END_OF_FUNC'FIRSTKEY' => <<'END_OF_FUNC',sub FIRSTKEY {    $_[0]->{'.iterator'}=0;    $_[0]->{'.parameters'}->[$_[0]->{'.iterator'}++];}END_OF_FUNC'NEXTKEY' => <<'END_OF_FUNC',sub NEXTKEY {    $_[0]->{'.parameters'}->[$_[0]->{'.iterator'}++];}END_OF_FUNC'EXISTS' => <<'END_OF_FUNC',sub EXISTS {    exists $_[0]->{$_[1]};}END_OF_FUNC'DELETE' => <<'END_OF_FUNC',sub DELETE {    $_[0]->delete($_[1]);}END_OF_FUNC'CLEAR' => <<'END_OF_FUNC',sub CLEAR {    %{$_[0]}=();}####END_OF_FUNC##### Append a new value to an existing query####'append' => <<'EOF',sub append {    my($self,@p) = self_or_default(@_);    my($name,$value) = rearrange([NAME,[VALUE,VALUES]],@p);    my(@values) = defined($value) ? (ref($value) ? @{$value} : $value) : ();    if (@values) {	$self->add_parameter($name);	push(@{$self->{$name}},@values);    }    return $self->param($name);}EOF#### Method: delete_all# Delete all parameters####'delete_all' => <<'EOF',sub delete_all {    my($self) = self_or_default(@_);    my @param = $self->param();    $self->delete(@param);}EOF'Delete' => <<'EOF',sub Delete {    my($self,@p) = self_or_default(@_);    $self->delete(@p);}EOF'Delete_all' => <<'EOF',sub Delete_all {    my($self,@p) = self_or_default(@_);    $self->delete_all(@p);}EOF#### Method: autoescape# If you want to turn off the autoescaping features,# call this method with undef as the argument'autoEscape' => <<'END_OF_FUNC',sub autoEscape {    my($self,$escape) = self_or_default(@_);    my $d = $self->{'escape'};    $self->{'escape'} = $escape;    $d;}END_OF_FUNC#### Method: version# Return the current version####'version' => <<'END_OF_FUNC',sub version {    return $VERSION;}END_OF_FUNC#### Method: url_param# Return a parameter in the QUERY_STRING, regardless of# whether this was a POST or a GET####'url_param' => <<'END_OF_FUNC',sub url_param {    my ($self,@p) = self_or_default(@_);    my $name = shift(@p);    return undef unless exists($ENV{QUERY_STRING});    unless (exists($self->{'.url_param'})) {	$self->{'.url_param'}={}; # empty hash	if ($ENV{QUERY_STRING} =~ /=/) {	    my(@pairs) = split(/[&;]/,$ENV{QUERY_STRING});	    my($param,$value);	    foreach (@pairs) {		($param,$value) = split('=',$_,2);		$param = unescape($param);		$value = unescape($value);		push(@{$self->{'.url_param'}->{$param}},$value);	    }	} else {	    $self->{'.url_param'}->{'keywords'} = [$self->parse_keywordlist($ENV{QUERY_STRING})];	}    }    return keys %{$self->{'.url_param'}} unless defined($name);    return () unless $self->{'.url_param'}->{$name};    return wantarray ? @{$self->{'.url_param'}->{$name}}                     : $self->{'.url_param'}->{$name}->[0];}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -