GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  POE::COMPONENT::PLUGGABLE::PIPELINE (3)

.ds Aq ’

NAME

POE::Component::Pluggable::Pipeline - the plugin pipeline for POE::Component::Pluggable.

CONTENTS

SYNOPSIS



  use POE qw( Component::Pluggable );
  use POE::Component::Pluggable::Pipeline;
  use My::Plugin;

  my $self = POE::Component::Pluggable->new();

  # the following operations are presented in pairs
  # the first is the general procedure, the second is
  # the specific way using the pipeline directly

  # to install a plugin
  $self->plugin_add(mine => My::Plugin->new);
  $self->pipeline->push(mine => My::Plugin->new); 

  # to remove a plugin
  $self->plugin_del(mine);        # or the object
  $self->pipeline->remove(mine);  # or the object

  # to get a plugin
  my $plug = $self->plugin_get(mine);
  my $plug = $self->pipeline->get(mine);

  # there are other very specific operations that
  # the pipeline offers, demonstrated here:

  # to get the pipeline object itself
  my $pipe = $self->pipeline;

  # to install a plugin at the front of the pipeline
  $pipe->unshift(mine => My::Plugin->new);

  # to remove the plugin at the end of the pipeline
  my $plug = $pipe->pop;

  # to remove the plugin at the front of the pipeline
  my $plug = $pipe->shift;

  # to replace a plugin with another
  $pipe->replace(mine => newmine => My::Plugin->new);

  # to insert a plugin before another
  $pipe->insert_before(mine => newmine => My::Plugin->new);

  # to insert a plugin after another
  $pipe->insert_after(mine => newmine => My::Plugin->new);

  # to get the location in the pipeline of a plugin
  my $index = $pipe->get_index(mine);

  # to move a plugin closer to the front of the pipeline
  $pipe->bump_up(mine);

  # to move a plugin closer to the end of the pipeline
  $pipe->bump_down(mine);



DESCRIPTION

POE::Component::Pluggable::Pipeline defines the Plugin pipeline system for POE::Component::Pluggable instances.

METHODS

CWnew

Takes one argument, the POE::Component::Pluggable object to attach to.

CWpush

Takes two arguments, an alias for a plugin and the plugin object itself. If a plugin with that alias already exists, $@ will be set and undef will be returned. Otherwise, it adds the plugin to the end of the pipeline and registers it. This will yield a plugin_add event. If successful, it returns the size of the pipeline.



 my $new_size = $pipe->push($name, $plug);



CWunshift

Takes two arguments, an alias for a plugin and the plugin object itself. If a plugin with that alias already exists, $@ will be set and undef will be returned. Otherwise, it adds the plugin to the beginning of the pipeline and registers it. This will yield a plugin_add event. If successful, it returns the size of the pipeline.



 my $new_size = $pipe->push($name, $plug);



CWshift

Takes no arguments. The first plugin in the pipeline is removed. This will yield a plugin_del event. In list context, it returns the plugin and its alias; in scalar context, it returns only the plugin. If there were no elements, an empty list or undef will be returned.



 my ($plug, $name) = $pipe->shift;
 my $plug = $pipe->shift;



CWpop

Takes no arguments. The last plugin in the pipeline is removed. This will yield an plugin_del event. In list context, it returns the plugin and its alias; in scalar context, it returns only the plugin. If there were no elements, an empty list or undef will be returned.



 my ($plug, $name) = $pipe->pop;
 my $plug = $pipe->pop;



CWreplace

Take three arguments, the old plugin or its alias, an alias for the new plugin and the new plugin object itself. If the old plugin doesn’t exist, or if there is already a plugin with the new alias (besides the old plugin), $@ will be set and undef will be returned. Otherwise, it removes the old plugin (yielding an plugin_del event) and replaces it with the new plugin. This will yield an plugin_add event. If successful, it returns 1.



 my $success = $pipe->replace($name, $new_name, $new_plug);
 my $success = $pipe->replace($plug, $new_name, $new_plug);



CWinsert_before

Takes three arguments, the plugin that is relative to the operation, an alias for the new plugin and the new plugin object itself. If the first plugin doesn’t exist, or if there is already a plugin with the new alias, $@ will be set and undef will be returned. Otherwise, the new plugin is placed just prior to the other plugin in the pipeline. If successful, it returns 1.



 my $success = $pipe->insert_before($name, $new_name, $new_plug);
 my $success = $pipe->insert_before($plug, $new_name, $new_plug);



CWinsert_after

Takes three arguments, the plugin that is relative to the operation, an alias for the new plugin and the new plugin object itself. If the first plugin doesn’t exist, or if there is already a plugin with the new alias, $@ will be set and undef will be returned. Otherwise, the new plugin is placed just after to the other plugin in the pipeline. If successful, it returns 1.



 my $success = $pipe->insert_after($name, $new_name, $new_plug);
 my $success = $pipe->insert_after($plug, $new_name, $new_plug);



CWbump_up

Takes one or two arguments, the plugin or its alias, and the distance to bump the plugin. The distance defaults to 1. If the plugin doesn’t exist, $@ will be set and <B>-1 will be returned, not undefB>. Otherwise, the plugin will be moved the given distance closer to the front of the pipeline. A warning is issued alerting you if it would have been moved past the beginning of the pipeline, and the plugin is placed at the beginning. If successful, the new index of the plugin in the pipeline is returned.



 my $pos = $pipe->bump_up($name);
 my $pos = $pipe->bump_up($plug);
 my $pos = $pipe->bump_up($name, $delta);
 my $pos = $pipe->bump_up($plug, $delta);



CWbump_down

Takes one or two arguments, the plugin or its alias, and the distance to bump the plugin. The distance defaults to 1. If the plugin doesn’t exist, $@ will be set and <B>-1 will be returned, not B>undef<B>B>. Otherwise, the plugin will be moved the given distance closer to the end of the pipeline. A warning is issued alerting you if it would have been moved past the end of the pipeline, and the plugin is placed at the end. If successful, the new index of the plugin in the pipeline is returned.



 my $pos = $pipe->bump_down($name);
 my $pos = $pipe->bump_down($plug);
 my $pos = $pipe->bump_down($name, $delta);
 my $pos = $pipe->bump_down($plug, $delta);



CWremove

Takes one argument, a plugin or its alias. If the plugin doesn’t exist, $@ will be set and undef will be returned. Otherwise, the plugin is removed from the pipeline. This will yield an plugin_del event. In list context,it returns the plugin and its alias; in scalar context, it returns only the plugin.



 my ($plug, $name) = $pipe->remove($the_name);
 my ($plug, $name) = $pipe->remove($the_plug);
 my $plug = $pipe->remove($the_name);
 my $plug = $pipe->remove($the_plug);



CWget

Takes one argument, a plugin or its alias. If no such plugin exists, $@ will be set and undef will be returned. In list context, it returns the plugin and its alias; in scalar context, it returns only the plugin.



 my ($plug, $name) = $pipe->get($the_name);
 my ($plug, $name) = $pipe->get($the_plug);
 my $plug = $pipe->get($the_name);
 my $plug = $pipe->get($the_plug);



CWget_index

Takes one argument, a plugin or its alias. If no such plugin exists, $@ will be set and <B>-1 will be returned, not B>undef<B>B>. Otherwise, the index in the pipeline is returned.



 my $pos = $pipe->get_index($name);
 my $pos = $pipe->get_index($plug);



BUGS

None known so far.

AUTHOR

Jeff japhy Pinyan, japhy@perlmonk.org.

MAINTAINER

Chris BinGOs Williams, chris@bingosnet.co.uk.

SEE ALSO

POE::Component::IRC,

POE::Component::Pluggable.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 POE::COMPONENT::PLUGGABLE::PIPELINE (3) 2010-06-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.