Search code examples
perlbugzillatemplate-toolkit

perl syntax to access the constant variable in cgi script


recently I was debugging a piece of code and found the following usage in the template tool kit usage in the template.

 #Constants.pm
 # Bugzilla version
 use constant BUGZILLA_VERSION => "4.0.11";


 #template file index.html.tmpl
 [% PROCESS global/header.html.tmpl
  header_addl_info = "version $constants.BUGZILLA_VERSION"
  style_urls = [ 'skins/standard/index.css' ] 
 %]

 #index.cgi
 use Bugzilla::Constants;
 .......

 print "buzilla version  :  $constants.BUGZILLA_VERSION <br/>";

When I am using the same syntax in the main cgi script , giving error 500


Solution

  •  print "buzilla version  :  ".Bugzilla::Constants::BUGZILLA_VERSION." <br/>";