Download presentation
Presentation is loading. Please wait.
Published byEdward Skinner Modified over 9 years ago
1
Perl Web Page – Just Enough Pepper
2
Web site Set up the top of your script to indicate perl and plain text #!/usr/bin/perl print "Content-type:text/plain\n\n"; You can put html tags which the browser will understand, or not Ensure that others can read and execute: – chmod o+rx yourfile.pl Web address – www.adelphi.edu/~pe16132/271/yourscript.pl www.adelphi.edu/~pe16132/271/yourscript.pl – Must be under public_html
3
HelloWorld perl on internet Print HTML code to the browser: #!/usr/bin/perl print "Content-type:text/plain\n\n"; print "content-type:text/html; charset=utf-8\n\n"; print "hello world!";
4
HelloWorld perl on internet Print HTML code to the browser more cleanly: #!/usr/bin/perl print "Content-type:text/plain\n\n"; print "content-type:text/html; charset=utf-8\n\n print <<ENDHTML; CGI Test Hello World! Click Here ENDHTML http://www.pageresource.com/cgirec/ptut4.htm
5
Taking in parms Use an html form to prompt for input Change our script to use CGI Print out a form section of html that will run your own script Retrieve from the the search word from the form
6
Script changes to retrieve results print "content-type:text/html; charset=utf-8\n\n"; use strict; use CGI qw/:standard/; my $search = param("input")||""; print qq( What is the search word: ); if ($search) { print qq( the search word is $search ); yourpage(); } print qq( ); sub yourpage { print "do whatever you want in your page here "; print "and you can use $search "; print "\n does nothing "; print "and you need to but br inside angle brackets to get the tne next line "; }
7
Summary Web Create a perl script that uses a preset search word input form Insert your code inside the yourpage method – Read your files – Display your results Place script in public_html Set permissions (chmod o+rx your script.pl) Run as www.adelphi.edu/~ /
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.