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

[cgiapp] Re: Fwd: Re: [cgiapp] Re: CGI::App 3.2 proposed release available


On 2003-11-25, Darin McBride <suppressed> wrote:
>
> I'll go with option #4.  Best of all worlds.  ;->
>
> my $body = $self->execute_run_mode($rm, $rmeth, $autoload_mode);
>
> [...]
>
> sub execute_run_mode
> {
>    my ($self, $rm, $rmeth, $autoload_mode) = @_;
>    my $body;
>    if ($self->can($rmeth)) {
>      $body = $autoload_mode ? $self->$rmeth($rm) : $self->$rmeth();
>    }
>    else {
>      $body = eval { $autoload_mode ? $self->$rmeth($rm) : $self->$rmeth(); }
>      die "Error executing run mode '$rm': $@" if $@;
>    }
>    $body;
> }
>
>
> In your application, simply override execute_run_mode:
>
> sub execute_run_mode
> {
>    my ($self, $rm, $rmeth, $autoload_mode) = @_;
>    $autoload_mode ? $self->$rmeth($rm) : $self->$rmeth();
> }

I don't like this as well as #2, because like #3, it means adding
another public interface method to C::A. I'm not opposed to that, just
persistent-- I think part of the elegance of CGI::App is that it's fairly
simple to learn and use.

I believe with #2, people can still use the standard techniques for
overriding "die". I don't think we need to re-invent that concept in
CGI::App. 

At least, I'd rather start out with a simpler solution now and see how
it serves us for a while. It's a lot easier to /add/ visible
functionality to a module than it is to remove a bad decision later that
some people may depending on the API for.
	
	Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   suppressed     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
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.