Define "actually works". Whatever you think the code is doing, that isn't what it is actually doing. A better approach is to use subs:
use strict; use warnings; package Stuff; sub xmlheader { print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; } sub xmldtd { print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"ht +tp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en +\"> <head> <meta http-equiv=\"content-type\" content=\"application/xhtml+xml; + charset=utf-8\" />\n"; } package main; print "content-type:text/html; charset=utf-8\n\n"; Stuff::xmlheader (); Stuff::xmldtd ();
Note that adding strictures (use strict; use warnings; - see The strictures, according to Seuss) to your code would have turned up most of the bugs due to misunderstanding of what was going on.
In reply to Re: Help with proper construction of callable scalars from a Module, please.
by GrandFather
in thread Help with proper construction of callable scalars from a Module, please.
by taint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |