View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Nicholas Bamber > CGI-Application-Plugin-PageLookup-1.8 > CGI::Application::Plugin::PageLookup::Href



Annotate this POD


New  3
Open  2
View/Report Bugs
Module Version: 1.8   Source  


CGI::Application::Plugin::PageLookup::Href - Manage internal URLs


Version 1.8


This module manages the instantiation of list style template parameters across a website; for example TMPL_LOOP in HTML::Template, though one must use HTML::Template::Pluggable for it to work. For example a menu is typically implemented in HTML as <ul>....</ul>. Using this module the menu can be instantiated from the database and the same data used to instantiate a human-readable sitemap page. On the other hand the staff page will have list data that is only required on that page. This module depends on CGI::Application::Plugin::PageLookup.


In the template you might define a number of links as follows:

    <p>This page in other languages:</p>
                <li><a href="<TMPL_VAR NAME="href.translate('en')">">English</a></li>
                <li><a href="<TMPL_VAR NAME="href.translate('de')">">German</a></li>
                <li><a href="<TMPL_VAR NAME="href.translate('fr')">">French</a></li>

    <p>Some other pages that may be of interest</p>
                <li><a href="<TMPL_VAR NAME="href.refer(1)">">My first page</a></li>
                <li><a href="<TMPL_VAR NAME="href.refer(2)">">My second and more exciting page</a></li>
                <li><a href="<TMPL_VAR NAME="href.refer(3)">">My last will and testament</a></li>

You must register the "href" parameter as a CGI::Application::Plugin::PageLookup::Href object as follows:

    use CGI::Application;
    use CGI::Application::Plugin::PageLookup qw(:all);
    use CGI::Application::Plugin::PageLookup::Href;
    use HTML::Template::Pluggable;
    use HTML::Template::Plugin::Dot;

    sub cgiapp_init {
        my $self = shift;

        # pagelookup depends CGI::Application::DBH;
        $self->dbh_config(......); # whatever arguments are appropriate



                # load smart dot-notation objects
                objects =>
                        # Register the 'href' parameter
                        href => 'CGI::Application::Plugin::PageLookup::Href',





A constructor following the requirements set out in CGI::Application::Plugin::PageLookup.


This function takes the existing page id and translates it into another specified language. This way every page can link to its cognate page in another languages.


This function takes an internal id and translated that into the corresponding page but in the same language as the current page. This way URLs can be search engine friendly irrespective of language.


Nicholas Bamber, <nicholas at>


Please report any bugs or feature requests to bug-cgi-application-plugin-pagelookup at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc CGI::Application::Plugin::PageLookup::Href

You can also look for information at:



Copyright 2009 Nicholas Bamber.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: