Mailing List Archive

plugin for generating URIs that is chaining-aware
I've been working on a Catalyst application, and have come
across a few places that appear difficult to generate a URI
for using uri_for(). I'm thinking of creating a plugin that
can provide the functionality I'm looking for.

In particular, when I am in a controller whose actions are
chained, I would like to be able to be able to generate URIs
for:
- actions in the parent controller (earlier in the chain)
- actions in the controller we are in
- actions in a child controller (later in the chain)
- actions in a non-related controller

I've been able to generate the URIs I want using uri_for(),
except for actions in a parent controller (earlier in the
chain). The syntax to create some of the other URIs is a bit
complicated, and I find I have to look it up every time. The
plugin Catalyst::Plugin::URI provides a simplified syntax.

My idea is to create a plugin with an interface something
like this:

# URI for 'list' action on the current controller
$c->internal_uri(action => 'list');

# URI for 'view' action on the parent controller (up the chain)
$c->internal_uri(controller => '..', action => 'view');

# URI for 'list' action on a child or unrelated controller
$c->internal_uri(controller => $name, action => 'list', captures =>
\@values);

Any advice or perspectives that would help me create such a
plugin, or make it more useful?

-kolibrie

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: plugin for generating URIs that is chaining-aware [ In reply to ]
Hi,
not sure what you mean by 'parent controller' as a chain endpoint action (the thing that maps to a URI) consists of chain elements that don't map to an URI, so uri_for for those makes no sense.

Best regards, Alex

T-SYSTEMS AUSTRIA GESMBH
PU Cyber Security
Network Architecture
Operation Manager Authentication
Rennweg 97-99, A-1030 Vienna
+43 57057 4320 (phone)
+43 676 8642 4320 (mobile)
E-mail: alexander.hartmaier@t-systems.com
Internet: www.t-systems.at
Blog: blog.t-systems.at
Social Media: Facebook, Linkedin, Twitter

BIG CHANGES START SMALL ? CONSERVE RESOURCES BY NOT PRINTING EVERY E-MAIL.

****************************************************************************************************************
T-Systems Austria GesmbH, Rennweg 97-99, A-1030 Vienna
Commercial Court Vienna, FN 79340b
****************************************************************************************************************
Notice: This transmittal and/or attachments may be privileged or confidential. It is
intended solely for the addressee named above. If you received this transmittal in error,
please notify us immediately by reply and delete this message and all its attachments.
Thank you.
****************************************************************************************************************
________________________________
Von: catalyst-bounces@lists.scsys.co.uk <catalyst-bounces@lists.scsys.co.uk> im Auftrag von Nathan Gray <kolibrie@cpan.org>
Gesendet: Montag, 14. Juni 2021 21:23
An: catalyst@lists.scsys.co.uk <catalyst@lists.scsys.co.uk>
Betreff: [Catalyst] plugin for generating URIs that is chaining-aware

I've been working on a Catalyst application, and have come
across a few places that appear difficult to generate a URI
for using uri_for(). I'm thinking of creating a plugin that
can provide the functionality I'm looking for.

In particular, when I am in a controller whose actions are
chained, I would like to be able to be able to generate URIs
for:
- actions in the parent controller (earlier in the chain)
- actions in the controller we are in
- actions in a child controller (later in the chain)
- actions in a non-related controller

I've been able to generate the URIs I want using uri_for(),
except for actions in a parent controller (earlier in the
chain). The syntax to create some of the other URIs is a bit
complicated, and I find I have to look it up every time. The
plugin Catalyst::Plugin::URI provides a simplified syntax.

My idea is to create a plugin with an interface something
like this:

# URI for 'list' action on the current controller
$c->internal_uri(action => 'list');

# URI for 'view' action on the parent controller (up the chain)
$c->internal_uri(controller => '..', action => 'view');

# URI for 'list' action on a child or unrelated controller
$c->internal_uri(controller => $name, action => 'list', captures =>
\@values);

Any advice or perspectives that would help me create such a
plugin, or make it more useful?

-kolibrie

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