[Catalyst] Elegant way to check action presence?
Alex Povolotsky
tarkhil at over.ru
Sat Jan 9 20:53:51 GMT 2010
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.
More information about the Catalyst
mailing list