>>>>> "A" == A Pagaltzis <[EMAIL PROTECTED]> writes:

A> could you please give an answer to these questions?

See, that's the problem when I try to take a weekend off, like normal
people. :)

First, I hate ::Simple.  On any module.  If the interface was so
complicated that it needed a "simple" thing that doesn't describe how
it's simpler, then the designer failed.

So let's look at the problem:

Every hit requires four steps, not three.  There's a bit of a misdesign,
which is affecting the proper refactoring:

1) map incoming to state
2) map state to a respond class
3) invoke responder, getting render class
4) invoke renderer

Right now CGIP->dispatch does the first two.  The difference between
Hidden Fields and Pathinfo is only in step 1 though.

So, I propose a refactoring of CGIP so that CGIP->dispatch calls
CGIP->get_state, taking the results of that to call CGIP->get_class,
which then is returned as the result of CGIP->dispatch.  This keeps
the top-level unchanged, and permits backward compatibility.

Then, I wanna refactor the current Hidden into its pieces:

a mixin for ->get_state (call it CGI::Prototype::State::Hidden)
  - uses the hidden param to get a state name, or a default state
a mixin for ->get_class (call it CGI::Prototype::Mapper::Prefix)
  - uses the state name with a prefix and does an autoload
a mixin for ->render_enter and ->engine_params (call it 
CGI::Prototype::Render::TT::Wrapper)
  - uses a TT search path = @INC and defines a wrapper

And release those parts all as separate distros, although maybe just
bundled initially.  The current "CGI::Prototype::Hidden" would then
be backward compatible, again.

The mixins would be added individually as:

    package My::App;
    use base CGI::Prototype;
    __PACKAGE__->reflect->addSlots(
       '*' => 'CGI::Prototype::State::Hidden',
       '*' => 'CGI::Prototype::Mapper::Prefix',
       '*' => 'CGI::Prototype::Render::TTWrapper',
    );

    ## other subs for My::App;

    1;

And in fact, the current CGI::Prototype::Hidden would be a pm with
just this in it, to be backward compatible.

Other mixins:

  CGI::Prototype::State::Pathinfo (yours)
  CGI::Prototype::Mapper::StrictLookup (yours)
  CGI::Prototype::Render::HTMLTemplate::* (for people that prefer H::T)

I'm not attached to the ::Mapper::* name.  Just making these up as I go.

How does this grab ya?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
cgi-prototype-users mailing list
cgi-prototype-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users

Reply via email to