Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

action whose name started with underscore

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


i at h2l

Nov 14, 2011, 12:20 AM

Post #1 of 4 (219 views)
Permalink
action whose name started with underscore

Hello,

I defined some actions in controller for inner forwarding purpose.
To make the purpose clearly, I named them starting an underscore.

----------
package MyApp::Controller::Root;

sub foo : Local {
# blahblahblah
$c->forward('_bar');
}

sub _bar : Private { #blahblahblah }
----------

in this way, I can't trace the forwarding in debug mode witch supposed
to be something like

----------
| /foo
| -> /_bar <- this line doesn't exists
----------

Actually, the forwarding works as expected inside.
Is it a implicit rule, or does an action starting with underscore mean
something special?

Thanks.
--
islue

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


moonbuzz at gmail

Nov 14, 2011, 12:50 AM

Post #2 of 4 (210 views)
Permalink
Re: action whose name started with underscore [In reply to]

Have you tried the same thing without the underscore but with :Private?

On 14 November 2011 10:20, Hu Hailin <i [at] h2l> wrote:
> Hello,
>
> I defined some actions in controller for inner forwarding purpose.
> To make the purpose clearly, I named them starting an underscore.
>
> ----------
> package MyApp::Controller::Root;
>
> sub foo : Local {
>  # blahblahblah
>  $c->forward('_bar');
> }
>
> sub _bar : Private { #blahblahblah }
> ----------
>
> in this way, I can't trace the forwarding in debug mode witch supposed
> to be something like
>
> ----------
> | /foo
> |  -> /_bar   <- this line doesn't exists
> ----------
>
> Actually, the forwarding works as expected inside.
> Is it a implicit rule, or does an action starting with underscore mean
> something special?
>
> Thanks.
> --
> islue
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>



--
Erez

Stop software patents

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Nov 14, 2011, 1:17 AM

Post #3 of 4 (202 views)
Permalink
Re: action whose name started with underscore [In reply to]

On 14 Nov 2011, at 08:20, Hu Hailin wrote:
> I defined some actions in controller for inner forwarding purpose.
> To make the purpose clearly, I named them starting an underscore.

You explicitly made those actions private, so they didn't get shown.

http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.90006/lib/Catalyst.pm#INTERNAL_ACTIONS

But generally, if it needs to be _that_ private - why make it an
action at all?

Why not just call $self->_private_method($c); ?

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


i at h2l

Nov 14, 2011, 2:19 AM

Post #4 of 4 (200 views)
Permalink
Re: action whose name started with underscore [In reply to]

Erez,

Yes, I tried. And it is shown.

t0m,

Got it. Thank you very much.

On Mon, Nov 14, 2011 at 6:17 PM, Tomas Doran <bobtfish [at] bobtfish> wrote:
>
> On 14 Nov 2011, at 08:20, Hu Hailin wrote:
>>
>> I defined some actions in controller for inner forwarding purpose.
>> To make the purpose clearly, I named them starting an underscore.
>
> You explicitly made those actions private, so they didn't get shown.
>
> http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.90006/lib/Catalyst.pm#INTERNAL_ACTIONS
>
> But generally, if it needs to be _that_ private - why make it an action at
> all?
>
> Why not just call $self->_private_method($c); ?
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>



--
islue

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.