📄 perllecture.html
字号:
<br>*** zwanderer has quit IRC (Quit: off)
<br><bitsNbytes> he means on the "console"
<br><NIN_Dude> nm
<br><NIN_Dude> yeah
<br><Jesteruk> i mean in that black bit where you type shit
<br><Jesteruk> ;)
<br><NIN_Dude> heh...
<br><bitsNbytes> now how to make our scripts more efficient
<br><bitsNbytes> this is mainly for Unix audience
<br><Jesteruk> As long as mine work, i'm happy
<br>*** pitpat has joined #bsrf
<br><bitsNbytes> Use mod_perl in the Apache server
<br><pitpat> wow bitsNbytes still going
<br><Jesteruk> go on dude...
<br><pitpat> >=)
<br><bitsNbytes> also edit the httpd.conf as followz
<br><Jesteruk> I run mine on a unix server, just test em on here, i
cant install linux cause i got a software modem, and im not financially
able to buy new shit
<br><Jesteruk> *listenin*
<br><bitsNbytes> Alias /perl/ /real/path/to/perl/scripts
<br><bitsNbytes> the above line is not to be typed as it is
<br><bitsNbytes> it means direct it to ur perl script directory
<br><bitsNbytes> then in the next line
<br><Jesteruk> yeah, assign a virtual path to the system path
<br><bitsNbytes> <Location /perl>
<br><bitsNbytes> SetHandler perl-script
<br><bitsNbytes> PerlHandler Apache::Registry
<br><bitsNbytes> Options ExecCGI
<br><bitsNbytes> </Location>
<br><bitsNbytes> leave a line
<br>*** Dustin has quit IRC (Read error: 104 (Connection reset by peer))
<br><bitsNbytes> PerlModule Apache::Registry
<br><bitsNbytes> PerlModule CGI
<br><bitsNbytes> PerlHandler On
<br><bitsNbytes> this is what u have to type in your /etc/httpd.conf
file
<br><Jesteruk> how exactly down the mod_perl thingy simply scripting?
<br><bitsNbytes> the PerlModule CGI preloads the CGI module
<br><Jesteruk> down=does (beer)
<br>*** pitpat has quit IRC (Quit: )
<br><bitsNbytes> PerlHeader On makes most of your scripts run out of
the box with mod_perl
<br><Jesteruk> hum , i see
<br><bitsNbytes> now .. perl was designed to be a glue language
<br><Jesteruk> Recently ive been readin about perl with mySQL, i dun
like PHP
<br><bitsNbytes> that means it provide sscope for embedding code excerpts
from other langs or some system calls
<br><Jesteruk> it has all the cool shit from other languages, and dont
have the uncool shit..apparently
<br><bitsNbytes> you can do so easily
<br><Jesteruk> i found a few good reads
<br><Jesteruk> and some shit ones
<br>* NIN_Dude shoots jester in the face
<br><bitsNbytes> hehehe
<br><Jesteruk> i fear you now.
<br><bitsNbytes> now how about formatting lists and tables with HTML
shortcuts
<br><Jesteruk> im listenin
<br><bitsNbytes> for this purpose the CGI module provides HTML helper
functions
<br>*** Norton has joined #bsrf
<br><bitsNbytes> which, when passed as array refernces(pointers to arrays)
<br>*** TCL has joined #bsrf
<br>*** ChanServ sets mode: +v TCL
<br><Jesteruk> which does what exactly?
<br><Jesteruk> oops...
<br><bitsNbytes> apply themselves to each element of the referenced
array ;)
<br><bitsNbytes> for example
<br><bitsNbytes> print ol(li(qw(red blue green)])};
<br><bitsNbytes> sorry the last } is actually a )
<br><Jesteruk> hum, that looks irish to me
<br><NIN_Dude> HTML
<br><NIN_Dude> ol
<br><NIN_Dude> li
<br><Jesteruk> ah..
<br><NIN_Dude> qw?
<br><NIN_Dude> perl?
<br><Jesteruk> what's perl?
<br><bitsNbytes> yeah the qw is NEAT
<br><NIN_Dude> you went over earlier
<br><NIN_Dude> i forgot
<br><NIN_Dude> :\
<br><Jesteruk> well damn it
<br><bitsNbytes> rather than qoute each individual element passed as
parameter
<br><bitsNbytes> u just say qw(....)
<br>*** TCL has quit IRC (Quit: 3 2 1, 1 2 3, who the heck is haxoring
me?!)
<br><NIN_Dude> so like string?
<br><bitsNbytes> all the words within the braces get quoted individually
<br><Jesteruk> aaah
<br><bitsNbytes> just like in the above line qw (red blue green) means
<br>*** Grendel has quit IRC (Quit: brb)
<br><bitsNbytes> ("red", "blue", "green")
<br><NIN_Dude> yeah
<br><NIN_Dude> i got it now
<br>*** Grendel has joined #bsrf
<br><bitsNbytes> ok now the next line is
<br>*** CHAOS has joined #bsrf
<br>*** ChanServ sets mode: +v CHAOS
<br><bitsNbytes> <OL><LI>red</LI> <LI>blue</LI>
<LI>green</LI></OL>
<br>*** Jesteruk has left #bsrf
<br><bitsNbytes> let us see how this workz when implemented actually
<br><CHAOS> www.www.www
<br><NIN_Dude> what's the print ol(li(qw(red blue green))) do?
<br><bitsNbytes> coming to it
<br><NIN_Dude> k
<br><bitsNbytes> just give me some time
<br><bitsNbytes> i am having a nasty time with the ****ing connection
here
<br><bitsNbytes> use CGI qw(:standard :html3);
<br><bitsNbytes> %hash = (
<br><CHAOS> *yawwwnie!*
<br><bitsNbytes> "BitsNbytes => ["Alcoholic", "druggie", "nerd"]
<br>*** _ciR_ has quit IRC (Ping timeout: 180 seconds)
<br><bitsNbytes> "lamest1 => ["Cool", "lame", "funny"]
<br><bitsNbytes> );
<br><bitsNbytes> $\ = "\n";
<br><bitsNbytes> print "<TABLE> <CAPTION>People I know</CAPTION>
<br>*** nskl has joined #bsrf
<br><bitsNbytes> print Tr (th [qw(people type)]);
<br><bitsNbytes> for $k (sort keys %hash) {
<br>*** Binary_Dealer has joined #bsrf
<br><blue|bestbuy> yummy.. I got an italian sub from 7-11
<br><Binary_Dealer> ppl =)
<br><Binary_Dealer> What's Up?
<br>*** blue|bestbuy is now known as bluehaze
<br>*** NIN_Dude has quit IRC (Quit: )
<br><bitsNbytes> print Tr(th($k), td( [sort @hash($k)}]));
<br><Binary_Dealer> somebody saw essex
<br><bitsNbytes> }
<br><Binary_Dealer> ??
<br><bluehaze> hehhe
<br><bluehaze> he was on last night
<br><Binary_Dealer> yes
<br><Binary_Dealer> today?
<br><bitsNbytes> print "</TABLE>;
<br><bluehaze> dunno
<br>*** NeoMeg has joined #bsrf
<br><bitsNbytes> this generates text like
<br><bitsNbytes> <TABLE> <CAPTION> People I have Known</CAPTION>
<br><bluehaze> is this the perl lecture?
<br><bitsNbytes> <TR><TH>People </TH>
<br><bitsNbytes> yep
<br><bluehaze> ok
<br>*** divinator has joined #bsrf
<br><bitsNbytes> so u see perl a small perl code can generate a neatly
formatted form with lists and tables
<br>*** div|busy has quit IRC (Local kill by divinator (get lost you damn
prick))
<br><bitsNbytes> u can generate a lengthy HTML form
<br>*** divinator has left #bsrf
<br>*** divinator has joined #bsrf
<br><bitsNbytes> full of lists and tables just by one statemet
<br>*** sohed has quit IRC (Quit: )
<br>*** phanatic has joined #bsrf
<br><bitsNbytes> print table caption(text), Tr(th [qw(text)])
<br><bluehaze> i got a question...
<br><bitsNbytes> map {tr(th($_), td( [sort @($hash)})
<br><bluehaze> can perl help us get laid?
<br><bluehaze> cuz I told everyone that it could
<br><bluehaze> and I just want to be sure
<br><bitsNbytes> u mean as in ****ed laid
<br><bluehaze> yes of course
<br><phanatic> yes
<br><bitsNbytes> yeah sur
<br><phanatic> bluehaze has never gotten laid
<br><bluehaze> cool
<br><phanatic> in his life
<br>*** HaloScan has quit IRC (Ping timeout: 180 seconds)
<br><phanatic> back to the pearl
<br><bluehaze> lol
<br><Norton> where can i learn to chain proxies??
<br><bitsNbytes> someone wanted to know redirection to other sites in
PERL-CGI
<br><bitsNbytes> certainly not here and not now .. sorry ;)
<br>*** Leper has joined #bsrf
<br><bitsNbytes> u use the redirect function
<br><bitsNbytes> I have a peice of code for that too
<br><bitsNbytes> i know i have become terrible and painsatakingly annoyingly
boring by now
<br><bitsNbytes> but hey .. that's me aight
<br><bitsNbytes> so plz bear
<br><phanatic> hey you're cool enough to do this, how can we complain?
<br><bitsNbytes> any one from the beginning still hangin around
<br>*** josh-hamster is now known as josh-hamsTERRORIST
<br><bitsNbytes> (dozin around would do.. :)
<br><bluehaze> I just got here
<br><bluehaze> so you gotta start over
<br><bitsNbytes> nooooooooo
<br><bluehaze> hehehe
<br><bitsNbytes> you have to ask questions and i answer them in short
.. after seeing the code that is
<br><bluehaze> oh
<br><bitsNbytes> so HERE COMES THE CODE
<br><bluehaze> well...
<br><bluehaze> oh
<br><bluehaze> ok
<br><phanatic> ok
<br><bitsNbytes> actually it is quite a skill to write code on the fly
and on demand
<br><bitsNbytes> i am trying to do so right now
<br>*** NeoMeg has quit IRC (Quit: )
<br><bitsNbytes> anywaz here it comes
<br>*** barcode has joined #bsrf
<br><bitsNbytes> #! /usr/bin/perl -w
<br><bitsNbytes> # orebounce - aprogram to redirect browser and set
a cookie
<br>*** wHiTE_zoMBIe has joined #bsrf
<br><bitsNbytes> use CGI qw(:cgi);
<br><bitsNbytes> $oreo = cookie (- NAME => 'filling',
<br><Norton> how big is X?
<br><bitsNbytes> -VALUE
=> "Lard Ass",
<br><bitsNbytes> -EXPIRES
=> '+3M',
<br><bitsNbytes> -DOMAIN =>
',perl.com');
<br>*** Leper has quit IRC (Quit: Leaving)
<br><bitsNbytes> $whithergo = "http://somewhere.perl.com/nothinghere.html';
<br>*** bluehaze has quit IRC (Quit: 15,1?ShowDowN v12 PrO?1 since
1996: 16,1http://www.sci.fi/~showdown/)
<br><bitsNbytes> print rediredt(-URL => $withergo,
<br><bitsNbytes>
-COOKIE => $oreo);
<br><bitsNbytes> well that was the code
<br><bitsNbytes> and that would produce something like
<br><bitsNbytes> Status: 302 Moved Temporarily
<br>*** wHiTE_zoMBIe has quit IRC (Quit: Client Exiting)
<br><bitsNbytes> Set-Cookie: filling=LardASS; domain= .perl.com;
<br><bitsNbytes> expires = DD-MM-YY Time GMT
<br>*** zwanderer has joined #Bsrf
<br><bitsNbytes> Date: day DD-MM-YY Time GMT
<br><bitsNbytes> Location: http://somewhere.perl.com/nothinghere.html
<br><bitsNbytes> Content-Type: text/html
<br><bitsNbytes> B<<balnk line here>>
<br><bitsNbytes> any questions
<br>
<hr SIZE=1 WIDTH="70%">
<center>End Of Lecture</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -