WWW::Mechanize::Pluggable

WWW::Mechanize::Pluggable provides all of the same functionality of WWW::Mechanize, but adds support for plugins.
Download

WWW::Mechanize::Pluggable Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Joe McMahon
  • Publisher web site:
  • http://search.cpan.org/~mcmahon/Class-AutoPlug-0.02/lib/Class/AutoPlug/Pluggable.pm

WWW::Mechanize::Pluggable Tags


WWW::Mechanize::Pluggable Description

WWW::Mechanize::Pluggable provides all of the same functionality of WWW::Mechanize, but adds support for plugins. WWW::Mechanize::Pluggable provides all of the same functionality of WWW::Mechanize, but adds support for plugins using Module::Pluggable; this means that any module named WWW::Mechanize::Plugin::whatever... will be found and loaded when WWW::Mechanize::PlBig deal, you say. Well, it becomes a big deal in conjunction with WWW::Mechanize::Pluggable's other feature: plugin hooks. When plugins are loaded, their import() methods can call WWW::Mechanize::Pluggable's prehook and posthook methods. These methods add callbacks to the plugin code in WWW::Mechanize::Pluggable's methods. These callbacks can act before a method or after it, and have to option of short-circuiting the call to the WWW::Mechanize::Pluggable method altogether.These methods receive whatever parameters the WWW::Mechanize::Pluggable methods received, plus a reference to the actvive Mech object.All other extensions to WWW::Mechanize::Pluggable are handled by the plugins.SUBCLASSINGSubclassing this class is not recommended; partly because the method redispatch we need to do internally doesn't play well with the standard Perl OO model, and partly because you should be using plugins and hooks instead.In WWW::Mechanize, it is recommended that you extend functionality by subclassing WWW::Mechanize, because there's no other way to extend the class. With Module::Pluggable support, it is easy to load another method directly into WWW::Mechanize::Pluggable's namespace; it then appears as if it had always been there. In addition, the pre_hook() and post_hook() methods provide a way to intercept a call and replace it with your output, or to tack on further processing at the end of a standard method (or even a plugin!).The advantage of this is in not having a large number of subclasses, all of which add or alter WWW::Mechanize's function, and all of which have to be loaded if you want them available in your code. With WWW::Mechanize::Pluggable, one simply installs the desired plugins and they are all automatically available when you use WWW::Mechanize::Pluggable.Configuration is a possible problem area; if three different plugins all attempt to replace get(), only one will win. It's better to create more sophisticated methods that call on lower-level ones than to alter existing known behavior. Requirements: · Perl


WWW::Mechanize::Pluggable Related Software