[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] feedback on ::Plugin::ConfigAuto update (a use for register_hook?)


Over the weekend I got a chance to look this code over and give it some thought. Here is what I came up with in no particular order.

* I think a means of automatically creating pre and post callback hooks for any run mode would be a nice touch.

* Shouldn't the add_callback method check that a code reference is being passed in?

* The call_hook method may be better named run_callbacks,

* I think the error handling of callbacks could be more graceful and refined. If the callback mechanism is being used for outside extensibility, I don't think an app should just die if an error occurs. I'm partial to Class::ErrorHandler as a rather graceful means catching an error and handling it in a user-friendly way.

* Also I think the hook processor should have the option of monitoring the return value if it so choose. One example is a callback hook that acts like a filter where any callback returning a false value would cause some step to be skipped.

Hope that helps.

<tim/>

On Oct 26, 2004, at 11:06 AM, Cees Hek wrote:

On Sun, 24 Oct 2004 15:02:02 +1300, Dan Horne <suppressed> wrote:
I think I'm leaning towards the second option, and pushing along
register_hooks() finally. :)

Cees, did you want to update your patch some or did you want some help with
that?

OK, I've thrown together a subclass of CGI::Application that
implements the callback support called CGI::Application::Callbacks
(very imaginative aren't I).  It has a rudimentary test enviroment but
will need some more testing.   I've had to copy the 'run' and 'new'
methods completely out of CGI::Application, which is a little bit
anoying, but it was the only way...

I would rather see these features added into CGI::Application itself,
but for now, at least people can play with it a little to see if it is
useful.  There was some talk earlier about using Class::Trigger to
implement this, and it might be worthwhile to look at that at some
point (any takers?)

Comments/criticism as always are welcome.

http://cees.crtconsulting.ca/perl/modules/CGI-Application-Callbacks -0.01.tar.gz

--
Cees Hek

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.