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

📄 cgi.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 5 页
字号:
       if (ref($src) eq "ARRAY") # Check to see if the $src variable is an array reference       { # If it is, push a LINK tag for each one           foreach $src (@$src)         {           push(@result,$XHTML ? qq(<link rel="$rel" type="$type" href="$src" $other/>)                             : qq(<link rel="$rel" type="$type" href="$src"$other>)) if $src;         }       }       else       { # Otherwise, push the single -src, if it exists.         push(@result,$XHTML ? qq(<link rel="$rel" type="$type" href="$src" $other/>)                             : qq(<link rel="$rel" type="$type" href="$src"$other>)              ) if $src;        }     if ($verbatim) {           my @v = ref($verbatim) eq 'ARRAY' ? @$verbatim : $verbatim;           push(@result, "<style type=\"text/css\">\n$_\n</style>") foreach @v;      }      my @c = ref($code) eq 'ARRAY' ? @$code : $code if $code;      push(@result,style({'type'=>$type},"$cdata_start\n$_\n$cdata_end")) foreach @c;      } else {           my $src = $s;           push(@result,$XHTML ? qq(<link rel="$rel" type="$type" href="$src" $other/>)                               : qq(<link rel="$rel" type="$type" href="$src"$other>));      }    }    @result;}END_OF_FUNC'_script' => <<'END_OF_FUNC',sub _script {    my ($self,$script) = @_;    my (@result);    my (@scripts) = ref($script) eq 'ARRAY' ? @$script : ($script);    foreach $script (@scripts) {	my($src,$code,$language);	if (ref($script)) { # script is a hash	    ($src,$code,$type) =		rearrange(['SRC','CODE',['LANGUAGE','TYPE']],				 '-foo'=>'bar',	# a trick to allow the '-' to be omitted				 ref($script) eq 'ARRAY' ? @$script : %$script);            $type ||= 'text/javascript';            unless ($type =~ m!\w+/\w+!) {                $type =~ s/[\d.]+$//;                $type = "text/$type";            }	} else {	    ($src,$code,$type) = ('',$script, 'text/javascript');	}    my $comment = '//';  # javascript by default    $comment = '#' if $type=~/perl|tcl/i;    $comment = "'" if $type=~/vbscript/i;    my ($cdata_start,$cdata_end);    if ($XHTML) {       $cdata_start    = "$comment<![CDATA[\n";       $cdata_end     .= "\n$comment]]>";    } else {       $cdata_start  =  "\n<!-- Hide script\n";       $cdata_end    = $comment;       $cdata_end   .= " End script hiding -->\n";   }     my(@satts);     push(@satts,'src'=>$src) if $src;     push(@satts,'type'=>$type);     $code = $cdata_start . $code . $cdata_end if defined $code;     push(@result,$self->script({@satts},$code || ''));    }    @result;}END_OF_FUNC#### Method: end_html# End an HTML document.# Trivial method for completeness.  Just returns "</body>"####'end_html' => <<'END_OF_FUNC',sub end_html {    return "\n</body>\n</html>";}END_OF_FUNC################################# METHODS USED IN BUILDING FORMS#################################### Method: isindex# Just prints out the isindex tag.# Parameters:#  $action -> optional URL of script to run# Returns:#   A string containing a <isindex> tag'isindex' => <<'END_OF_FUNC',sub isindex {    my($self,@p) = self_or_default(@_);    my($action,@other) = rearrange([ACTION],@p);    $action = qq/ action="$action"/ if $action;    my($other) = @other ? " @other" : '';    return $XHTML ? "<isindex$action$other />" : "<isindex$action$other>";}END_OF_FUNC#### Method: startform# Start a form# Parameters:#   $method -> optional submission method to use (GET or POST)#   $action -> optional URL of script to run#   $enctype ->encoding to use (URL_ENCODED or MULTIPART)'startform' => <<'END_OF_FUNC',sub startform {    my($self,@p) = self_or_default(@_);    my($method,$action,$enctype,@other) = 	rearrange([METHOD,ACTION,ENCTYPE],@p);    $method  = $self->escapeHTML(lc($method) || 'post');    $enctype = $self->escapeHTML($enctype || &URL_ENCODED);    if (defined $action) {       $action = $self->escapeHTML($action);    }    else {       $action = $self->escapeHTML($self->request_uri || $self->self_url);    }    $action = qq(action="$action");    my($other) = @other ? " @other" : '';    $self->{'.parametersToAdd'}={};    return qq/<form method="$method" $action enctype="$enctype"$other>\n/;}END_OF_FUNC#### Method: start_form# synonym for startform'start_form' => <<'END_OF_FUNC',sub start_form {    $XHTML ? &start_multipart_form : &startform;}END_OF_FUNC'end_multipart_form' => <<'END_OF_FUNC',sub end_multipart_form {    &endform;}END_OF_FUNC#### Method: start_multipart_form# synonym for startform'start_multipart_form' => <<'END_OF_FUNC',sub start_multipart_form {    my($self,@p) = self_or_default(@_);    if (defined($p[0]) && substr($p[0],0,1) eq '-') {      return $self->startform(-enctype=>&MULTIPART,@p);    } else {	my($method,$action,@other) = 	    rearrange([METHOD,ACTION],@p);	return $self->startform($method,$action,&MULTIPART,@other);    }}END_OF_FUNC#### Method: endform# End a form'endform' => <<'END_OF_FUNC',sub endform {    my($self,@p) = self_or_default(@_);    if ( $NOSTICKY ) {    return wantarray ? ("</form>") : "\n</form>";    } else {      if (my @fields = $self->get_fields) {         return wantarray ? ("<div>",@fields,"</div>","</form>")                          : "<div>".(join '',@fields)."</div>\n</form>";      } else {         return "</form>";      }    }}END_OF_FUNC'_textfield' => <<'END_OF_FUNC',sub _textfield {    my($self,$tag,@p) = self_or_default(@_);    my($name,$default,$size,$maxlength,$override,$tabindex,@other) = 	rearrange([NAME,[DEFAULT,VALUE,VALUES],SIZE,MAXLENGTH,[OVERRIDE,FORCE],TABINDEX],@p);    my $current = $override ? $default : 	(defined($self->param($name)) ? $self->param($name) : $default);    $current = defined($current) ? $self->escapeHTML($current,1) : '';    $name = defined($name) ? $self->escapeHTML($name) : '';    my($s) = defined($size) ? qq/ size="$size"/ : '';    my($m) = defined($maxlength) ? qq/ maxlength="$maxlength"/ : '';    my($other) = @other ? " @other" : '';    # this entered at cristy's request to fix problems with file upload fields    # and WebTV -- not sure it won't break stuff    my($value) = $current ne '' ? qq(value="$current") : '';    $tabindex = $self->element_tab($tabindex);    return $XHTML ? qq(<input type="$tag" name="$name" $tabindex$value$s$m$other />)                   : qq(<input type="$tag" name="$name" $value$s$m$other>);}END_OF_FUNC#### Method: textfield# Parameters:#   $name -> Name of the text field#   $default -> Optional default value of the field if not#                already defined.#   $size ->  Optional width of field in characaters.#   $maxlength -> Optional maximum number of characters.# Returns:#   A string containing a <input type="text"> field#'textfield' => <<'END_OF_FUNC',sub textfield {    my($self,@p) = self_or_default(@_);    $self->_textfield('text',@p);}END_OF_FUNC#### Method: filefield# Parameters:#   $name -> Name of the file upload field#   $size ->  Optional width of field in characaters.#   $maxlength -> Optional maximum number of characters.# Returns:#   A string containing a <input type="file"> field#'filefield' => <<'END_OF_FUNC',sub filefield {    my($self,@p) = self_or_default(@_);    $self->_textfield('file',@p);}END_OF_FUNC#### Method: password# Create a "secret password" entry field# Parameters:#   $name -> Name of the field#   $default -> Optional default value of the field if not#                already defined.#   $size ->  Optional width of field in characters.#   $maxlength -> Optional maximum characters that can be entered.# Returns:#   A string containing a <input type="password"> field#'password_field' => <<'END_OF_FUNC',sub password_field {    my ($self,@p) = self_or_default(@_);    $self->_textfield('password',@p);}END_OF_FUNC#### Method: textarea# Parameters:#   $name -> Name of the text field#   $default -> Optional default value of the field if not#                already defined.#   $rows ->  Optional number of rows in text area#   $columns -> Optional number of columns in text area# Returns:#   A string containing a <textarea></textarea> tag#'textarea' => <<'END_OF_FUNC',sub textarea {    my($self,@p) = self_or_default(@_);    my($name,$default,$rows,$cols,$override,$tabindex,@other) =	rearrange([NAME,[DEFAULT,VALUE],ROWS,[COLS,COLUMNS],[OVERRIDE,FORCE],TABINDEX],@p);    my($current)= $override ? $default :	(defined($self->param($name)) ? $self->param($name) : $default);    $name = defined($name) ? $self->escapeHTML($name) : '';    $current = defined($current) ? $self->escapeHTML($current) : '';    my($r) = $rows ? qq/ rows="$rows"/ : '';    my($c) = $cols ? qq/ cols="$cols"/ : '';    my($other) = @other ? " @other" : '';    $tabindex = $self->element_tab($tabindex);    return qq{<textarea name="$name" $tabindex$r$c$other>$current</textarea>};}END_OF_FUNC#### Method: button# Create a javascript button.# Parameters:#   $name ->  (optional) Name for the button. (-name)#   $value -> (optional) Value of the button when selected (and visible name) (-value)#   $onclick -> (optional) Text of the JavaScript to run when the button is#                clicked.# Returns:#   A string containing a <input type="button"> tag####'button' => <<'END_OF_FUNC',sub button {    my($self,@p) = self_or_default(@_);    my($label,$value,$script,$tabindex,@other) = rearrange([NAME,[VALUE,LABEL],						            [ONCLICK,SCRIPT],TABINDEX],@p);    $label=$self->escapeHTML($label);    $value=$self->escapeHTML($value,1);    $script=$self->escapeHTML($script);    my($name) = '';    $name = qq/ name="$label"/ if $label;    $value = $value || $label;    my($val) = '';    $val = qq/ value="$value"/ if $value;    $script = qq/ onclick="$script"/ if $script;    my($other) = @other ? " @other" : '';    $tabindex = $self->element_tab($tabindex);    return $XHTML ? qq(<input type="button" $tabindex$name$val$script$other />)                  : qq(<input type="button"$name$val$script$other>);}END_OF_FUNC#### Method: submit# Create a "submit query" button.# Parameters:#   $name ->  (optional) Name for the button.#   $value -> (optional) Value of the button when selected (also doubles as label).#   $label -> (optional) Label printed on the button(also doubles as the value).# Returns:#   A string containing a <input type="submit"> tag####'submit' => <<'END_OF_FUNC',sub submit {    my($self,@p) = self_or_default(@_);    my($label,$value,$tabindex,@other) = rearrange([NAME,[VALUE,LABEL],TABINDEX],@p);    $label=$self->escapeHTML($label);    $value=$self->escapeHTML($value,1);    my $name = $NOSTICKY ? '' : 'name=".submit" ';    $name = qq/name="$label" / if defined($label);    $value = defined($value) ? $value : $label;    my $val = '';    $val = qq/value="$value" / if defined($value);    $tabindex = $self->element_tab($tabindex);    my($other) = @other ? "@other " : '';    return $XHTML ? qq(<input type="submit" $tabindex$name$val$other/>)                  : qq(<input type="submit" $name$val$other>);}END_OF_FUNC#### Method: reset# Create a "reset" button.# Parameters:#   $name -> (optional) Name for the button.# Returns:#   A string containing a <input type="reset"> tag####'reset' => <<'END_OF_FUNC',sub reset {    my($self,@p) = self_or_default(@_);    my($label,$value,$tabindex,@other) = rearrange(['NAME',['VALUE','LABEL'],TABINDEX],@p);    $label=$self->escapeHTML($label);    $value=$self->escapeHTML($value,1);    my ($name) = ' name=".reset"';    $name = qq/ name="$label"/ if defined($label);    $value = defined($value) ? $value : $label;    my($val) = '';    $val = qq/ value="$value"/ if defined($value);    my($other) = @other ? " @other" : '';    $tabindex = $self->element_tab($tabindex);    return $XHTML ? qq(<input type="reset" $tabindex$name$val$other />)                  : qq(<input type="reset"$name$val$other>);}END_OF_FUNC#### Method: defaults# Create a "defaults" button.# Parameters:#   $name -> (optional) Name for the button.# Returns:#   A string containing a <input type="submit" name=".defaults"> tag## Note: this button has a special meaning to the initialization script,# and tells it to ERASE the current query string so that your defaults# are used again!####'defaults' => <<'END_OF_FUNC',sub defaults {    my($self,@p) = self_or_default(@_);    my($label,$tabindex,@other) = rearrange([[NAME,VALUE],TABINDEX],@p);    $label=$self->escapeHTML($label,1);    $label = $label || "Defaults";    my($value) = qq/ value="$label"/;    my($other) = @other ? " @other" : '';    $tabindex = $self->element_tab($tabindex);    return $XHTML ? qq(<input type="submit" name=".defaults" $tabindex$value$other />)                  : qq/<input type="submit" NAME=".defaults"$value$other>/;}END_OF_FUNC#### Method: comment# Create an HTML <!-- comment --># Parameters: a string'comment' => <<'END_OF_FUNC',sub comment {    my($self,@p) = self_or_CGI(@_);    return "<!-- @p -->";}END_OF_FUNC#### Method: checkbox# Create a checkbox that is not logically linked to any others.# The field value is "on" when the button is checked.# Parameters:#   $name -> Name of the checkbox#   $checked -> (optional) turned on

⌨️ 快捷键说明

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