FAQ
Hello!

I'm working on a (more or less) flexible system with plugins should be
installed just like controllers; some basic information about them
(particulary, numerical id) must be kept in database.

Plugins should be handle some queries in /admin/service/$servicename

I'd like to put 'smart links' in plugin information table - i.e. if
something handles /admin/service/$servicename/control, link exists; if
no - instead of link text in different style is presented, telling that
plugin has not been installed.

construction like

[% SET path=stype.path %]
[% IF c.can('/admin/service/$path/control') %]
<a href ... >
[% ELSE %]
message here
[% END %]

is ugly; maybe someone points me to some nicer idea? I was thinking of
some function in Schema/Result/Servicetype.pm returning link or warning,
but how do I access the Catalyst object from it? Or I just have to pass
it as argument?

Alex.

Search Discussions

  • Jay Shirley at Jan 9, 2010 at 9:24 pm

    2010/1/9 Alex Povolotsky <tarkhil@over.ru>:
    Hello!

    I'm working on a (more or less) flexible system with plugins should be
    installed just like controllers; some basic information about them
    (particulary, numerical id) must be kept in database.

    Plugins should be handle some queries in /admin/service/$servicename

    I'd like to put 'smart links' in plugin information table - i.e. if
    something handles /admin/service/$servicename/control, link exists; if no -
    instead of link text in different style is presented, telling that plugin
    has not been installed.

    construction like

    [% SET path=stype.path %]
    [% IF c.can('/admin/service/$path/control') %]
    <a href ... >
    [% ELSE %]
    message here
    [% END %]

    is ugly; maybe someone points me to some nicer idea? I was thinking of some
    function in Schema/Result/Servicetype.pm returning link or warning, but how
    do I access the Catalyst object from it? Or I just have to pass it as
    argument?

    Alex.

    The way I did this is using the namespace and action, since the
    namespace is configurable.

    http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80016/lib/Catalyst.pm#$c->get_action(_$action,_$namespace_)

    If it returns undef, the action doesn't exist in the defined namespace.

    -J

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 9, '10 at 8:53p
activeJan 9, '10 at 9:24p
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Alex Povolotsky: 1 post Jay Shirley: 1 post

People

Translate

site design / logo © 2022 Grokbase