package HTML::ScriptLoader; use 5.008008; use strict; use warnings; require Exporter; use AutoLoader qw(AUTOLOAD); use Carp; use URI::Escape; =head1 NAME HTML::ScriptLoader - Perl extension for loading scripts on a web page =head1 SYNOPSIS use HTML::ScriptLoader; my $scripts = HTML::ScriptLoader->new( { 'other-script' => { 'uri' => 'http://example.com/other-script.js' }, 'myscript' => { 'uri' => '/static/js/myscript.js', 'deps' => ['other-script'], 'params' => { 'apikey' => 'very-secret', }, }, } ); $scripts->add_script('myscript'); $ttvars->{'javascripts'} = $scripts->scripts; # In your templates (TT) [% FOREACH js IN javascripts %]