Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • From MyApp.pm:

    sub uri_for {
        my $c = shift;
        my ( $path ) = @_;

        if ( not Scalar::Util::blessed( $path ) and 'ARRAY' eq ref $path ) {
            my $action_path = shift @$path;
            unshift @_, $action_cache->{ $action_path } ||= $c->dispatcher->get_action_by_path( $action_path );
            $path = $_[0];
        }

        return URI::WithBase::Rel->new( $c->NEXT::uri_for( @_ ), $c->req->uri );
    }

    With that, you can write your second example like this:

    [% c.uri_for(['/admin/itemtype/edit, item_type.type_id]) %]

    • Woops, that would be:

      sub uri_for {
          my $c = shift;
          my ( $path ) = @_;

          if ( not Scalar::Util::blessed( $path ) and 'ARRAY' eq ref $path ) {
              my $action_path = shift @$path;
              unshift @_, $c->dispatcher->get_action_by_path( $action_path );
              $path = $_[0];
          }

          return URI::WithBase::Rel->new( $c->NEXT::uri_for( @_ ), $c->req->uri );
      }

      (The actual method i