CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [sunrise11] Need to change browser's title for one page: Edit Log


Apr 12, 2011, 11:19 AM

Views: 12565
Re: [sunrise11] Need to change browser's title for one page

PHP being more secure than Perl is just an oppinion. Both languages will require you to validate i.e. form data in much the same way. The statistics show that in relation to the number of PHP users / Perl users, there are still more security issues arrousing with PHP, but that could just be down to chance.

You have to keep in mind, that in order for PHP code to run, the PHP "file" will need the PHP extension .php. Its not as simple as being able to put PHP code inside Perl code, although there may be modules available to help.

Heres a very basic example how I usually build a webpage, although it depends on how much traffic I expect:

Create 3 files:

Create a Perl script to "glue" the files together and print:

use LWP::Simple; 

my $header = "Header.php?Title=mytitle";
my $content = "Content.html";
my $footer = "Footer.php";

print "Content-type: text/html\n\n";
print get($header);
print get($content);
print get($footer);

The Header.php will receive a param variable "Title" e.g.:

if (isset($_GET['Title'])) {
$title = $_GET['Title'];
else {
$title = 'Default title';

<title><?php echo $title ?></title>

Thats how I usually use PHP in my Perl scripts, by literally sending a request and printing its output.


(This post was edited by Zhris on Apr 12, 2011, 1:34 PM)

Edit Log:
Post edited by Zhris (Enthusiast) on Apr 12, 2011, 1:34 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives