| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> perl >> Linux huan jing zhong de Mod_perl bian cheng jie shao

Linux huan jing zhong de Mod_perl bian cheng jie shao

2008-05-19 06:25:51 编辑來源:互联网 评论
 
 
 
本文为【Linux环境中的Mod_perl编程介绍】的拼音翻译版
  1. jie shao xing zhi nan
  mod_perl shi ge pang da er fu duo de gong ju , ta nei jian le xu duo mo kuai bang zhu ni fang bian di gou jian dong tai wang zhan 。 zhe pian zhi nan de mu de shi bang zhu ni gou jian yi ge liang hao de mod_perl mo kuai , bing cong zhong li jie mod_perl de shi xian ji shu 。 wo bing bu tui jian shi yong zhe li jie shao de ji shu lai jian li yi ge da xing zhan dian , you qi dui yu yi ge gang gang she zu mod_perl de ren lai shuo 。 dan wo tui jian da jia ke yi shen ru kan yi xia ta de yi xie nei jian de fang an , bi ru Mason, AxKit, EmbPerl, Apache::ASP he PageKit deng deng 。
  1.1. ni xu yao shen me ?
  ben zhi nan jia she ni yi jing you guo an zhuang he ce shi mod_perl de jing yan 。 yi ji jiao xin ban ben de Apache de an zhuang jing yan 。 yin wei you ke neng ni xu yao zai ni de ji qi shang shi xian shi shi dang de xiu gai ben wen ti gong de pei zhi 。 wo men xu yao ni an zhuang yi xie mo kuai bing qie xu yao jin ru Apache de pei zhi mu lu zuo xiu gai 。 suo yi zui hao ni you root quan xian lai zuo zhe xie shi qing 。 dang ran ni huan xu yao yi ge wen ben bian ji qi 。
  1.2. qie ru zheng ti
  mod_perl mo kuai ye shi Perl mo kuai , dan ta you jiao wei te bie de she ji 。 zui fang bian de chuang jian yi ge Perl mo kuai de fang fa jiu shi shi yong biao zhun de Perl fen fa zi dai de gong ju h2xs 。 ni ke yi zai ming ling xing mo shi jian ru h2xs lai kan kan ta de shen shu lie biao 。 xian zai , dao yi ge shi dang de mu lu kai shi yi ge xin xiang mu , jian ru :
  h2xs -A -X -n Apache::Tutorial::First
  h2xs jiang hui chuang jian mu lu Apache, yi ji qi ta yi xie zi mu lu . xian zai jin ru zui shen yi ji de mu lu kan kan :
  cd Apache/Tutorial/First
  zai zhe ge xin mu lu li mian , ni ke yi kan dao 5 ge wen jian : Changes, First.pm, MANIFEST, Makefile.PL he test.pl。 ta men de zuo yong ru xia :
  Changes
  zhe ge wen jian zuo wei ni de xiang mu de xiu gai ri zhi (changelog) wen jian
  First.pm
  zhe shi zhu mo kuai wen jian , bao han ni de mod_perl ju bing dai ma (handler code)。
  MANIFEST
  ben wen jian yong yu zi dong gou jian tar.gz lei xing de mo kuai ban ben fen fa 。 zhe yang ni jiu ke yi ba ni de mo kuai na dao CPAN fa bu huo zhe fen fa gei qi ta ren 。 ta bao han le ni zai zhe ge xiang mu zhong suo you wen jian de lie biao 。
  Makefile.PL
  zhe shi biao zhun de Perl Makefile gou zao qi 。 yong yu chuang jian Makefile.PL wen jian lai bian yi gai mo kuai 。
  test.pl
  zhen dui gai mo kuai de yi xie ce shi jiao ben 。 mo ren qing kuang xia ta zhi shi jian cha mo kuai de bian yi he zai ru
  hao le , xian zai wo men kai shi ba First.pm bian wei ke gong zuo de mod_perl mo kuai 。 shi yong wen ben bian ji qi da kai gai wen jian , xiu gai hou de nei rong ru xia :
  package Apache::Tutorial::First;
  use strict;
  use vars qw/$VERSION/;
  use Apache::Constants;
  $VERSION = 0.01;
  sub handler {
  my $r = shift;
  $r-send_http_header('text/html');
  print "<html<bodyHello World</body</html";
  return OK;
  }
  1;
  bu yao wang ji wen jian mo yi de "1;", dui yu Perl lai shuo , yi ge mo kuai zui hou fan hui de fei ling zhi biao shi gai mo kuai yi jing bei cheng gong bian yi 。
  1.3. an zhuang ni de mo kuai
  h2xs gong ju shi wo men de mo kuai an zhuang gong zuo ji wei fang bian 。 zai he ni de First.pm wen jian xiang tong de mu lu zhong 。、, jian ru :
  perl Makefile.PL
  make
  make test
  ru guo make test cheng gong de hua , ni xu yao yi root shen fen zhi xing :
  make install
  zhe yang ni jiu ba ni de mo kuai an zhuang dao le perl de ku mu lu (library directory)。
  1.4. tian jia gai mo kuai wei Apache de yi ge ju bing (handler) xian zai wo men xu yao jin ru Apache pei zhi mu lu lai xiu gai pei zhi wen jian , shi wo men de mo kuai zuo wei Apache nei rong chu li jie duan de chu li qi 。 da kai httpd.conf wen jian , zai mo yi jia ru ru xia pei zhi :
  <Location /mod_perl_tutorial
  SetHandler perl-script
  PerlHandler Apache::Tutorial::First
  </Location
  ran hou bao cun pei zhi wen jian , bing qie chong xin qi dong apache fu wu qi :
  apachectl stop
  apachectl start
  xian zai shi yong liu lan qi fang wen http://localhost/mod_perl_tutorial , ni jiang ru qi de kan dao xian shi "Hello World" ye mian 。
  2. zhe li dou fa sheng le xie shen me ?
  hao , zai zhe li dou fa sheng le shen me shi qing ne ?
  dang Apache qi dong de shi hou , ta du qu ta de pei zhi zhi ling bing ba shi dang de ming ling chuan di gei xiang ying de chu li gai ming ling de mo kuai 。 zhe li you liang ge xiang guan de zhi ling SetHandler he PerlHandler.
  di yi ge zhi ling SetHandler you mod_mime mo kuai chu li , gai zhi ling biao shi shi yong shen me mo kuai zuo wei chu li qing qiu de zhu yao bu fen 。 zhe li suo she zhi de perl-script biao shi shi yong mod_perl lai chu li qing qiu 。
  di er ge zhi ling PerlHandler you mod_perl mo kuai lai chu li , ta zhi shi jian dan de shuo ming shi yong wo men de mo kuai lai chu li qing qiu de zhu yao bu fen 。 you yi dian xu yao zhu yi , wu lun he shi zai ni you yi ge PerlHandler shi , ni xu yao xiang ying de SetHandler perl-script pei zhi zhi ling 。 zhe yang cai neng shi ni de mod_perl dai ma qi zuo yong 。 wo zong shi ren wei zhe shi yi ge ruo dian , dan zhe jiang she ji Apache nei bu de chu li ji zhi , suo yi zai jiang lai zhe ye hen nan gai bian 。
  xian zai qing qiu lai le ,Apache cha kan yong shen me mo kuai lai chu li xiang ying de URI bing qie zai zhe li jue ding shi yong mod_perl, er mod_perl zhi dao ta bi xu ba qing qiu fa song gei wo men de mo kuai , bing tiao yong wo men mo kuai de handler() han shu zuo wei Apache::Request dui xiang de di yi ge shen shu 。 er wo men de handler() han shu de fan hui zhi jue ding le xia yi bu Apache jiang yao zuo shen me 。 xian zai wo men zhi dao fan hui zhi OK yi wei zhe yi qie cheng gong 。 OK shi ge cong Apache::Constants mo kuai dao chu de chang liang 。
  3. tiao shi
  ru guo ni mei you kan dao "Hello World", na ni ke neng kan dao le yi ge cuo wu ye mian , huo zhe qi ta shen me wan quan bu tong de 。 di yi bu qu cha kan cuo wu ri zhi kan kan dao di shi shen me fa sheng le cuo wu 。 wo xi guan yu zai liu lan qi zhong qing qiu hou li ji cha kan cuo wu ri zhi 。 ni ke yi shi yong tail gong ju :
  tail -f /path/to/apache/logs/error_log
  ( shi yong ni de zhen shi error_log lu jing ti huan shang mian de lu jing 。 ru guo ni bu ken ding ta zai na li , cha kan ni de httpd.conf wen jian de ErrorLog zhi ling bu fen )
  xian zai chong xin zai ru ye mian , ran hou error_log jiang gao su ni shen me di fang chu xian le wen ti 。 geng duo de guan yu perl tiao shi , qing shen jian perldebug.
  4. jia ru geng duo
  xian zai ru guo ni xiang yao zhen dui shang mian de qing kuang zuo yi xie xiu gai , gai ru he zuo ne ? bu xing de , wei yi yi zhong an zhuang mo shi ru xia :
  xiu gai ni de First.pm wen jian
  chong xin yi root shen fen yun xing make install
  chong xin qi dong Apache
  zhe ye xu hen ma fan , te bie shi chong xin qi dong Apache。 zhen dui zhe ge wen ti , wo men ke yi ling wai an zhuang yi ge te bie she ji de mo kuai lai bi mian mei ci zhe yang ma fan de zuo 。 shou xian ni xu yao cong CPAN xia zai bing an zhuang Apache::Reload mo kuai ( chu fei ni yi jing shi yong mod_perl 1.26 huo zhe geng gao ban ben )。 zai zhe li http://search.cpan.org/search?dist=Apache-Reload xia zai 。
  jie kai tar.gz wen jian bing jin ru xin mu lu , zhi xing :
  perl Makefile.PL
  make
  ran hou dao root shen fen zhi xing :
  make install
  xian zai zai ci da kai httpd.conf wen jian , jia ru :
  PerlInitHandler Apache::Reload
  zhe jiang ce shi suo you you suo gai bian de mo kuai bing zai bi yao shi zi dong chong xin zai ru xin mo kuai 。 zhe dui yu kai fa lai shuo hen you yong , dan hui you xing neng sun shi , suo yi zai kai fa wan cheng zhi hou , jiu jiang gai te xing guan bi 。
  【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
  1. jie shao xing zhi nan   mod_perl shi ge pang da er fu duo de gong ju , ta nei jian le xu duo mo kuai bang zhu ni fang bian di gou jian dong tai wang zhan 。 zhe pian zhi nan de mu de shi bang zhu ni gou jian yi ge liang hao de mod_perl mo kuai , bing cong zhong li jie mod_perl de shi xian ji shu 。 wo bing bu tui jian shi yong zhe li jie shao de ji shu lai jian li yi ge da xing zhan dian , you qi dui yu yi ge gang gang she zu mod_perl de ren lai shuo 。 dan wo tui jian da jia ke yi shen ru kan yi xia ta de yi xie nei jian de fang an , bi ru Mason, AxKit, EmbPerl, Apache::ASP he PageKit deng deng 。   1.1. ni xu yao shen me ?    ben zhi nan jia she ni yi jing you guo an zhuang he ce shi mod_perl de jing yan 。 yi ji jiao xin ban ben de Apache de an zhuang jing yan 。 yin wei you ke neng ni xu yao zai ni de ji qi shang shi xian shi shi dang de xiu gai ben wen ti gong de pei zhi 。 wo men xu yao ni an zhuang yi xie mo kuai bing qie xu yao jin ru Apache de pei zhi mu lu zuo xiu gai 。 suo yi zui hao ni you root quan xian lai zuo zhe xie shi qing 。 dang ran ni huan xu yao yi ge wen ben bian ji qi 。   1.2. qie ru zheng ti   mod_perl mo kuai ye shi Perl mo kuai , dan ta you jiao wei te bie de she ji 。 zui fang bian de chuang jian yi ge Perl mo kuai de fang fa jiu shi shi yong biao zhun de Perl fen fa zi dai de gong ju h2xs 。 ni ke yi zai ming ling xing mo shi jian ru h2xs lai kan kan ta de shen shu lie biao 。 xian zai , dao yi ge shi dang de mu lu kai shi yi ge xin xiang mu , jian ru :   h2xs -A -X -n Apache::Tutorial::First   h2xs jiang hui chuang jian mu lu Apache, yi ji qi ta yi xie zi mu lu . xian zai jin ru zui shen yi ji de mu lu kan kan :   cd Apache/Tutorial/First    zai zhe ge xin mu lu li mian , ni ke yi kan dao 5 ge wen jian : Changes, First.pm, MANIFEST, Makefile.PL he test.pl。 ta men de zuo yong ru xia :   Changes    zhe ge wen jian zuo wei ni de xiang mu de xiu gai ri zhi (changelog) wen jian   First.pm    zhe shi zhu mo kuai wen jian , bao han ni de mod_perl ju bing dai ma (handler code)。   MANIFEST    ben wen jian yong yu zi dong gou jian tar.gz lei xing de mo kuai ban ben fen fa 。 zhe yang ni jiu ke yi ba ni de mo kuai na dao CPAN fa bu huo zhe fen fa gei qi ta ren 。 ta bao han le ni zai zhe ge xiang mu zhong suo you wen jian de lie biao 。   Makefile.PL    zhe shi biao zhun de Perl Makefile gou zao qi 。 yong yu chuang jian Makefile.PL wen jian lai bian yi gai mo kuai 。   test.pl    zhen dui gai mo kuai de yi xie ce shi jiao ben 。 mo ren qing kuang xia ta zhi shi jian cha mo kuai de bian yi he zai ru    hao le , xian zai wo men kai shi ba First.pm bian wei ke gong zuo de mod_perl mo kuai 。 shi yong wen ben bian ji qi da kai gai wen jian , xiu gai hou de nei rong ru xia :   package Apache::Tutorial::First;   use strict;   use vars qw/$VERSION/;   use Apache::Constants;   $VERSION = 0.01;   sub handler {   my $r = shift;   $r-send_http_header('text/html');   print "<html<bodyHello World</body</html";   return OK;   }   1;    bu yao wang ji wen jian mo yi de "1;", dui yu Perl lai shuo , yi ge mo kuai zui hou fan hui de fei ling zhi biao shi gai mo kuai yi jing bei cheng gong bian yi 。   1.3. an zhuang ni de mo kuai   h2xs gong ju shi wo men de mo kuai an zhuang gong zuo ji wei fang bian 。 zai he ni de First.pm wen jian xiang tong de mu lu zhong 。、, jian ru :   perl Makefile.PL   make   make test    ru guo make test cheng gong de hua , ni xu yao yi root shen fen zhi xing :   make install    zhe yang ni jiu ba ni de mo kuai an zhuang dao le perl de ku mu lu (library directory)。   1.4. tian jia gai mo kuai wei Apache de yi ge ju bing (handler) xian zai wo men xu yao jin ru Apache pei zhi mu lu lai xiu gai pei zhi wen jian , shi wo men de mo kuai zuo wei Apache nei rong chu li jie duan de chu li qi 。 da kai httpd.conf wen jian , zai mo yi jia ru ru xia pei zhi :   <Location /mod_perl_tutorial   SetHandler perl-script   PerlHandler Apache::Tutorial::First   </Location    ran hou bao cun pei zhi wen jian , bing qie chong xin qi dong apache fu wu qi :   apachectl stop   apachectl start    xian zai shi yong liu lan qi fang wen http://localhost/mod_perl_tutorial , ni jiang ru qi de kan dao xian shi "Hello World" ye mian 。   2. zhe li dou fa sheng le xie shen me ?    hao , zai zhe li dou fa sheng le shen me shi qing ne ?    dang Apache qi dong de shi hou , ta du qu ta de pei zhi zhi ling bing ba shi dang de ming ling chuan di gei xiang ying de chu li gai ming ling de mo kuai 。 zhe li you liang ge xiang guan de zhi ling SetHandler he PerlHandler.    di yi ge zhi ling SetHandler you mod_mime mo kuai chu li , gai zhi ling biao shi shi yong shen me mo kuai zuo wei chu li qing qiu de zhu yao bu fen 。 zhe li suo she zhi de perl-script biao shi shi yong mod_perl lai chu li qing qiu 。    di er ge zhi ling PerlHandler you mod_perl mo kuai lai chu li , ta zhi shi jian dan de shuo ming shi yong wo men de mo kuai lai chu li qing qiu de zhu yao bu fen 。 you yi dian xu yao zhu yi , wu lun he shi zai ni you yi ge PerlHandler shi , ni xu yao xiang ying de SetHandler perl-script pei zhi zhi ling 。 zhe yang cai neng shi ni de mod_perl dai ma qi zuo yong 。 wo zong shi ren wei zhe shi yi ge ruo dian , dan zhe jiang she ji Apache nei bu de chu li ji zhi , suo yi zai jiang lai zhe ye hen nan gai bian 。    xian zai qing qiu lai le ,Apache cha kan yong shen me mo kuai lai chu li xiang ying de URI bing qie zai zhe li jue ding shi yong mod_perl, er mod_perl zhi dao ta bi xu ba qing qiu fa song gei wo men de mo kuai , bing tiao yong wo men mo kuai de handler() han shu zuo wei Apache::Request dui xiang de di yi ge shen shu 。 er wo men de handler() han shu de fan hui zhi jue ding le xia yi bu Apache jiang yao zuo shen me 。 xian zai wo men zhi dao fan hui zhi OK yi wei zhe yi qie cheng gong 。 OK shi ge cong Apache::Constants mo kuai dao chu de chang liang 。   3. tiao shi    ru guo ni mei you kan dao "Hello World", na ni ke neng kan dao le yi ge cuo wu ye mian , huo zhe qi ta shen me wan quan bu tong de 。 di yi bu qu cha kan cuo wu ri zhi kan kan dao di shi shen me fa sheng le cuo wu 。 wo xi guan yu zai liu lan qi zhong qing qiu hou li ji cha kan cuo wu ri zhi 。 ni ke yi shi yong tail gong ju :   tail -f /path/to/apache/logs/error_log   ( shi yong ni de zhen shi error_log lu jing ti huan shang mian de lu jing 。 ru guo ni bu ken ding ta zai na li , cha kan ni de httpd.conf wen jian de ErrorLog zhi ling bu fen )    xian zai chong xin zai ru ye mian , ran hou error_log jiang gao su ni shen me di fang chu xian le wen ti 。 geng duo de guan yu perl tiao shi , qing shen jian perldebug.   4. jia ru geng duo    xian zai ru guo ni xiang yao zhen dui shang mian de qing kuang zuo yi xie xiu gai , gai ru he zuo ne ? bu xing de , wei yi yi zhong an zhuang mo shi ru xia :    xiu gai ni de First.pm wen jian    chong xin yi root shen fen yun xing make install    chong xin qi dong Apache    zhe ye xu hen ma fan , te bie shi chong xin qi dong Apache。 zhen dui zhe ge wen ti , wo men ke yi ling wai an zhuang yi ge te bie she ji de mo kuai lai bi mian mei ci zhe yang ma fan de zuo 。 shou xian ni xu yao cong CPAN xia zai bing an zhuang Apache::Reload mo kuai ( chu fei ni yi jing shi yong mod_perl 1.26 huo zhe geng gao ban ben )。 zai zhe li http://search.cpan.org/search?dist=Apache-Reload xia zai 。    jie kai tar.gz wen jian bing jin ru xin mu lu , zhi xing :   perl Makefile.PL   make    ran hou dao root shen fen zhi xing :   make install    xian zai zai ci da kai httpd.conf wen jian , jia ru :   PerlInitHandler Apache::Reload    zhe jiang ce shi suo you you suo gai bian de mo kuai bing zai bi yao shi zi dong chong xin zai ru xin mo kuai 。 zhe dui yu kai fa lai shuo hen you yong , dan hui you xing neng sun shi , suo yi zai kai fa wan cheng zhi hou , jiu jiang gai te xing guan bi 。   
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
玉美人_珠联璧合
清纯美女米卡
清新靓丽的早晨
玲子的自信与性感
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有