App-SimpleScan

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

  Basic callbacks
   init
    The "init" class method is called by "App:SimpleScan" when the plugin
    class is loaded; the "App::SimpleScan" object is suppled to allow the
    plugin to alter or add to the contents of the object. This allows
    plugins to export methods to the base class, or to add instance
    variables dynamically.

    Note that the class passed in to this method is the class of the
    *plugin*, not of the caller ("App::SimpleScan" or a derived class). You
    should use caller() if you wish to export subroutines into the package
    corresponding to the base class object.

   pragmas
    Defines any pragmas that this plugin implements. Returns a list of names
    and subroutine references. These will be called with a reference to the
    "App::SimpleScan" object.

   filters
    Defines any code filters that this plugin wants to add to the output
    filter queue. These methods are called with a copy of the

lib/App/SimpleScan.pm  view on Meta::CPAN

=head3 init

The C<init> class method is called by C<App:SimpleScan>
when the plugin class is loaded; the C<App::SimpleScan>
object is suppled to allow the plugin to alter or add to the
contents of the object. This allows plugins to export methods
to the base class, or to add instance variables dynamically.

Note that the class passed in to this method is the class
of the I<plugin>, not of the caller (C<App::SimpleScan>
or a derived class). You should use C<caller()> if you wish
to export subroutines into the package corresponding to the
base class object.

=head3 pragmas

Defines any pragmas that this plugin implements. Returns a
list of names and subroutine references. These will be called
with a reference to the C<App::SimpleScan> object.

=head3 filters

lib/App/SimpleScan/Cookbook.pm  view on Meta::CPAN

  ...

=head2 Installing new command-line options

Create an C<options> method in your plugin that returns a hash of options and
variables to capture their values in. You will also want to export accessors
for these variables to the C<App::SimpleScan> namespace in your C<import>.

  sub import {
    no strict 'refs';
    *{caller() . '::myoption} = \&myoption;
  }

  sub options {
    return ('myoption' => \$myoption);
  }

  sub myoption {
    my ($self, $value) = @_;
    $myoption = $value if defined $value;
    $myoption;

t/App/SimpleScan/Plugin/TestExpand.pm  view on Meta::CPAN


use warnings;
use strict;
use Carp;
use File::Path;

my($test_expand);

sub import {
  no strict 'refs';
  *{caller() . '::test_expand'}  = \&test_expand;
}

sub filters {
  return \&filter;
}

sub init {
  my ($class, $app) = @_;
  no strict 'refs';
  *{caller() . '::expander'} = \&test_expand;
  $app->{Expander} = "ping!";
}

sub test_expand {
  my($self, $value) = @_;
  $test_expand = $value if defined $value;
  $test_expand;
}

sub options {

t/App/SimpleScan/Plugin/TestNextLine.pm  view on Meta::CPAN


use warnings;
use strict;
use Carp;
use File::Path;

my($test_nextline);

sub import {
  no strict 'refs';
  *{caller() . '::test_nextline'}  = \&test_nextline;
}

sub init {
  my ($class, $app) = @_;
  no strict 'refs';
  my $callbacks_ref = $app->next_line_callbacks();
  push @{ $callbacks_ref }, \&demo_callback;
  $app->next_line_callbacks($callbacks_ref);
  $app->{demo_called} = 0;
}



( run in 0.532 second using v1.01-cache-2.11-cpan-cc502c75498 )