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

Mailing List Archive: Catalyst: Users

auto method never triggered

 

 

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


julien at sobrier

Oct 30, 2009, 10:10 PM

Post #1 of 11 (1927 views)
Permalink
auto method never triggered

Hello,
I was trying to use auto and begin in 2 Controllers, Root.pm and Admin.pm:

package MyApp::Controller::Root;

sub begin :Private {
my ($self, $c) = @_;

$c->log->debug('root begin');
}

sub auto :Private {
my ($self, $c) = @_;

$c->log->debug('root auto');
}

[...]

package MyApp::Controller::Admin;

sub begin :Private {
my ($self, $c) = @_;

$c->log->debug('admin begin');
}

sub auto :Private {
my ($self, $c) = @_;

$c->log->debug('admin auto');
}


Whether I access / or /admin, I don't see any log from any of the auto
functions, but I do see it from the begin fuctions. I am wondering
what I am missing.

Thank you
Julien


moseley at hank

Oct 31, 2009, 7:17 AM

Post #2 of 11 (1830 views)
Permalink
Re: auto method never triggered [In reply to]

On Fri, Oct 30, 2009 at 10:10 PM, Julien Sobrier <julien [at] sobrier> wrote:

>
>
>
>
> Whether I access / or /admin, I don't see any log from any of the auto functions, but I do see it from the begin fuctions. I am wondering what I am missing.
>
> Looks ok, although I would explicitly return true in your auto methods.
And you didn't include your action methods in your example.

You are not seeing this (with added $c->req->uri shown)?


[debug] root begin
[debug] root auto: http://localhost:3000/


[debug] admin begin
[debug] root auto: http://localhost:3000/admin
[debug] admin auto




> Thank you
> Julien
>
>
> _______________________________________________
> 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/
>
>


--
Bill Moseley
moseley [at] hank


bobtfish at bobtfish

Oct 31, 2009, 7:42 AM

Post #3 of 11 (1833 views)
Permalink
Re: auto method never triggered [In reply to]

On 31 Oct 2009, at 05:10, Julien Sobrier wrote:
>
>
> Whether I access / or /admin, I don't see any log from any of the
> auto functions, but I do see it from the begin fuctions. I am
> wondering what I am missing.

Unsure.

Can you attach the debug log of your application startup and the
debug log generated when you hit /admin ?

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/


julien at sobrier

Oct 31, 2009, 10:00 AM

Post #4 of 11 (1825 views)
Permalink
Re: auto method never triggered [In reply to]

After adding an action, and return 1; in each auto and begin, it looks
better:

[info] *** Request 2 (0.000/s) [9579] [Sat Oct 31 09:58:48 2009] ***
[debug] "GET" request for "/" from "192.168.1.100"
[debug] Path is "/"
[debug] Found sessionid "e1262ec64fecc849f31af4e61fbb38cb66a414e9" in cookie
[debug] Restored session "e1262ec64fecc849f31af4e61fbb38cb66a414e9"
[debug] root begin: http://test.bargain-notify.me/
[debug] root auto: http://test.bargain-notify.me/
[debug] Rendering template "index.tt"
[info] Request took 0.077143s (12.963/s)
.------------------------------------------------------------+-----------.
| Action | Time |
+------------------------------------------------------------+-----------+
| /begin | 0.000410s |
| /auto | 0.000197s |
| /index | 0.008401s |
| -> /process_index | 0.001785s |
| /end | 0.048556s |
| -> Bargain::View::TT->process | 0.047238s |
'------------------------------------------------------------+-----------'


[info] *** Request 12 (0.000/s) [9579] [Sat Oct 31 09:59:51 2009] ***
[debug] "GET" request for "admin" from "192.168.1.100"
[debug] Path is "admin"
[debug] Found sessionid "e1262ec64fecc849f31af4e61fbb38cb66a414e9" in cookie
[debug] Restored session "e1262ec64fecc849f31af4e61fbb38cb66a414e9"
[debug] root begin: http://test.bargain-notify.me/admin
[debug] root auto: http://test.bargain-notify.me/admin
[debug] Role granted: Administrator
[debug] Rendering template "admin.tt"
[info] Request took 0.230871s (4.331/s)
.------------------------------------------------------------+-----------.
| Action | Time |
+------------------------------------------------------------+-----------+
| /begin | 0.000415s |
| /auto | 0.000198s |
| /admin | 0.032198s |
| /end | 0.179180s |
| -> Bargain::View::TT->process | 0.178188s |
'------------------------------------------------------------+-----------'


