| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package TAP::Parser::SourceHandler; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 38 |  |  | 38 |  | 2329 | use strict; | 
|  | 38 |  |  |  |  | 62 |  | 
|  | 38 |  |  |  |  | 1048 |  | 
| 4 | 38 |  |  | 38 |  | 128 | use warnings; | 
|  | 38 |  |  |  |  | 53 |  | 
|  | 38 |  |  |  |  | 782 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 38 |  |  | 38 |  | 503 | use TAP::Parser::Iterator (); | 
|  | 38 |  |  |  |  | 44 |  | 
|  | 38 |  |  |  |  | 499 |  | 
| 7 | 38 |  |  | 38 |  | 113 | use base 'TAP::Object'; | 
|  | 38 |  |  |  |  | 48 |  | 
|  | 38 |  |  |  |  | 6053 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 NAME | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | TAP::Parser::SourceHandler - Base class for different TAP source handlers | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 VERSION | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | Version 3.38 | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =cut | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | our $VERSION = '3.38'; | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | # abstract class - don't use directly! | 
| 24 |  |  |  |  |  |  | # see TAP::Parser::IteratorFactory for general usage | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | # must be sub-classed for use | 
| 27 |  |  |  |  |  |  | package MySourceHandler; | 
| 28 |  |  |  |  |  |  | use base 'TAP::Parser::SourceHandler'; | 
| 29 |  |  |  |  |  |  | sub can_handle    { return $confidence_level } | 
| 30 |  |  |  |  |  |  | sub make_iterator { return $iterator } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | # see example below for more details | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | This is an abstract base class for L handlers / handlers. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | A C does whatever is necessary to produce & capture | 
| 39 |  |  |  |  |  |  | a stream of TAP from the I source, and package it up in a | 
| 40 |  |  |  |  |  |  | L for the parser to consume. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | C must implement the I interface | 
| 43 |  |  |  |  |  |  | used by L.  At 2 methods, the interface is pretty | 
| 44 |  |  |  |  |  |  | simple: L and L. | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Unless you're writing a new L, a plugin, or | 
| 47 |  |  |  |  |  |  | subclassing L, you probably won't need to use this module directly. | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 METHODS | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =head2 Class Methods | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =head3 C | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | I. | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | my $vote = $class->can_handle( $source ); | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | C<$source> is a L. | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | Returns a number between C<0> & C<1> reflecting how confidently the raw source | 
| 62 |  |  |  |  |  |  | can be handled.  For example, C<0> means the source cannot handle it, C<0.5> | 
| 63 |  |  |  |  |  |  | means it may be able to, and C<1> means it definitely can.  See | 
| 64 |  |  |  |  |  |  | L for details on how this is used. | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =cut | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | sub can_handle { | 
| 69 | 1 |  |  | 1 | 1 | 390 | my ( $class, $args ) = @_; | 
| 70 | 1 |  |  |  |  | 8 | $class->_croak( | 
| 71 |  |  |  |  |  |  | "Abstract method 'can_handle' not implemented for $class!"); | 
| 72 | 0 |  |  |  |  | 0 | return; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head3 C | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | I. | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | my $iterator = $class->make_iterator( $source ); | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | C<$source> is a L. | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | Returns a new L object for use by the L. | 
| 84 |  |  |  |  |  |  | Cs on error. | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =cut | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | sub make_iterator { | 
| 89 | 1 |  |  | 1 | 1 | 553 | my ( $class, $args ) = @_; | 
| 90 | 1 |  |  |  |  | 7 | $class->_croak( | 
| 91 |  |  |  |  |  |  | "Abstract method 'make_iterator' not implemented for $class!"); | 
| 92 | 0 |  |  |  |  |  | return; | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  | 1; | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | __END__ |