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

📄 tap::parser.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "TAP::Parser 3".TH TAP::Parser 3 "2008-01-23" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"TAP::Parser \- Parse \s-1TAP\s0 output.SH "VERSION".IX Header "VERSION"Version 3.07.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&    use TAP::Parser;\&\&    my $parser = TAP::Parser\->new( { source => $source } );\&\&    while ( my $result = $parser\->next ) {\&        print $result\->as_string;\&    }.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"\&\f(CW\*(C`TAP::Parser\*(C'\fR is designed to produce a proper parse of \s-1TAP\s0 output. Foran example of how to run tests through this module, see the simpleharnesses \f(CW\*(C`examples/\*(C'\fR..PPThere's a wiki dedicated to the Test Anything Protocol:.PP<http://testanything.org>.PPIt includes the TAP::Parser Cookbook:.PP<http://testanything.org/wiki/index.php/TAP::Parser_Cookbook>.SH "METHODS".IX Header "METHODS".Sh "Class Methods".IX Subsection "Class Methods"\fI\f(CI\*(C`new\*(C'\fI\fR.IX Subsection "new".PP.Vb 1\& my $parser = TAP::Parser\->new(\e%args);.Ve.PPReturns a new \f(CW\*(C`TAP::Parser\*(C'\fR object..PPThe arguments should be a hashref with \fIone\fR of the following keys:.IP "\(bu" 4\&\f(CW\*(C`source\*(C'\fR.SpThis is the preferred method of passing arguments to the constructor.  Todetermine how to handle the source, the following steps are taken..SpIf the source contains a newline, it's assumed to be a string of raw \s-1TAP\s0output..SpIf the source is a reference, it's assumed to be something to pass tothe TAP::Parser::Iterator::Stream constructor. This is usedinternally and you should not use it..SpOtherwise, the parser does a \f(CW\*(C`\-e\*(C'\fR check to see if the source exists.  If so,it attempts to execute the source and read the output as a stream.  This is byfar the preferred method of using the parser..Sp.Vb 4\& foreach my $file ( @test_files ) {\&     my $parser = TAP::Parser\->new( { source => $file } );\&     # do stuff with the parser\& }.Ve.IP "\(bu" 4\&\f(CW\*(C`tap\*(C'\fR.SpThe value should be the complete \s-1TAP\s0 output..IP "\(bu" 4\&\f(CW\*(C`exec\*(C'\fR.SpIf passed an array reference, will attempt to create the iterator bypassing a TAP::Parser::Source object toTAP::Parser::Iterator::Source, using the array reference strings asthe command arguments to IPC::Open3::open3:.Sp.Vb 1\& exec => [ \*(Aq/usr/bin/ruby\*(Aq, \*(Aqt/my_test.rb\*(Aq ].Ve.SpNote that \f(CW\*(C`source\*(C'\fR and \f(CW\*(C`exec\*(C'\fR are mutually exclusive..PPThe following keys are optional..IP "\(bu" 4\&\f(CW\*(C`callback\*(C'\fR.SpIf present, each callback corresponding to a given result type will be calledwith the result as the argument if the \f(CW\*(C`run\*(C'\fR method is used:.Sp.Vb 7\& my %callbacks = (\&     test    => \e&test_callback,\&     plan    => \e&plan_callback,\&     comment => \e&comment_callback,\&     bailout => \e&bailout_callback,\&     unknown => \e&unknown_callback,\& );\&\& my $aggregator = TAP::Parser::Aggregator\->new;\& foreach my $file ( @test_files ) {\&     my $parser = TAP::Parser\->new(\&         {\&             source    => $file,\&             callbacks => \e%callbacks,\&         }\&     );\&     $parser\->run;\&     $aggregator\->add( $file, $parser );\& }.Ve.IP "\(bu" 4\&\f(CW\*(C`switches\*(C'\fR.SpIf using a Perl file as a source, optional switches may be passed which willbe used when invoking the perl executable..Sp.Vb 4\& my $parser = TAP::Parser\->new( {\&     source   => $test_file,\&     switches => \*(Aq\-Ilib\*(Aq,\& } );.Ve.IP "\(bu" 4\&\f(CW\*(C`test_args\*(C'\fR.SpUsed in conjunction with the \f(CW\*(C`source\*(C'\fR option to supply a reference toan \f(CW@ARGV\fR style array of arguments to pass to the test program..IP "\(bu" 4\&\f(CW\*(C`spool\*(C'\fR.SpIf passed a filehandle will write a copy of all parsed \s-1TAP\s0 to that handle..IP "\(bu" 4\&\f(CW\*(C`merge\*(C'\fR.SpIf false, \s-1STDERR\s0 is not captured (though it is 'relayed' to keep itsomewhat synchronized with \s-1STDOUT\s0.).SpIf true, \s-1STDERR\s0 and \s-1STDOUT\s0 are the same filehandle.  This may causebreakage if \s-1STDERR\s0 contains anything resembling \s-1TAP\s0 format, but doesallow exact synchronization..SpSubtleties of this behavior may be platform-dependent and may change inthe future..Sh "Instance Methods".IX Subsection "Instance Methods"\fI\f(CI\*(C`next\*(C'\fI\fR.IX Subsection "next".PP.Vb 4\&  my $parser = TAP::Parser\->new( { source => $file } );\&  while ( my $result = $parser\->next ) {\&      print $result\->as_string, "\en";\&  }.Ve.PPThis method returns the results of the parsing, one result at a time.  Notethat it is destructive.  You can't rewind and examine previous results..PPIf callbacks are used, they will be issued before this call returns..PPEach result returned is a subclass of TAP::Parser::Result.  See thatmodule and related classes for more information on how to use them..PP\fI\f(CI\*(C`run\*(C'\fI\fR.IX Subsection "run".PP.Vb 1\&  $parser\->run;.Ve.PPThis method merely runs the parser and parses all of the \s-1TAP\s0..SH "INDIVIDUAL RESULTS".IX Header "INDIVIDUAL RESULTS"If you've read this far in the docs, you've seen this:.PP.Vb 3\&    while ( my $result = $parser\->next ) {\&        print $result\->as_string;\&    }.Ve.PPEach result returned is a TAP::Parser::Result subclass, referred to as\&\fIresult types\fR..Sh "Result types".IX Subsection "Result types"Basically, you fetch individual results from the \s-1TAP\s0.  The six types, withexamples of each, are as follows:.IP "\(bu" 4Version.Sp.Vb 1\& TAP version 12.Ve.IP "\(bu" 4Plan.Sp.Vb 1\& 1..42.Ve.IP "\(bu" 4Test.Sp.Vb 1\& ok 3 \- We should start with some foobar!.Ve.IP "\(bu" 4Comment.Sp.Vb 1\& # Hope we don\*(Aqt use up the foobar..Ve.IP "\(bu" 4Bailout.Sp.Vb 1\& Bail out!  We ran out of foobar!.Ve.IP "\(bu" 4Unknown.Sp.Vb 1\& ... yo, this ain\*(Aqt TAP! ....Ve.PPEach result fetched is a result object of a different type.  There are commonmethods to each result object and different types may have methods unique totheir type.  Sometimes a type method may be overridden in a subclass, but itsuse is guaranteed to be identical..Sh "Common type methods".IX Subsection "Common type methods"\fI\f(CI\*(C`type\*(C'\fI\fR.IX Subsection "type".PPReturns the type of result, such as \f(CW\*(C`comment\*(C'\fR or \f(CW\*(C`test\*(C'\fR..PP\fI\f(CI\*(C`as_string\*(C'\fI\fR.IX Subsection "as_string".PPPrints a string representation of the token.  This might not be the exactoutput, however.  Tests will have test numbers added if not present, \s-1TODO\s0 and\&\s-1SKIP\s0 directives will be capitalized and, in general, things will be cleanedup.  If you need the original text for the token, see the \f(CW\*(C`raw\*(C'\fR method..PP\fI\f(CI\*(C`raw\*(C'\fI\fR.IX Subsection "raw".PPReturns the original line of text which was parsed..PP\fI\f(CI\*(C`is_plan\*(C'\fI\fR.IX Subsection "is_plan".PPIndicates whether or not this is the test plan line..PP\fI\f(CI\*(C`is_test\*(C'\fI\fR.IX Subsection "is_test".PPIndicates whether or not this is a test line..PP\fI\f(CI\*(C`is_comment\*(C'\fI\fR.IX Subsection "is_comment".PPIndicates whether or not this is a comment. Comments will generally onlyappear in the \s-1TAP\s0 stream if \s-1STDERR\s0 is merged to \s-1STDOUT\s0. See the\&\f(CW\*(C`merge\*(C'\fR option.

⌨️ 快捷键说明

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