do problem

From: Jan Eden (lists_at_janeden.org)
Date: 04/29/04


Date: Thu, 29 Apr 2004 10:43:32 +0200
To: Perl Lists <beginners@perl.org>

Hi all,

I have a piece of HTML code containing two Perl variable names, which is to be used in 6 scripts. So I tried to put it into a separate file to be executed with "do page_head.pl", where page_head.pl contains something like (simplified):

my $page_head = qq{<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"><head><title>$title</title></head><body>UP<div class="textbox"><!-- begin content -->};

The obvious problem is, that the variables are not interpolated according to their current value in the scripts, i.e. although

$mother_id = 453;
and
$title = "Title";

The $page_head variable will an contain empty title tag and show_local.pl parameter after the do command.

How can I circumvent this without writing the html code in all the six scripts? eval does not seem to be an alternative here.

Thanks,

Jan

-- 
Common sense is what tells you that the world is flat.


Relevant Pages

  • Re: Pythonic Nirvana - towards a true Object Oriented Environment [visionary rambling, long]
    ... Ville Vainio wrote: ... >Why do we write simple scripts to do simple things? ... >serialize data to flat text files in order to process them? ...
    (comp.lang.python)
  • Re: do problem
    ... > their current value in the scripts, ... > How can I circumvent this without writing the html code in all the six scripts? ... cannot see lexicals in the enclosing scope; "eval STRING" does. ... use warnings; ...
    (perl.beginners)
  • Re: plz help:store googles news on local system and search for it
    ... Only problem to solve now is when there's html code in the ... If you've got any similar sorts of scripts might be interested in them ... this year so actively seeking this sort of script. ... Free Search Engine Optimization Tutorial ...
    (alt.internet.search-engines)
  • Re: JavaScript not working with ASP
    ... > It is the browser that is responsible for retrieving the script file based ... > on the HTML code that it is interpreting. ... > Mark Schupp ... had to rename my "scripts" directory to something else, ...
    (microsoft.public.inetserver.asp.general)
  • Re: JavaScript not working with ASP
    ... > It is the browser that is responsible for retrieving the script file based ... > on the HTML code that it is interpreting. ... > Mark Schupp ... had to rename my "scripts" directory to something else, ...
    (microsoft.public.inetserver.iis.activeserverpages)