IO::Capture

IO::Capture is an abstract base Perl class to build modules to capture output.
Download

IO::Capture Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mark Reynolds and Jon Morgan
  • Publisher web site:
  • http://search.cpan.org/~reynolds/IO-Capture-0.05/lib/IO/Capture.pm

IO::Capture Tags


IO::Capture Description

IO::Capture is an abstract base Perl class to build modules to capture output. IO::Capture is an abstract base Perl class to build modules to capture output.The IO::Capture Module defines an abstract base class that can be used to build modules that capture output being sent on a filehandle such as STDOUT or STDERR.Several modules that come with the distribution do just that. I.e., Capture STDOUT and STDERR. Also see James Keenan's IO::Capture::Stdout::Extended on CPAN.See IO::Capture::Overview for a discussion of these modules and examples of how to build a module to sub-class from IO::Capture yourself. If after reading the overview, you would like to build a class from IO::Capture, look here for details on the internals.METHODSThese are the methods defined in the IO::Capture Module. This page will be discussing the module from the point of view of someone who wants to build a sub-class of IO::Capture.Each method defined in the IO::Capture Module defines a public method, that then calls one or more private methods. (Names starting with an underscore) This allows you to override methods at a finer level of granularity, re-using as much of the functionality provided in the module as possible.Of these internal methods, three are abstract methods that your will have to override if you want your module to do anything. The three are _start(), _retrieve_captured_text(). and _stop().Below are the public methods with the private methods that each uses immediately following.newThe new method creates a new IO::Capture object, and returns it to its caller. The object is implemented with a hash. Each key used by IO::Capture is named with the class name. I.e., 'IO::Capture::< key_name >'. This is to prevent name clashes with keys added by sub-class authors. Attributes can be set in the object by passing a hash reference as a single argument to new(). my $capture = IO::Capture->new( { Key => 'value' } );All elements from this hash will be added to the object, and will be available for use by children of IO::Capture. my $key = $self->{'Key'};The internal methods used are:_initialize()_initialize is called as soon as the empty object has been blessed. It adds the structure to the object that it will need. The IO::Capture module adds the following IO::Capture::messages => [] IO::Capture::line_pointer => 1 IO::Capture::status => 'Ready', # Busy when capturingstartThe start method is responsible for saving the current state of the filehandle and or signal hander, and starting the data capture.Start cannot be called if there is already a capture in progress. The stop must be called first. Requirements: · Perl


IO::Capture Related Software