TAP::Parser::IteratorFactory - Online Linux Manual PageSection : 3
Updated : 2022-01-21
Source : perl v5.34.0
Note : User Contributed Perl Documentation
NAMETAP::Parser::IteratorFactory − Figures out which SourceHandler objects to use for a given Source
VERSIONVersion 3.43
SYNOPSIS use TAP::Parser::IteratorFactory;
my $factory = TAP::Parser::IteratorFactory−>new({ %config });
my $iterator = $factory−>make_iterator( $filename );
DESCRIPTIONThis is a factory class that takes a TAP::Parser::Source and runs it through all the registered TAP::Parser::SourceHandlers to see which one should handle the source. If you're a plugin author, you'll be interested in how to ‟register_handler”s, how ‟detect_source” works.
METHODS
Class Methodsnew Creates a new factory class: my $sf = TAP::Parser::IteratorFactory−>new( $config );
$config is optional. If given, sets ‟config” and calls ‟load_handlers”. register_handler Registers a new TAP::Parser::SourceHandler with this factory. _ _PACKAGE_ _−>register_handler( $handler_class );
handlers List of handlers that have been registered.
Instance Methodsconfig my $cfg = $sf−>config;
$sf−>config({ Perl => { %config } });
Chaining getter/setter for the configuration of the available source handlers. This is a hashref keyed on handler class whose values contain config to be passed onto the handlers during detection & creation. Class names may be fully qualified or abbreviated, eg: # these are equivalent
$sf−>config({ 'TAP::Parser::SourceHandler::Perl' => { %config } });
$sf−>config({ 'Perl' => { %config } });
load_handlers $sf−>load_handlers;
Loads the handler classes defined in ‟config”. For example, given a config: $sf−>config({
MySourceHandler => { some => 'config' },
});
load_handlers will attempt to load the MySourceHandler class by looking in @INC for it in this order: TAP::Parser::SourceHandler::MySourceHandler
MySourceHandler
croaks on error. make_iterator my $iterator = $src_factory−>make_iterator( $source );
Given a TAP::Parser::Source, finds the most suitable TAP::Parser::SourceHandler to use to create a TAP::Parser::Iterator (see ‟detect_source”). Dies on error. detect_source Given a TAP::Parser::Source, detects what kind of source it is and returns one TAP::Parser::SourceHandler (the most confident one). Dies on error. The detection algorithm works something like this: for (@registered_handlers) {
# ask them how confident they are about handling this source
$confidence{$handler} = $handler−>can_handle( $source )
}
# choose the most confident handler
Ties are handled by choosing the first handler.
SUBCLASSINGPlease see ‟SUBCLASSING” in TAP::Parser for a subclassing overview.
ExampleIf we've done things right, you'll probably want to write a new source, rather than sub-classing this (see TAP::Parser::SourceHandler for that). But in case you find the need to... package MyIteratorFactory;
use strict;
use base 'TAP::Parser::IteratorFactory';
# override source detection algorithm
sub detect_source {
my ($self, $raw_source_ref, $meta) = @_;
# do detective work, using $meta and whatever else...
}
1;
AUTHORSSteve Purkis
ATTRIBUTIONOriginally ripped off from Test::Harness. Moved out of TAP::Parser & converted to a factory class to support extensible TAP source detective work by Steve Purkis.
SEE ALSOTAP::Object, TAP::Parser, TAP::Parser::SourceHandler, TAP::Parser::SourceHandler::File, TAP::Parser::SourceHandler::Perl, TAP::Parser::SourceHandler::RawTAP, TAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::Executable 0
Johanes Gumabo
Data Size : 16,269 byte
man-TAP::Parser::IteratorFactory.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 166,466
Visitor ID : :
Visitor IP : 3.143.7.53 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|TAP::Parser::IteratorFactory.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|TAP::Parser::IteratorFactory.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|TAP::Parser::IteratorFactory.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|TAP::Parser::IteratorFactory.3pm|43|'br══─}─══ |'br══─}─══
)