Re: Fwd: Mech JS support

Eric Wilhelm <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
# from Father Chrysostomos
# on Wednesday 18 July 2007 10:26 pm:

>for everyone’s perusal.

I'm seeing this a lot.

+    $self->_extract_forms() unless $self->{_extracted_forms};

Given that it is a void-context and is a noop if _extracted_forms is 
false, why not just put 

  return unless $self->{_extracted_forms}

inside the _extract_forms() method?

Also, I would guess that separate init() and options() methods would be 
preferable in writing plugins rather than having init() handle options 
and self but options() gets just options.  Similarly, the init() call 
should get $self as the first parameter such as:

  my $plugin_init = "WWW::Mechanize::Plugin::$plugin" . '::init';
  $self->$plugin_init()

And similarly for $self->$plugin_options(@opts).

That is, unless the plugin is an object, which maybe it should be.  What 
do the plugin class-methods do for state storage?  They just throw keys 
into the $mech object?

It seems that you can have multiple plugins, but they overwrite 
callbacks as they're installed?

--Eric
-- 
So malloc calls a timeout and starts rummaging around the free chain,
sorting things out, and merging adjacent small free blocks into larger
blocks. This takes 3 1/2 days.
--Joel Spolsky
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.