[cgiapp] Patch for cgi-app __get_body
    Lyle 
    webmaster at cosmicperl.com
       
    Wed Mar 17 19:06:00 EDT 2010
    
    
  
Hi All,
  I've found myself overloading this method so that cgi-app runmodes can 
be chained objects, such as $c->obj->method();
I've updated the code* so that it shouldn't effect the way everyone is 
currently doing runmodes:-
Basically, the lines:-
    my $body;
    eval {
        $body = $is_autoload ? $self->$rmeth($rm) : $self->$rmeth();
    };
Are swapped for:-
    if(ref($rmeth) ne 'ARRAY'){
        $rmeth=[$rmeth];
    }
    my $body=$self;
    eval {
        for my $part(@$rmeth){
            $body=$body->$part($is_autoload ? $rm : ());
        }
    };
So if the runmode is passed in as an array reference then the methods 
are chained one after the other. Potentially this allows for any depth, 
so a runmode may refer to:-
$c->obj1->obj2->obj3->method(), etc, where objX are just methods that 
return objects.
Rather than just submitting a patch direct to Mark, I thought I'd post 
it here to check that this wouldn't create any problems for anyone.
Lyle
* Actually it was Peter Haworth when I was showing him my work at the 
latest Perl meet.
    
    
More information about the cgiapp
mailing list