As you ca see, auto in Admin.pm does not fire.

Thank you for the help.

Julien


On Sat, Oct 31, 2009 at 7:42 AM, Tomas Doran <bobtfish [at] bobtfish> wrote:

>
> On 31 Oct 2009, at 05:10, Julien Sobrier wrote:
>
>>
>>
>> Whether I access / or /admin, I don't see any log from any of the auto
>> functions, but I do see it from the begin fuctions. I am wondering what I am
>> missing.
>>
>
> Unsure.
>
> Can you attach the debug log of your application startup and the debug log
> generated when you hit /admin ?
>
> 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/
>


julien at sobrier

Oct 31, 2009, 9:36 PM

Post #5 of 11 (1817 views)
Permalink
Re: auto method never triggered [In reply to]

BTW, both Root.pm and Admin.pm have this line:

__PACKAGE__->config->{namespace} = '';

Not sure if it makes a difference.

Julien

On Sat, Oct 31, 2009 at 10:00 AM, Julien Sobrier <julien [at] sobrier> wrote:

> After adding an action, and return 1; in each auto and begin, it looks
> better:
>
> [info] *** Request 2 (0.000/s) [9579] [Sat Oct 31 09:58:48 2009] ***
> [debug] "GET" request for "/" from "192.168.1.100"
> [debug] Path is "/"
> [debug] Found sessionid "e1262ec64fecc849f31af4e61fbb38cb66a414e9" in
> cookie
> [debug] Restored session "e1262ec64fecc849f31af4e61fbb38cb66a414e9"
> [debug] root begin: http://test.bargain-notify.me/
> [debug] root auto: http://test.bargain-notify.me/
> [debug] Rendering template "index.tt"
> [info] Request took 0.077143s (12.963/s)
> .------------------------------------------------------------+-----------.
> | Action | Time |
> +------------------------------------------------------------+-----------+
> | /begin | 0.000410s |
> | /auto | 0.000197s |
> | /index | 0.008401s |
> | -> /process_index | 0.001785s |
> | /end | 0.048556s |
> | -> Bargain::View::TT->process | 0.047238s |
> '------------------------------------------------------------+-----------'
>
>
> [info] *** Request 12 (0.000/s) [9579] [Sat Oct 31 09:59:51 2009] ***
> [debug] "GET" request for "admin" from "192.168.1.100"
> [debug] Path is "admin"
> [debug] Found sessionid "e1262ec64fecc849f31af4e61fbb38cb66a414e9" in
> cookie
> [debug] Restored session "e1262ec64fecc849f31af4e61fbb38cb66a414e9"
> [debug] root begin: http://test.bargain-notify.me/admin
> [debug] root auto: http://test.bargain-notify.me/admin
> [debug] Role granted: Administrator
> [debug] Rendering template "admin.tt"
> [info] Request took 0.230871s (4.331/s)
> .------------------------------------------------------------+-----------.
> | Action | Time |
> +------------------------------------------------------------+-----------+
> | /begin | 0.000415s |
> | /auto | 0.000198s |
> | /admin | 0.032198s |
> | /end | 0.179180s |
> | -> Bargain::View::TT->process | 0.178188s |
> '------------------------------------------------------------+-----------'
>
>
> As you ca see, auto in Admin.pm does not fire.
>
> Thank you for the help.
>
> Julien
>
>
>
> On Sat, Oct 31, 2009 at 7:42 AM, Tomas Doran <bobtfish [at] bobtfish>wrote:
>
>>
>> On 31 Oct 2009, at 05:10, Julien Sobrier wrote:
>>
>>>
>>>
>>> Whether I access / or /admin, I don't see any log from any of the auto
>>> functions, but I do see it from the begin fuctions. I am wondering what I am
>>> missing.
>>>
>>
>> Unsure.
>>
>> Can you attach the debug log of your application startup and the debug log
>> generated when you hit /admin ?
>>
>> 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/
>>
>
>


diment at gmail

Nov 1, 2009, 1:29 AM

Post #6 of 11 (1806 views)
Permalink
Re: auto method never triggered [In reply to]

On 01/11/2009, at 3:36 PM, Julien Sobrier wrote:

> BTW, both Root.pm and Admin.pm have this line:
>
> __PACKAGE__->config->{namespace} = '';
>
> Not sure if it makes a difference.


Yes it does. This line stops the Root controller matching /root in
the public namespace. Having this in two different controllers will
have unpredictable consequences.

_______________________________________________
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/


julien at sobrier

Nov 1, 2009, 6:07 PM

Post #7 of 11 (1800 views)
Permalink
Re: auto method never triggered [In reply to]

Thank you

Shoudl It put __PACKAGE__->config->{namespace} = ''root;, or simply remove
this line?

Thank you

Julien


On Sun, Nov 1, 2009 at 1:29 AM, Kieren Diment <diment [at] gmail> wrote:

>
> On 01/11/2009, at 3:36 PM, Julien Sobrier wrote:
>
> BTW, both Root.pm and Admin.pm have this line:
>>
>> __PACKAGE__->config->{namespace} = '';
>>
>> Not sure if it makes a difference.
>>
>
>
> Yes it does. This line stops the Root controller matching /root in the
> public namespace. Having this in two different controllers will have
> unpredictable consequences.
>
>
> _______________________________________________
> 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/
>


andrew at cleverdomain

Nov 1, 2009, 6:12 PM

Post #8 of 11 (1798 views)
Permalink
Re: auto method never triggered [In reply to]

On Sunday 01 November 2009 08:07:32 pm Julien Sobrier wrote:
> Thank you
>
> Shoudl It put __PACKAGE__->config->{namespace} = ''root;, or simply remove
> this line?
>
You should leave it how it is in the root controller, and remove it in the
admin controller.

_______________________________________________
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/


diment at gmail

Nov 1, 2009, 6:18 PM

Post #9 of 11 (1805 views)
Permalink
Re: auto method never triggered [In reply to]

On 02/11/2009, at 1:07 PM, Julien Sobrier wrote:

> Thank you
>
> Shoudl It put __PACKAGE__->config->{namespace} = ''root;, or simply
> remove
> this line?
>
> Thank you
>
> Julien
>
>


If you want Root to hit at '/' on your app you remove it from the
Admin controller, which will then hit at '/admin'




> On Sun, Nov 1, 2009 at 1:29 AM, Kieren Diment <diment [at] gmail>
> wrote:
>
>>
>> On 01/11/2009, at 3:36 PM, Julien Sobrier wrote:
>>
>> BTW, both Root.pm and Admin.pm have this line:
>>>
>>> __PACKAGE__->config->{namespace} = '';
>>>
>>> Not sure if it makes a difference.
>>>
>>
>>
>> Yes it does. This line stops the Root controller matching /root in
>> the
>> public namespace. Having this in two different controllers will have
>> unpredictable consequences.
>>
>>
>> _______________________________________________
>> 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/
>>
> _______________________________________________
> 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/


_______________________________________________
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/


peter at peknet

Nov 1, 2009, 6:18 PM

Post #10 of 11 (1805 views)
Permalink
Re: auto method never triggered [In reply to]

Julien Sobrier wrote on 11/1/09 8:07 PM:
> Thank you
>
> Shoudl It put __PACKAGE__->config->{namespace} = ''root;, or simply
> remove this line?
>

You should leave it as-is in the Root.pm and remove the line altogether in the
Admin.pm.



--
Peter Karman . http://peknet.com/ . peter [at] peknet

_______________________________________________
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/


julien at sobrier

Nov 1, 2009, 7:32 PM

Post #11 of 11 (1799 views)
Permalink
Re: auto method never triggered [In reply to]

Thank you, it works fine now.

On Sun, Nov 1, 2009 at 6:18 PM, Peter Karman <peter [at] peknet> wrote:

> Julien Sobrier wrote on 11/1/09 8:07 PM:
> > Thank you
> >
> > Shoudl It put __PACKAGE__->config->{namespace} = ''root;, or simply
> > remove this line?
> >
>
> You should leave it as-is in the Root.pm and remove the line altogether in
> the
> Admin.pm.
>
>
>
> --
> Peter Karman . http://peknet.com/ . peter [at] peknet
>
> _______________________________________________
> 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.