{"id":24315468,"url":"https://github.com/asb-capfan/cgi-application-plugin-htcompiled","last_synced_at":"2026-06-10T09:31:32.936Z","repository":{"id":22548715,"uuid":"25889704","full_name":"asb-capfan/CGI-Application-Plugin-HTCompiled","owner":"asb-capfan","description":"CGI::Application plugin to integrate HTML::Template::Compiled - https://metacpan.org/pod/CGI::Application::Plugin::HTCompiled","archived":false,"fork":false,"pushed_at":"2016-03-24T20:29:52.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T22:46:24.958Z","etag":null,"topics":["cgi","perl"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asb-capfan.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-28T20:56:13.000Z","updated_at":"2017-02-13T17:59:49.000Z","dependencies_parsed_at":"2022-08-20T19:20:42.502Z","dependency_job_id":null,"html_url":"https://github.com/asb-capfan/CGI-Application-Plugin-HTCompiled","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/asb-capfan/CGI-Application-Plugin-HTCompiled","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asb-capfan%2FCGI-Application-Plugin-HTCompiled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asb-capfan%2FCGI-Application-Plugin-HTCompiled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asb-capfan%2FCGI-Application-Plugin-HTCompiled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asb-capfan%2FCGI-Application-Plugin-HTCompiled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asb-capfan","download_url":"https://codeload.github.com/asb-capfan/CGI-Application-Plugin-HTCompiled/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asb-capfan%2FCGI-Application-Plugin-HTCompiled/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34146871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgi","perl"],"created_at":"2025-01-17T11:15:46.905Z","updated_at":"2026-06-10T09:31:32.717Z","avatar_url":"https://github.com/asb-capfan.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n    CGI::Application::Plugin::HTCompiled - Integrate with\n    HTML::Template::Compiled\n\nSYNOPSIS\n        # In your CGI::Application-derived base class. . . \n        use base \"CGI::Application\";\n        use CGI::Application::Plugin::HTCompiled;\n\n        # Later, in a run mode far, far away. . . \n        sub view\n        {\n            my $self = shift;\n            my $username = $self-\u003equery-\u003eparam(\"user\");\n            my $user     = My::Users-\u003eretrieve($username);\n\n            my $tmpl_view = $self-\u003eload_tmpl( \"view_user.tmpl\" );\n\n            $tmpl_view-\u003eparam( user =\u003e $user );\n\n            return $tmpl_view-\u003eoutput();\n        }\n\nDESCRIPTION\n    Allows you to use HTML::Template::Compiled as a seamless replacement for\n    HTML::Template.\n\nDEFAULT PARAMETERS\n    By default, the HTCompiled plugin will automatically add a parameter 'c'\n    to the template that will return to your CGI::Application object $self.\n    This allows you to access any methods in your CGI::Application module\n    that you could normally call on $self from within your template. This\n    allows for some powerful actions in your templates. For example, your\n    templates will be able to access query parameters, or if you use the\n    CGI::Application::Plugin::Session module, you can access session\n    parameters.\n\n     \u003ca href=\"\u003ctmpl_var c.query.self_url\u003e\"\u003eReload this page\u003c/a\u003e\n\n    With this extra flexibility comes some responsibilty as well. It could\n    lead down a dangerous path if you start making alterations to your\n    object from within the template. For example you could call c.header_add\n    to add new outgoing headers, but that is something that should be left\n    in your code, not in your template. Try to limit yourself to pulling in\n    information into your templates (like the session example above does).\n\n  Extending load_tmpl()\n    There are times when the basic \"load_tmpl()\" functionality just isn't\n    enough. The easiest way to do this is by replacing or extending the\n    functionality of CGI::Application's \"load_tmpl()\" method. This is still\n    possible using the plugin.\n\n    The following code snippet illustrates one possible way of achieving\n    this:\n\n      sub load_tmpl\n      {\n          my ($self, $tmpl_file, @extra_params) = @_;\n\n          push @extra_params, \"cache\",             \"1\";\n          return $self-\u003eSUPER::load_tmpl($tmpl_file, @extra_params);\n      }\n\nFUNCTIONS\n    This is documentation of how it is done internally. If you actually are\n    looking for how to use this module, see SYNOPSIS. There isn't anything\n    else to do than using this plugin.\n\n  import()\n    Will be called when your Module uses HTML::Template::Compiled. Registers\n    callbacks at the \"init\" and the \"load_tmpl\" stages. This is how the\n    plugin mechanism works.\n\n  _pass_in_self()\n    Adds the parameter c each template that will be processed. See DEFAULT\n    PARAMETERS for more information.\n\n  _add_init()\n    Set html_tmpl_class to HTML::Template::Compiled at the init stage. That\n    way, each time a template is loaded using load_tmpl, an instance of\n    HTML::Template::Compiled will be created instead of the defualt\n    HTML::Template. See the CGI::Appliaction manpage for more information.\n\n  load_tmpl()\n    This method exists to ensure backward compatibility only. It overrides\n    CGI::Application's load_tmpl() when this plugin is used the old way. See\n    BACKWARD COMPATIBILITY for more information and please just don't use it\n    that way anymore.\n\n    For the most part, this is the exact \"load_tmpl()\" method from\n    CGI::Application, except it uses HTML::Template::Compiled instead of\n    HTML::Template.\n\n    See the CGI::Application reference for more detailed information on what\n    parameters can be passed to \"load_tmpl()\".\n\nBACKWARD COMPATIBILITY\n    You can still use the old method using the module by inheriting from it.\n    This is not recommended, as it overrides CGI::Application's\n    \"load_tmpl()\".\n\n        # In your CGI::Application-derived base class. . . \n        use base (\"CGI::Application::Plugin::HTCompiled\", \"CGI::Application\");\n\n        # Later, in a run mode far, far away. . . \n        sub view\n        {\n            my $self = shift;\n            my $username = $self-\u003equery-\u003eparam(\"user\");\n            my $user     = My::Users-\u003eretrieve($username);\n\n            my $tmpl_view = $self-\u003eload_tmpl( \"view_user.tmpl\" );\n\n            $tmpl_view-\u003eparam( user =\u003e $user );\n\n            return $tmpl_view-\u003eoutput();\n        }\n\nEXAMPLE\n    Define your CGI::Application derived base class.\n\n            package CGIApplicationDerivedBaseClass;\n        \n            use strict;\n            use warnings;\n        \n            use FindBin qw/$Bin/;\n            use lib $Bin . '/lib';\n        \n            use base qw/CGI::Application/;\n        \n            use CGI::Application::Plugin::HTCompiled;\n        \n            =head1 NAME\n        \n            CGIApplicationDerivedBaseClass - Perl extension for demonstrating\n            CGI::Application::Plugin::HTCompiled.\n        \n            =head1 SYNOPSIS\n        \n                    use strict;\n                    use warnings;\n        \n                    my $app = CGIApplicationDerivedBaseClass-\u003enew();\n                    $app-\u003erun();\n        \n            =head1 DESCRIPTION\n        \n            This demonstrates, how to use CGI::Application::Plugin::HTCompiled.\n        \n        \n            =head1 METHODS\n        \n            =head2 setup()\n        \n            Defined runmodes, etc.\n        \n            =cut\n        \n            sub setup {\n                    my $self = shift;\n                \n                    $self-\u003estart_mode('start');\n                    $self-\u003erun_modes([qw/\n                            start\n                    /]);\n                \n            } # /setup\n        \n        \n        \n        \n            =head2 start()\n        \n            =cut\n        \n            sub start {\n                    my $self        = shift;\n                \n                    my $tmpl_content = qq~\n            \u003ch1\u003eHi!\u003c/h1\u003e\n        \n            \u003cp\u003eYou are here: \u003cTMPL_VAR c.query.url\u003e (this is HTML::Compiled magic)\u003c/p\u003e\n            \u003cp\u003eYou are using CAP::HTC version \u003cTMPL_VAR version\u003e\u003c/p\u003e\n                    ~;\n                \n                    my $t = $self-\u003eload_tmpl(\\$tmpl_content);\n                    $t-\u003eparam(version =\u003e $CGI::Application::Plugin::HTCompiled::VERSION);\n                    return $t-\u003eoutput();\n            } # /start\n        \n        \n        \n        \n            =head1 SEE ALSO\n        \n            CGI::Application, CGI::Application::Plugin::HTCompiled.\n        \n            =head1 AUTHOR\n        \n            Alexander Becler, E\u003clt\u003ec a p f a n \u003c a t \u003e g m x . d eE\u003cgt\u003e\n        \n            =head1 COPYRIGHT AND LICENSE\n        \n            Copyright (C) 2009 by Alexander Becker\n        \n            This library is free software; you can redistribute it and/or modify it under\n            the same terms as Perl itself, either Perl version 5.8.8 or, at your option,\n            any later version of Perl 5 you may have available.\n        \n            =cut\n        \n            1;\n\n    Create an instance and run.\n\n            #!/usr/bin/perl\n        \n            use strict;\n            use warnings;\n            use CGIApplicationDerivedBaseClass;\n        \n            my $app = CGIApplicationDerivedBaseClass-\u003enew();\n            $app-\u003erun();\n\nAUTHOR\n    Alexander Becker \"\u003casb@cpan.org\u003e\", Mark Stosberg\n    \"\u003cmark@summersault.com\u003e\" ...but largely modeled on HTDot plugin by Jason\n    A. Crome.\n\nBUGS\n    Please report any bugs or feature requests to\n    \"bug-cgi-application-plugin-htcompiled@rt.cpan.org\", or through the web\n    interface at\n    \u003chttp://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-H\n    TCompiled\u003e. I will be notified, and then you'll automatically be\n    notified of progress on your bug as I make changes.\n\nACKNOWLEDGEMENTS\n    The usual crowd in #cgiapp on irc.perl.org\n\nSEE ALSO\n    CGI::Application, HTML::Template, HTML::Template::Compiled,\n\nCOPYRIGHT \u0026 LICENSE\n    Copyright 2005 Mark Stosberg, all rights reserved.\n\n    This program is free software; you can redistribute it and/or modify it\n    under the same terms as Perl itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasb-capfan%2Fcgi-application-plugin-htcompiled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasb-capfan%2Fcgi-application-plugin-htcompiled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasb-capfan%2Fcgi-application-plugin-htcompiled/lists"}