[Catalyst] Action for index not 'index'?

will trillich will.trillich at serensoft.com
Wed Mar 23 14:27:44 GMT 2011

We tried some of the breadcrumb libraries too, but couldn't wrestle them
into our paradigm, either. There are underlying assumptions about your app
or url structure where it tries to divine patterns on its own that often
just don't jibe with what you've got set up.

What we do instead is, we call a function to add another link in our
breadcrumb chain, so it's deliberate and we're completely in control:

$c->add_breadcrumb( "/some/$url_component/here", 'Text for link here' );

throughout our code, and then in the template:

<ul id=3D"breadcrumbs">
<li>You are here:</li>
[% FOREACH crumb IN breadcrumbs -%]
        IF loop.last %]<span title=3D"You are here">[% crumb.label %]</span=
        ELSE %]<a href=3D"[% c.uri_for(crumb.path).path %]">[% crumb.label
[% END -%]

And here's MyApp::add_breadcrumb en toto--

sub add_breadcrumb {
    my ( $c, $path, $label ) =3D @_;
    my $bc =3D $c->stash->{breadcrumbs} ||=3D [];
    push @$bc, +{
        path =3D> $path,
        label=3D> $label,

On Wed, Mar 23, 2011 at 8:40 AM, Kyle Hall <kyle.m.hall at gmail.com> wrote:

> Hello All,
> I'm working on adding breadcrumbs to my catalyst app and I've run into
> something unexpected.
> I'm using Catalyst::Plugin::Breadcrumbs. Let's assume I have a
> controller Foo. If I just go to /foo ( the index ), the plugin assumes
> that the action will be 'index', but the action is actually just
> 'foo'.
> Because of this, my breadcrumbs show as Foo/Foo instead of Foo/Index (
> or just Foo if hide_index is true ).
> Is this expected behaviour? Has the behaviour changed since
> Plugin::Breadcrumbs was written? I've been able to modify the code for
> the plugin to compensate, but was hoping someone could shed some light
> on this subject.
> Thanks,
> Kyle
> http://www.kylehall.info
> Mill Run Technology Solutions ( http://millruntech.com )
> Crawford County Federated Library System ( http://www.ccfls.org )
> Meadville Public Library ( http://www.meadvillelibrary.org )
> _______________________________________________
> List: Catalyst at 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/

-- =

11 cheers for binary!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110323/fbd3f=

More information about the Catalyst mailing list