Including separate javascript file in perl script -
I have set up Pearl CGI webpages that I am trying to do some refactoring but have gone to a wall.
Each of these scripts has some JavaScript and CSS, which is currently written in this form:
My $ JSCRIPT = & lt; & Lt; Code; Function DUSTF () {// STR}} code; My $ css = & lt; & Lt; Block; . CSS-stuff {} block
JavaScript and CSS are later loaded on the page using CGI
print $ cgi- & gt; Start_html (-script = & gt; [[[type = & gt; "javascript", -code = & gt; $ JSCRIPT}], -style => {-code = & gt; $ CSS}); Is this code a good way to refactor so that instead of making that JSCRIPT copy in multiple files I have a single common.js
or similar File?
instead of -code
as shown in the CII documentation -src Use
.
Print $ q- & gt; Start_html (-title = & gt; 'The Readal of Spinks', -cript = & gt; {-Type = & gt; 'JAVASCRIPT', -src = & gt; '/ javascript / sphinx.js'}); Print $ q- & gt; Start_html (-title = & gt; 'The Readal of the Spinks', -cript = & gt; [[-type = & gt;' text / javascript ', -src = & gt;' / javascript / utilities10 'js' }, {-type = & gt; 'text / javascript', -src = & gt; '/javascript/utilities11.js'}, {-type = & gt; 'text / jscript', -src = & gt; '/ Javascript / utilities12.js'}, {-type = & gt; text / ecmascript', -src = & gt; '/javascript/utilities219.js'}]));