📄 perllecture.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="default">
<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; U) [Netscape]">
<title>Perl Web Automation Lecture</title>
</head>
<body>
<p>
<hr SIZE=1 WIDTH="61%">
<center>Perl - Web Automation Lecture
<br>By <a href="mailto:tejanshu@rediffmail.com">BitsNbytes</a>
<br>for
<br><a href="http://blacksun.box.sk">http://blacksun.box.sk</a></center>
<hr SIZE=1 WIDTH="73%">
<br>
<p>*** bitsNbytes has joined #bsrf
<br><bitsNbytes> hi ppl
<br><bitsNbytes> I am EXtremely sorry for being late
<br><bitsNbytes> should we begin with the lecture
<br><fatboyjoe> just when everyone had given up hope of seeing it
<br><bitsNbytes> yeah ..sorry man
<br><fatboyjoe> heh
<br><fatboyjoe> oh well
<br><fatboyjoe> better late than never I guess :)
<br><bitsNbytes> K..is everyone eager and attentive
<br><pitpat> oh
<br><pitpat> yea
<br><bitsNbytes> hehe
<br><pitpat> i'm all ears
<br><pitpat> finally
<br><pitpat> ;O)
<br><bitsNbytes> lol
<br><Yodason> =)
<br><pitpat> ok bits
<br><pitpat> are you doing it on perl?
<br><bitsNbytes> k..the connection here in India is haywire t'day
<br><bitsNbytes> and hence the delay
<br><bitsNbytes> yeah..i'd like to know if there r total newbies too
<br><pitpat> <--- newbie of perl
<br><bitsNbytes> i mean those who are absolutely oblivious to the existence
of perl and its basics
<br>*** Getalife has joined #bsrf
<br>*** _ciR_ has quit IRC (Ping timeout: 180 seconds)
<br><Getalife> Any phreakers around?
<br><pitpat> <--- not that much of a newbie
<br><pitpat> hehe
<br><bitsNbytes> hmm good then
<br><bitsNbytes> what i am about to share with you t'day is the relation
of perl and the web
<br><pitpat> cgi
<br><pitpat> common gateway interface
<br><bitsNbytes> PRECISELY
<br><pitpat> ;O)
<br><bitsNbytes> hmm i have got a learned audience .. i must say
<br>*** wascy|prepare_hack is now known as wascy
<br><pitpat> go on...
<br><bitsNbytes> when we talk of cgi..
<br><bitsNbytes> we are talking about dynamic information
<br><bitsNbytes> and interactivity
<br><pitpat> server-side
<br><pitpat> web
<br><bitsNbytes> yess.. that is what makes the web so ALIVE
<br>*** jacs has quit IRC (Ping timeout: 180 seconds)
<br><bitsNbytes> Perl very much like other languages
<br><pitpat> doesn't need to be compiled
<br><bitsNbytes> supports the concept of modularity
<br><bitsNbytes> ok.. that too (very basic tho) ;)
<br>*** wascy has quit IRC (Quit: )
<br>*** jacs has joined #bsrf
<br><bitsNbytes> all modules are available today on Comprehensive Perl
Archive Network (CPAN)
<br><bitsNbytes> for Perl and CGI to be integrated we need the
cgi.pm module
<br><Getalife> Any phreakers around?
<br>*** fatboyjoe has quit IRC (Ping timeout: 180 seconds)
<br><bitsNbytes> that has to be included in our pel script
<br>*** _ciR_ has joined #bsrf
<br><pitpat> ciR
<br><pitpat> i found the lecturer
<br><_ciR_> who
<br><pitpat> bitsNbytes
<br>*** demontanus has quit IRC (Quit: Math is like sex. Add the people,
subtract the clothes, divide the legs, and multiply.)
<br><pitpat> hehe
<br><bitsNbytes> let us begin with a sample basic program
<br><_ciR_> hehe
<br><pitpat> don't do the hello world plz
<br><pitpat> :O(
<br><_ciR_> looks like bsrf ous u
<br><bitsNbytes> nah don't worry
<br><pitpat> can you go a bit faster bits?
<br><pitpat> i'm getting sleepy
<br><bitsNbytes> i am trying
<br><bitsNbytes> but the network connection seems to be outof order
<br><bitsNbytes> #! /usr/bin/perl -w
<br><bitsNbytes> this is the line that acts like a include <> line
in C
<br><bitsNbytes> the -w is for warnings on
<br><bitsNbytes> # a program for your type of babe
<br><bitsNbytes> this was a comment
<br>*** rek has joined #bsrf
<br>*** ChanServ sets mode: +o rek
<br><rek> hey
<br>*** Arrowhead has quit IRC (Quit: )
<br><bitsNbytes> use CGI qw (param) # a very important line..
includes the cgi.pm module
<br><rek> no lecture?
<br><pitpat> yea bitsNbytes is doing it right now
<br><bitsNbytes> print <<END_of_start;
<br><bitsNbytes> Content-type: text/html
#needs no explanation
<br><bitsNbytes> <HTML>
<br><bitsNbytes> <HEAD>
<br><bitsNbytes> <TITLE> My kinda girl </TITLE>
<br>*** fatboyjoe has joined #bsrf
<br><bitsNbytes> </HEAD>
<br><bitsNbytes> <BODY>
<br><Getalife> Can anyone assist me in making a scanner out of a cordless
phone?
<br><_ciR_> hahah not its HTML lecture
<br><_ciR_> then <p>hahah,</p>
<br>*** rek has quit IRC (Quit: Leaving)
<br><bitsNbytes> <H1> Greetings Mortal </H1>
<br>*** rek has joined #bsrf
<br>*** ChanServ sets mode: +o rek
<br>*** rek sets mode: +v bitsNbytes
<br><bitsNbytes> END_of_start
<br>*** sohed has joined #bsrf
<br>*** zwanderer has joined #bsrf
<br><bitsNbytes> my $favorite=param("brunette");
<br><bitsNbytes> print "<P> Your favorite flavor is $favorite.";
<br><bitsNbytes> print <<ALL_Done;
<br><bitsNbytes> </BODY>
<br><bitsNbytes> </HTML>
<br><bitsNbytes> ALL_Done
<br><bitsNbytes> well was this understood
<br>*** freespeachlamer has joined #bsrf
<br><freespeachlamer> is the lecture over?
<br><bitsNbytes> we just created a small basic interactive CGI-perl
script that propmts the user for his
<br><bitsNbytes> favorite chick type
<br>*** TCL has joined #bsrf
<br>*** ChanServ sets mode: +v TCL
<br><freespeachlamer> umm can someone send me a log of the lecture?
<br><bitsNbytes> no ... its just begun
<br><freespeachlamer> oh
<br><freespeachlamer> sorry :)
<br><rek> bitsNbytes: your a little late
<br><bitsNbytes> now if we don't wanna type all that HTML stuff
<br><bitsNbytes> OK .. so what do u sugget "rek"
<br><bitsNbytes> i mean suggest
<br><rek> what u mean?
<br><bitsNbytes> yeah .. i know i am late .....??
<br><bitsNbytes> as long as there are a pair of attentive ears .. it's
ok
<br><rek> well, we had a lot more people, lot of us left @ 1:30...
<br><rek> i was just makin sure u know.. go on with the lecture
<br><bitsNbytes> yeah .. iknow and i am sorry (for the umpteenth time
now)
<br>*** jacs has quit IRC (Ping timeout: 180 seconds)
<br><bitsNbytes> ok lemme ask how many of us are familiar with basic
unix concepts and cgi scripting
<br><Yodason> not me =p
<br>*** jacs has joined #bsrf
<br>* rek is
<br>* fatboyjoe is
<br><bitsNbytes> so i can really move on to REAL stuff
<br>* freespeachlamer is not
<br><freespeachlamer> but dont worry about me :)
<br>*** freespeachlamer has quit IRC (Quit: )
<br><bitsNbytes> then let us begin with what we really can do
<br><bitsNbytes> k let us see this bit complex program i'vbe written
<br><bitsNbytes> #! /usr/bin/perl -w
<br>*** rek sets mode: +m
<br>*** zwanderer has quit IRC (Quit: bye bye peppe)
<br><bitsNbytes> # this program loads the cgi module to decide information
by web server
<br><bitsNbytes> use strict;
<br><rek> bbl have to leave
<br>*** pitpat has quit IRC (Quit: )
<br>*** rek sets mode: -m
<br>*** rek has quit IRC (Quit: )
<br><bitsNbytes> man .. am i that boring
<br><Yodason> lol'
<br><TCL> lol
<br><sohed> nope, go on
<br><bitsNbytes> # the strict module ensures your code is in order and
within the norms
<br><bitsNbytes> so we write
<br><bitsNbytes> use strict;
<br><bitsNbytes> use CGI qw (:standard escapeHTML);
<br><bitsNbytes> # now to get a parameter from a form
<br><bitsNbytes> my $value=param ('PARAM_NAME');
<br>*** Getalife has quit IRC (Read error: 104 (Connection reset by peer))
<br><bitsNbytes> # and output a document
<br><bitsNbytes> print header(), start_html("Howdy there!"),
<br><bitsNbytes> p("U typed: ", tt(escapeHTML($value))),
<br><bitsNbytes> end_html
<br><bitsNbytes> some explanation now
<br><bitsNbytes> CGI scripts are called in two main ways
<br><bitsNbytes> referred to as "methods" --> not HTTP methods
<br><bitsNbytes> one is the procedural method.. the other is object
oriented
<br><bitsNbytes> procedural for simple tasks
<br><bitsNbytes> and object oriented for complex ones
<br><bitsNbytes> our little program here can be analyzed as follows
<br>*** X has joined #bsrf
<br>*** DigitalFallout has quit IRC (Read error: 104 (Connection reset
by peer))
<br><bitsNbytes> as u might have guessed $anything stands for variable
declaration in perl
<br><X> meaw
<br><bitsNbytes> perl supports all kinds of data types
<br>*** essex has joined #bsrf
<br><bitsNbytes> collectively called as "scalar variables"
<br><bitsNbytes> u no longer have to specify a "type"
<br><essex> Hi ya
<br><bitsNbytes> u just say $whatever = somevalue
<br><bitsNbytes> the "my" reserved word makes that particular variable
or parameter
<br><bitsNbytes> passed to a subroutine "local" to ur specific program
<br><bitsNbytes> i.e. "my" for locality of reference ..ok
<br>* essex want's to know if anyone knows a good VB decompiler
<br><bitsNbytes> the header() returns a string content type
<br><bitsNbytes> followed by the start_html
<br><bitsNbytes> which returns the string, passed as parameter ,
<br>*** phil has quit IRC (Remote closed the connection)
<br>*** TCL has quit IRC (Quit: BBL)
<br><bitsNbytes> ok.. now how do we use this program
<br><bitsNbytes> i hope whatever i said was not too obvious
<br><bitsNbytes> anywayz
<br><bitsNbytes> i shall tell u how to get this prog running under UNIX
<br><bitsNbytes> since I have very lil knowledge bout windowz
<br><bitsNbytes> generally we place this program on a web server (running
APACHE preferrably)
<br><bitsNbytes> path-> /home/httpd/cgi-bin/program
<br><bitsNbytes> where program is the program name
<br>*** josh-hamster has joined #bsrf
<br><bitsNbytes> and then use a browser lynx (for the console) Netscape,
Amaya (for Xwin)
<br><bitsNbytes> get the program running
<br><bitsNbytes> am i .. making any sense to u ppl
<br><bitsNbytes> feedbacks plz
<br><HardW1r3> yeh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -