Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

LEGO::NXT::Manual::Plugins
Using and creating plugins for LEGO::NXT.

LEGO::NXT::Manual::Plugins - Using and creating plugins for LEGO::NXT.


NAME

LEGO::NXT::Manual::Plugins - Using and creating plugins for LEGO::NXT.


OVERVIEW

Plugins are useful for when you are writing a script and you need to add some extra functionality to your the LEGO::NXT manpage object.

The plugin system for the LEGO::NXT manpage is very simplistic and relys completely on Perl's OO design. The syntax of loading a plugin was inspired by the DBIx::Class manpage.

To use a plugin all you have to do is pass the plugin's name, minus the LEGO::NXT:: bit, to the use statment. So, for example, if you wanted to use the LEGO::NXT::Scorpion plugin you would:


  use LEGO::NXT qw( Scorpion );

This then extends the LEGO::NXT class to have all of the methods of the LEGO::NXT::Scorpion class.


CURRENT PLUGINS

None at the moment!


WRITING PLUGINS

Writing your own plugin is very simple. Just write a standard perl class, there are no requirements. Likely you will want to ``use base(LEGO::NXT);'' and/or one of the existing plugins.

A good way to get started is to look at the source of an existing plugin.


SUBCLASSING

Rather than using the plugin system you could instead subclass LEGO::NXT and whatever other modules you want. This gives you the ability to add your own custom methods to the LEGO::NXT object that apply only to your particular situation.


  package MyNXT;

  

  use base qw( LEGO::NXT LEGO::NXT::Scorpion );

  use LEGO::NXT::Constants;

  

  ...

  1;

Then in your script:


  use MyNXT;

  my $nxt = MyNXT->new();


AUTHOR

Aran Deltac <bluefeet@cpan.org>

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy