FAQ
I want to make an "admin" page available on a URL that's not called "admin", but is
something less obvious that people might guess. Even though it will have a password, it
will stop people from just trying to find it.

I thought to configure it using the normal config features:

use 5.10.1;
use utf8;
package LEDft::Controller::Admin;
use Moose;
use Method::Signatures::Simple;
use namespace::autoclean;

BEGIN {extends 'Catalyst::Controller'; }

has url_name => (
is => 'ro',
required => 1,
);


method index($c) :Path($url_name) :Args(0) { }


However, the debug screen tells me that the Loaded Path action is "/admin/$url_name". Why
did it take the stuff in parens as a literal string, when I didn't use any kind of quotes
around it? An example in the manual is
sub bar : Path('foo/bar') { }
which shows that it is quoted normally: not :Path(foo/bar).

Search Discussions

  • Charlie Garrison at Apr 8, 2011 at 9:49 am
    Good evening,
    On 8/04/11 at 4:18 AM -0500, John M. Dlugosz wrote:

    method index($c) :Path($url_name) :Args(0) { }
    I don't think variable are allowed in method attributes, maybe someone else will correct me.
    However, the debug screen tells me that the Loaded Path action is "/admin/$url_name". Why did it
    take the stuff in parens as a literal string, when I didn't use any kind of quotes around it? An
    example in the manual is
    sub bar : Path('foo/bar') { }
    which shows that it is quoted normally: not :Path(foo/bar).
    And that also shows the path as a string, not a variable.

    To achieve what you want, change the config:

    __PACKAGE__->config->{path} = '/secret_path';

    method index($c) :Path { }


    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt
  • John M. Dlugosz at Apr 8, 2011 at 11:22 am

    To achieve what you want, change the config:
    __PACKAGE__->config->{path} = '/secret_path';

    method index($c) :Path { }


    Charlie
    Thanks. I found that mentioned in the COntroller docs, once you mentioned it. However,
    it also refers to :PathPrefix as well as :Local, :Path, etc, which I've not seen
    documented elsewhere. What's that?
  • Charlie Garrison at Apr 8, 2011 at 12:00 pm
    Good evening,

    On 8/04/11 at 6:22 AM -0500, John M. Dlugosz
    wrote:
    Thanks. I found that mentioned in the COntroller docs, once
    you mentioned it. However, it also refers to :PathPrefix as
    well as :Local, :Path, etc, which I've not seen documented
    elsewhere. What's that?
    Different ways of defining actions, I don't think I can explain
    better than the docco. Maybe if you ask some specific questions...

    I know they are mentioned in more than one place in the docco,
    so keep reading (or ask Google).

    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 8, '11 at 9:18a
activeApr 8, '11 at 12:00p
posts4
users2
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase