in reply to calling menu bar creating code from another cgi/pl code
i am generating all this web pages using Perl so can't I put menu bar code in separate file, and call it whenever required.
Sure you can :) you can do the same with frobnits.cgi/pagename ... Path::Dispatcher, CGI::Application::Dispatch
example :) run it (maybe perl moannoy.pl daemon -l http://localhost:80/ ), click the links in your browser ....
#!/usr/bin/perl -- use Mojolicious::Lite; get '/' => { template => 'index', title => time };;; app->start; __DATA__ @@ index.html.ep <html> <head> <title><%= title =%></title> </head> <body> <h1><%= title =%></h1> <button onclick="annoying()"> hi </button> <a href="/annoying.js"> /annoying.js </a> %= javascript '/annoying.js' </body> </html> @@ annoying.js function annoying() { alert('hi'); }
or should i write a simple module
You should write that regardless -- doesn't have to be a real module, but each page should be a function DebugCGI
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: calling menu bar creating code from another cgi/pl code (mojo)
by msinfo (Sexton) on Aug 27, 2013 at 06:44 UTC | |
Re^2: calling menu bar creating code from another cgi/pl code (mojo link_to)
by Anonymous Monk on Aug 28, 2013 at 03:09 UTC |