<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Perl CGI: Source html-page in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109363#M717550</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a CGI-script that needs to print an html-page containing variables dependent on the choise you make.&lt;BR /&gt;Right now I do this using :&lt;BR /&gt;&lt;BR /&gt;#!/opt/per/bin/perl&lt;BR /&gt;&lt;BR /&gt;if ($submit) {&lt;BR /&gt;  open(FH, "&amp;lt; $htmlfile");&lt;BR /&gt;  my @contents=&lt;FH&gt;;&lt;BR /&gt;  close(FH);&lt;BR /&gt;&lt;BR /&gt;  print "Content type text/html; \n\n";&lt;BR /&gt;  print "Contents";&lt;BR /&gt;&lt;BR /&gt;This does print my html-page, but does not interpeted the variables($value) as : &lt;BR /&gt;&lt;INPUT type="text" name="hello" value="$value" /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there a way to source the html-file inside the perl/cgi script, so the $variables are interpeted correct?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your help in advance !!!&lt;BR /&gt;&lt;BR /&gt;Regs David&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The reason for this is that other people should be able to create html-pages and only need to use specific "names" and a form action should be taken. I will only do the perly thing than.&lt;/FH&gt;</description>
    <pubDate>Tue, 04 Nov 2003 03:01:40 GMT</pubDate>
    <dc:creator>David_246</dc:creator>
    <dc:date>2003-11-04T03:01:40Z</dc:date>
    <item>
      <title>Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109363#M717550</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a CGI-script that needs to print an html-page containing variables dependent on the choise you make.&lt;BR /&gt;Right now I do this using :&lt;BR /&gt;&lt;BR /&gt;#!/opt/per/bin/perl&lt;BR /&gt;&lt;BR /&gt;if ($submit) {&lt;BR /&gt;  open(FH, "&amp;lt; $htmlfile");&lt;BR /&gt;  my @contents=&lt;FH&gt;;&lt;BR /&gt;  close(FH);&lt;BR /&gt;&lt;BR /&gt;  print "Content type text/html; \n\n";&lt;BR /&gt;  print "Contents";&lt;BR /&gt;&lt;BR /&gt;This does print my html-page, but does not interpeted the variables($value) as : &lt;BR /&gt;&lt;INPUT type="text" name="hello" value="$value" /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there a way to source the html-file inside the perl/cgi script, so the $variables are interpeted correct?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your help in advance !!!&lt;BR /&gt;&lt;BR /&gt;Regs David&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The reason for this is that other people should be able to create html-pages and only need to use specific "names" and a form action should be taken. I will only do the perly thing than.&lt;/FH&gt;</description>
      <pubDate>Tue, 04 Nov 2003 03:01:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109363#M717550</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-11-04T03:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109364#M717551</link>
      <description>You can use the "eval" approach assuming the variable is already set up in your script.&lt;BR /&gt; &lt;BR /&gt;Something like this&lt;BR /&gt; &lt;BR /&gt;        while($line=&lt;FH&gt;){&lt;BR /&gt;                $line =~ s/\$([\w\]\[\$]+)/insertvar($1)/eg;&lt;BR /&gt;                print $line;&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;And then a function called insertvar that does this&lt;BR /&gt;&lt;BR /&gt;$result=eval(\$$1);&lt;BR /&gt;return($result);&lt;BR /&gt; &lt;BR /&gt;I think this is what your're after.&lt;BR /&gt; &lt;BR /&gt;&lt;/FH&gt;</description>
      <pubDate>Tue, 04 Nov 2003 03:09:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109364#M717551</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-11-04T03:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109365#M717552</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It does not work. I did what you said :&lt;BR /&gt;&lt;BR /&gt;open(FF, "&amp;lt; $file_v");&lt;BR /&gt;$line =~ s/\$([\w\]\[\$]+)/insertvar($1)/eg;&lt;BR /&gt;print $line;&lt;BR /&gt;close(FF);&lt;BR /&gt;&lt;BR /&gt;And I added another subroutine :&lt;BR /&gt;&lt;BR /&gt;sub insertvar() {&lt;BR /&gt;  $result=eval(\$$1);&lt;BR /&gt;  return($result);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I don't seem to get it. Please help.&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Tue, 04 Nov 2003 03:27:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109365#M717552</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-11-04T03:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109366#M717553</link>
      <description>David,&lt;BR /&gt; &lt;BR /&gt;Can we just make sure we are trying to solve the same problem.&lt;BR /&gt; &lt;BR /&gt;I am assuming that within your script are some variables, already defined and that the html file contains the text $some_variable_name here and there which you want to replace with the corresponding variable already set within the perl script and then print.&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Tue, 04 Nov 2003 03:51:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109366#M717553</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-11-04T03:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109367#M717554</link>
      <description>Hi Mark,&lt;BR /&gt;&lt;BR /&gt;That is a 100% true. Like the example of &lt;INPUT type="text" ....="" /&gt; says.&lt;BR /&gt;&lt;BR /&gt;The problem is that nothing is printed anymore. With the @contents at least something got printed :)&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Tue, 04 Nov 2003 03:59:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109367#M717554</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-11-04T03:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109368#M717555</link>
      <description>Actually, the code doesn't quite work as expected but that because I didn't test it :)&lt;BR /&gt; &lt;BR /&gt;Here is the code taht does what I think you want to do.  Note the bracket has moved in the "s/etc etc etc/eg" bit and I simplified the eval.&lt;BR /&gt;  &lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt; &lt;BR /&gt;$myvariable="HELLO THERE";&lt;BR /&gt; &lt;BR /&gt;open FF,"&lt;HTMLFILE.HTML&gt;&lt;/HTMLFILE.HTML&gt;              &lt;BR /&gt;while($line=&lt;FF&gt;){&lt;BR /&gt;$line =~ s/(\$[\w\]\[\$]+)/insertvar($1)/eg;&lt;BR /&gt;print "$line";&lt;BR /&gt;}            &lt;BR /&gt; &lt;BR /&gt;sub insertvar(){&lt;BR /&gt;        return(eval($1));&lt;BR /&gt;}&lt;BR /&gt;&lt;/FF&gt;</description>
      <pubDate>Tue, 04 Nov 2003 04:00:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109368#M717555</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-11-04T04:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109369#M717556</link>
      <description>For some reason I thought you couldn't have the eval in that search but it seems you can so you can simplify it more but getting rid of the function altogether as in&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;$line =~ s/(\$[\w\]\[\$]+)/eval($1)/eg;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Nov 2003 04:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109369#M717556</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-11-04T04:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Perl CGI: Source html-page</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109370#M717557</link>
      <description>Mark,&lt;BR /&gt;&lt;BR /&gt;You are wonderfull !! (ahum, am already married)&lt;BR /&gt;This works terrific :&lt;BR /&gt;&lt;BR /&gt;open(FF, "&amp;lt; $file_v");&lt;BR /&gt;  while($line=&lt;FF&gt;) {&lt;BR /&gt;    $line =~ s/(\$[\w\]\[\$]+)/eval($1)/eg;&lt;BR /&gt;    print $line;&lt;BR /&gt;  }&lt;BR /&gt;close(FF);&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your time in it!!&lt;BR /&gt;&lt;BR /&gt;Regs David&lt;/FF&gt;</description>
      <pubDate>Tue, 04 Nov 2003 04:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-cgi-source-html-page/m-p/3109370#M717557</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-11-04T04:40:52Z</dc:date>
    </item>
  </channel>
</rss>

