in reply to Help with proper construction of callable scalars from a Module, please.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with proper construction of callable scalars from a Module, please.
by Jenda (Abbot) on Nov 13, 2013 at 14:18 UTC | |
|
Re^2: Help with proper construction of callable scalars from a Module, please.
by taint (Chaplain) on Nov 13, 2013 at 02:21 UTC | |
by Anonymous Monk on Nov 13, 2013 at 12:52 UTC | |
by taint (Chaplain) on Nov 13, 2013 at 02:28 UTC | |
by ig (Vicar) on Nov 13, 2013 at 17:29 UTC | |
by taint (Chaplain) on Nov 13, 2013 at 19:11 UTC |