It uses the URI module <http://search.cpan.org/~gaas/URI-1.35/URI.pm> to manipulate paths, so hopefully it does it right. And it will keep up to date as WWW specs change :)
I've replaced all path manipulation in my templates with it. For example I now have two macros that look like this:
[%-
MACRO link(table, command, additional, label) BLOCK ;
SET lnk = request.make_uri(table, command, additional) ;
lnk = lnk | html ;
'<a href="' _ lnk _ '">' ; label ; "</a>" ;
END;
-%]
[%# link_query
# This creates an HTML link to a Maypole action that takes query
# parameters by concatenating the base URL, table, command and query
# arguments. The query args are supplied as a hash reference - see the
# docs for Maypole::Plugin::Path::URI for details
-%]
[%-
MACRO link_query(table, command, arg_hash, label) BLOCK ;
SET lnk = request.make_uri(table, command, arg_hash) ;
lnk = lnk | html ;
'<a href="' _ lnk _ '">' _ label _ '</a>' ;
END;
-%]
Note that the plugin does NOT manipulate HTML, just the URLs. So if you
still want to use HTML::Element, you can, or if you just want to
manipulate the HTML directly in the template, you can.
There's also a method that makes the links for table headings on a list page. Again, just the URL, not the HTML. It's a bit ugly; any thoughts on a better design would be welcome.
And it also overrides Maypole::parse_path(), for two reasons. First, so it too is implemented by URI and second, so all the path manipulation is in one file in case you want to change how paths are interpreted. The functionality in the plugin as it stands is the same as standard Maypole.
Cheers, Dave
URI.pm
Description: Perl program
