Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Getting a self-referencing script URL (was: Seeking wisdom again...)

by akm2 (Scribe)
on Feb 28, 2001 at 02:12 UTC ( [id://61195]=perlquestion: print w/replies, xml ) Need Help??

akm2 has asked for the wisdom of the Perl Monks concerning the following question:

Edited by Corion: Changed title

I have an SysAdmin who is a real /\$$. He won't install ANY modules including Text::Template.

So, I developed the code below.

sub DisplayHTML() { $HTMLFileName = @_[0]; open(HTMLFNH,"<$HTMLFileName") || die "Cant open $HTMLFileName"; print "Content-type: text/html\n\n"; while ($HTMLLine=<HTMLFNH>) { $HTMLLine =~ s/(\$[\w\[\]{}']+)/$1/gee; #Allows printing of variable content. print "$HTMLLine"; } close(HTMLFNH); } return 1;

The problem is this: If you goto http://www.mscorp.org/cgi-bin/invo.pl you will see a page generated by this script. However, if you view the source of the page you will find the action tag for the form is blank. in the HTML document read my the script I have tried using $ENV'SCRIPT_URL'} variable to set the action tag. I have also setting a regular scalar and that doesn't work either.

Any ideas?

Replies are listed 'Best First'.
Re: Seeking wisdom again...
by Masem (Monsignor) on Feb 28, 2001 at 02:20 UTC
    re not installing modules: You can install the Text::Template module in a directory within your own home directory, and then use the following at the start of your code:
    use lib '~myname/path/to/perl/modules' use Text::Template
    use lib simply adds the list of paths that you specify to the front of @INC and thus they get searched first for any modules. While you can't easily maintain the modules with CPAN, you can still grab the source for each, and specify YOUR directory for all install work. Screw your naughty sysadmin :D

      Just as an additional note: instead of the use lib you can set your PERL5LIB (or PERLLIB) environment variable to the directory where your modules are installed. I use $HOME/lib/perl. So when you run Makefile.PL on a new module, do it like this:
      perl Makefile.PL PREFIX=$HOME/lib/perl
      and it will automagically install everything under that directory. If you want to use the CPAN module, during the first run, you can configure it so it automatically passes the PREFIX argument to Makefile.PL.

      --ZZamboni

Re: Seeking wisdom again...
by Hot Pastrami (Monk) on Feb 28, 2001 at 02:24 UTC
    You might try the following, which should work if the script is simply calling itself again:
    my $script = __FILE__; print "<form name='test' action='$script'>";


    Hot Pastrami

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://61195]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found