[cgiapp] Patch for cgi-app __get_body

Lyle webmaster at cosmicperl.com
Fri Apr 2 12:11:22 EDT 2010


Bump, does anyone have objections to this? I can't see that it'll effect 
anyones code.


Lyle

Mark Stosberg wrote:
> Thanks for the idea, Lyle.
>
> I'd like to see what feedback others have before considering it further.
>
>    Mark
>
> On Wed, 17 Mar 2010 23:06:00 +0000
> Lyle <webmaster at cosmicperl.com> wrote:
>
>   
>> 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.
>>     
>
>
>   


More information about the cgiapp mailing list