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

📄 html::form.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.PD 0.ie n .IP "$form\fR\->value( \f(CW$name\fR, \f(CW$new_value )" 4.el .IP "\f(CW$form\fR\->value( \f(CW$name\fR, \f(CW$new_value\fR )" 4.IX Item "$form->value( $name, $new_value )".PDThe \fIvalue()\fR method can be used to get/set the value of some input.  Ifno input has the indicated name, then this method will croak..SpIf multiple inputs have the same name, only the first one will beaffected..SpThe call:.Sp.Vb 1\&    $form\->value(\*(Aqfoo\*(Aq).Ve.Spis a short-hand for:.Sp.Vb 1\&    $form\->find_input(\*(Aqfoo\*(Aq)\->value;.Ve.ie n .IP "@names\fR = \f(CW$form\->param" 4.el .IP "\f(CW@names\fR = \f(CW$form\fR\->param" 4.IX Item "@names = $form->param".PD 0.ie n .IP "@values\fR = \f(CW$form\fR\->param( \f(CW$name )" 4.el .IP "\f(CW@values\fR = \f(CW$form\fR\->param( \f(CW$name\fR )" 4.IX Item "@values = $form->param( $name )".ie n .IP "$form\fR\->param( \f(CW$name\fR, \f(CW$value, ... )" 4.el .IP "\f(CW$form\fR\->param( \f(CW$name\fR, \f(CW$value\fR, ... )" 4.IX Item "$form->param( $name, $value, ... )".ie n .IP "$form\fR\->param( \f(CW$name, \e@values )" 4.el .IP "\f(CW$form\fR\->param( \f(CW$name\fR, \e@values )" 4.IX Item "$form->param( $name, @values )".PDAlternative interface to examining and setting the values of the form..SpIf called without arguments then it returns the names of all theinputs in the form.  The names will not repeat even if multiple inputshave the same name.  In scalar context the number of different namesis returned..SpIf called with a single argument then it returns the value or valuesof inputs with the given name.  If called in scalar context only thefirst value is returned.  If no input exists with the given name, then\&\f(CW\*(C`undef\*(C'\fR is returned..SpIf called with 2 or more arguments then it will set values of thenamed inputs.  This form will croak if no inputs have the given nameor if any of the values provided does not fit.  Values can also beprovided as a reference to an array.  This form will allow unsettingall values with the given name as well..SpThis interface resembles that of the \fIparam()\fR function of the \s-1CGI\s0module..ie n .IP "$form\->try_others( \e&callback )" 4.el .IP "\f(CW$form\fR\->try_others( \e&callback )" 4.IX Item "$form->try_others( &callback )"This method will iterate over all permutations of unvisited enumeratedvalues (<select>, <radio>, <checkbox>) and invoke the callback foreach.  The callback is passed the \f(CW$form\fR as argument.  The return valuefrom the callback is ignored and the \fItry_others()\fR method itself doesnot return anything..ie n .IP "$request\fR = \f(CW$form\->make_request" 4.el .IP "\f(CW$request\fR = \f(CW$form\fR\->make_request" 4.IX Item "$request = $form->make_request"Will return an \f(CW\*(C`HTTP::Request\*(C'\fR object that reflects the current settingof the form.  You might want to use the \fIclick()\fR method instead..ie n .IP "$request\fR = \f(CW$form\->click" 4.el .IP "\f(CW$request\fR = \f(CW$form\fR\->click" 4.IX Item "$request = $form->click".PD 0.ie n .IP "$request\fR = \f(CW$form\fR\->click( \f(CW$name )" 4.el .IP "\f(CW$request\fR = \f(CW$form\fR\->click( \f(CW$name\fR )" 4.IX Item "$request = $form->click( $name )".ie n .IP "$request\fR = \f(CW$form\fR\->click( \f(CW$x\fR, \f(CW$y )" 4.el .IP "\f(CW$request\fR = \f(CW$form\fR\->click( \f(CW$x\fR, \f(CW$y\fR )" 4.IX Item "$request = $form->click( $x, $y )".ie n .IP "$request\fR = \f(CW$form\fR\->click( \f(CW$name\fR, \f(CW$x\fR, \f(CW$y )" 4.el .IP "\f(CW$request\fR = \f(CW$form\fR\->click( \f(CW$name\fR, \f(CW$x\fR, \f(CW$y\fR )" 4.IX Item "$request = $form->click( $name, $x, $y )".PDWill \*(L"click\*(R" on the first clickable input (which will be of type\&\f(CW\*(C`submit\*(C'\fR or \f(CW\*(C`image\*(C'\fR).  The result of clicking is an \f(CW\*(C`HTTP::Request\*(C'\fRobject that can then be passed to \f(CW\*(C`LWP::UserAgent\*(C'\fR if you want toobtain the server response..SpIf a \f(CW$name\fR is specified, we will click on the first clickable inputwith the given name, and the method will croak if no clickable inputwith the given name is found.  If \f(CW$name\fR is \fInot\fR specified, then itis ok if the form contains no clickable inputs.  In this case the\&\fIclick()\fR method returns the same request as the \fImake_request()\fR methodwould do..SpIf there are multiple clickable inputs with the same name, then thereis no way to get the \fIclick()\fR method of the \f(CW\*(C`HTML::Form\*(C'\fR to click onany but the first.  If you need this you would have to locate theinput with \fIfind_input()\fR and invoke the \fIclick()\fR method on the giveninput yourself..SpA click coordinate pair can also be provided, but this only makes adifference if you clicked on an image.  The default coordinate is(1,1).  The upper-left corner of the image is (0,0), but some badlycoded \s-1CGI\s0 scripts are known to not recognize this.  Therefore (1,1) wasselected as a safer default..ie n .IP "@kw\fR = \f(CW$form\->form" 4.el .IP "\f(CW@kw\fR = \f(CW$form\fR\->form" 4.IX Item "@kw = $form->form"Returns the current setting as a sequence of key/value pairs.  Notethat keys might be repeated, which means that some values might belost if the return values are assigned to a hash..SpIn scalar context this method returns the number of key/value pairsgenerated..ie n .IP "$form\->dump" 4.el .IP "\f(CW$form\fR\->dump" 4.IX Item "$form->dump"Returns a textual representation of current state of the form.  Mainlyuseful for debugging.  If called in void context, then the dump isprinted on \s-1STDERR\s0..SH "INPUTS".IX Header "INPUTS"An \f(CW\*(C`HTML::Form\*(C'\fR objects contains a sequence of \fIinputs\fR.  References tothe inputs can be obtained with the \f(CW$form\fR\->inputs or \f(CW$form\fR\->find_inputmethods..PPNote that there is \fInot\fR a one-to-one correspondence between input\&\fIobjects\fR and <input> \fIelements\fR in the \s-1HTML\s0 document.  Aninput object basically represents a name/value pair, so when multiple\&\s-1HTML\s0 elements contribute to the same name/value pair in the submittedform they are combined..PPThe input elements that are mapped one-to-one are \*(L"text\*(R", \*(L"textarea\*(R",\&\*(L"password\*(R", \*(L"hidden\*(R", \*(L"file\*(R", \*(L"image\*(R", \*(L"submit\*(R" and \*(L"checkbox\*(R".  Forthe \*(L"radio\*(R" and \*(L"option\*(R" inputs the story is not as simple: All<input type=\*(L"radio\*(R"> elements with the same name willcontribute to the same input radio object.  The number of radio inputobjects will be the same as the number of distinct names used for the<input type=\*(L"radio\*(R"> elements.  For a <select> elementwithout the \f(CW\*(C`multiple\*(C'\fR attribute there will be one input object oftype of \*(L"option\*(R".  For a <select multiple> element there willbe one input object for each contained <option> element.  Eachone of these option objects will have the same name..PPThe following methods are available for the \fIinput\fR objects:.ie n .IP "$input\->type" 4.el .IP "\f(CW$input\fR\->type" 4.IX Item "$input->type"Returns the type of this input.  The type is one of the followingstrings: \*(L"text\*(R", \*(L"password\*(R", \*(L"hidden\*(R", \*(L"textarea\*(R", \*(L"file\*(R", \*(L"image\*(R", \*(L"submit\*(R",\&\*(L"radio\*(R", \*(L"checkbox\*(R" or \*(L"option\*(R"..ie n .IP "$name\fR = \f(CW$input\->name" 4.el .IP "\f(CW$name\fR = \f(CW$input\fR\->name" 4.IX Item "$name = $input->name".PD 0.ie n .IP "$input\fR\->name( \f(CW$new_name )" 4.el .IP "\f(CW$input\fR\->name( \f(CW$new_name\fR )" 4.IX Item "$input->name( $new_name )".PDThis method can be used to get/set the current name of the input..ie n .IP "$value\fR = \f(CW$input\->value" 4.el .IP "\f(CW$value\fR = \f(CW$input\fR\->value" 4.IX Item "$value = $input->value".PD 0.ie n .IP "$input\fR\->value( \f(CW$new_value )" 4.el .IP "\f(CW$input\fR\->value( \f(CW$new_value\fR )" 4.IX Item "$input->value( $new_value )".PDThis method can be used to get/set the current value of aninput..SpIf the input only can take an enumerated list of values, then it is anerror to try to set it to something else and the method will croak ifyou try..SpYou will also be able to set the value of read-only inputs, but awarning will be generated if running under \f(CW\*(C`perl \-w\*(C'\fR..ie n .IP "$input\->possible_values" 4.el .IP "\f(CW$input\fR\->possible_values" 4.IX Item "$input->possible_values"Returns a list of all values that an input can take.  For inputs thatdo not have discrete values, this returns an empty list..ie n .IP "$input\->other_possible_values" 4.el .IP "\f(CW$input\fR\->other_possible_values" 4.IX Item "$input->other_possible_values"Returns a list of all values not tried yet..ie n .IP "$input\->value_names" 4.el .IP "\f(CW$input\fR\->value_names" 4.IX Item "$input->value_names"For some inputs the values can have names that are different from thevalues themselves.  The number of names returned by this method willmatch the number of values reported by \f(CW$input\fR\->possible_values..SpWhen setting values using the \fIvalue()\fR method it is also possible touse the value names in place of the value itself..ie n .IP "$bool\fR = \f(CW$input\->readonly" 4.el .IP "\f(CW$bool\fR = \f(CW$input\fR\->readonly" 4.IX Item "$bool = $input->readonly".PD 0.ie n .IP "$input\fR\->readonly( \f(CW$bool )" 4.el .IP "\f(CW$input\fR\->readonly( \f(CW$bool\fR )" 4.IX Item "$input->readonly( $bool )".PDThis method is used to get/set the value of the readonly attribute.You are allowed to modify the value of readonly inputs, but settingthe value will generate some noise when warnings are enabled.  Hiddenfields always start out readonly..ie n .IP "$bool\fR = \f(CW$input\->disabled" 4.el .IP "\f(CW$bool\fR = \f(CW$input\fR\->disabled" 4.IX Item "$bool = $input->disabled".PD 0.ie n .IP "$input\fR\->disabled( \f(CW$bool )" 4.el .IP "\f(CW$input\fR\->disabled( \f(CW$bool\fR )" 4.IX Item "$input->disabled( $bool )".PDThis method is used to get/set the value of the disabled attribute.Disabled inputs do not contribute any key/value pairs for the formvalue..ie n .IP "$input\->form_name_value" 4.el .IP "\f(CW$input\fR\->form_name_value" 4.IX Item "$input->form_name_value"Returns a (possible empty) list of key/value pairs that should beincorporated in the form value from this input..ie n .IP "$input\->check" 4.el .IP "\f(CW$input\fR\->check" 4.IX Item "$input->check"Some input types represent toggles that can be turned on/off.  Thisincludes \*(L"checkbox\*(R" and \*(L"option\*(R" inputs.  Calling this method turnsthis input on without having to know the value name.  If the input isalready on, then nothing happens..SpThis has the same effect as:.Sp.Vb 1\&    $input\->value($input\->possible_values[1]);.Ve.SpThe input can be turned off with:.Sp.Vb 1\&    $input\->value(undef);.Ve.ie n .IP "$input\fR\->click($form, \f(CW$x\fR, \f(CW$y)" 4.el .IP "\f(CW$input\fR\->click($form, \f(CW$x\fR, \f(CW$y\fR)" 4.IX Item "$input->click($form, $x, $y)"Some input types (currently \*(L"submit\*(R" buttons and \*(L"images\*(R") can beclicked to submit the form.  The \fIclick()\fR method returns thecorresponding \f(CW\*(C`HTTP::Request\*(C'\fR object..PPIf the input is of type \f(CW\*(C`file\*(C'\fR, then it has these additional methods:.ie n .IP "$input\->file" 4.el .IP "\f(CW$input\fR\->file" 4.IX Item "$input->file"This is just an alias for the \fIvalue()\fR method.  It sets the filename toread data from..ie n .IP "$filename\fR = \f(CW$input\->filename" 4.el .IP "\f(CW$filename\fR = \f(CW$input\fR\->filename" 4.IX Item "$filename = $input->filename".PD 0.ie n .IP "$input\fR\->filename( \f(CW$new_filename )" 4.el .IP "\f(CW$input\fR\->filename( \f(CW$new_filename\fR )" 4.IX Item "$input->filename( $new_filename )".PDThis get/sets the filename reported to the server during file upload.This attribute defaults to the value reported by the \fIfile()\fR method..ie n .IP "$content\fR = \f(CW$input\->content" 4.el .IP "\f(CW$content\fR = \f(CW$input\fR\->content" 4.IX Item "$content = $input->content".PD 0.ie n .IP "$input\fR\->content( \f(CW$new_content )" 4.el .IP "\f(CW$input\fR\->content( \f(CW$new_content\fR )" 4.IX Item "$input->content( $new_content )".PDThis get/sets the file content provided to the server during fileupload.  This method can be used if you do not want the content to beread from an actual file..ie n .IP "@headers\fR = \f(CW$input\->headers" 4.el .IP "\f(CW@headers\fR = \f(CW$input\fR\->headers" 4.IX Item "@headers = $input->headers".PD 0.ie n .IP "input\->headers($key => $value, .... )" 4.el .IP "input\->headers($key => \f(CW$value\fR, .... )" 4.IX Item "input->headers($key => $value, .... )".PDThis get/set additional header fields describing the file uploaded.This can for instance be used to set the \f(CW\*(C`Content\-Type\*(C'\fR reported forthe file..SH "SEE ALSO".IX Header "SEE ALSO"\&\s-1LWP\s0, LWP::UserAgent, HTML::Parser.SH "COPYRIGHT".IX Header "COPYRIGHT"Copyright 1998\-2005 Gisle Aas..PPThis library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.

⌨️ 快捷键说明

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