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


In reply to Re: calling menu bar creating code from another cgi/pl code (mojo) by Anonymous Monk
in thread calling menu bar creating code from another cgi/pl code by msinfo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.