TAP::Parser::Iterator(3p) Perl Programmers Reference Guide

TAP::Parser::Iterator(3p) Perl Programmers Reference Guide #

TAP::Parser::Iterator(3p) Perl Programmers Reference Guide

NNAAMMEE #

 TAP::Parser::Iterator - Base class for TAP source iterators

VVEERRSSIIOONN #

 Version 3.44

SSYYNNOOPPSSIISS #

   # to subclass:
   use TAP::Parser::Iterator ();
   use base 'TAP::Parser::Iterator';
   sub _initialize {
     # see TAP::Object...
   }

   sub next_raw { ... }
   sub wait     { ... }
   sub exit     { ... }

DDEESSCCRRIIPPTTIIOONN #

 This is a simple iterator base class that defines TAP::Parser's iterator
 API.  Iterators are typically created from TAP::Parser::SourceHandlers.

MMEETTHHOODDSS #

CCllaassss MMeetthhooddss _"_n_e_w_"

 Create an iterator.  Provided by TAP::Object.

IInnssttaannccee MMeetthhooddss _"_n_e_x_t_"

  while ( my $item = $iter->next ) { ... }

 Iterate through it, of course.

 _"_n_e_x_t___r_a_w_"

 NNoottee:: this method is abstract and should be overridden.

  while ( my $item = $iter->next_raw ) { ... }

 Iterate raw input without applying any fixes for quirky input syntax.

 _"_h_a_n_d_l_e___u_n_i_c_o_d_e_"

 If necessary switch the input stream to handle unicode. This only has any
 effect for I/O handle based streams.

 The default implementation does nothing.

 _"_g_e_t___s_e_l_e_c_t___h_a_n_d_l_e_s_"

 Return a list of filehandles that may be used upstream in a sseelleecctt(()) call
 to signal that this Iterator is ready. Iterators that are not handle-
 based should return an empty list.

 The default implementation does nothing.

 _"_w_a_i_t_"

 NNoottee:: this method is abstract and should be overridden.

  my $wait_status = $iter->wait;

 Return the "wait" status for this iterator.

 _"_e_x_i_t_"

 NNoottee:: this method is abstract and should be overridden.

  my $wait_status = $iter->exit;

 Return the "exit" status for this iterator.

SSUUBBCCLLAASSSSIINNGG #

 Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.

 You must override the abstract methods as noted above.

EExxaammppllee TAP::Parser::Iterator::Array is probably the easiest example to follow. There’s not much point repeating it here.

SSEEEE AALLSSOO #

 TAP::Object, TAP::Parser, TAP::Parser::Iterator::Array,
 TAP::Parser::Iterator::Stream, TAP::Parser::Iterator::Process,

perl v5.36.3 2023-02-15 TAP::Parser::Iterator(3p)