Perl - ArchWiki
文章推薦指數: 80 %
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation written in the ...
HomePackagesForumsWikiBugsSecurityAURDownload
Jumptocontent
Namespaces
PageDiscussion
English
expanded
collapsed
Views
ReadViewsourceViewhistory
More
expanded
collapsed
Navigation
MainpageTableofcontentsGettinginvolvedWikinewsRandompage
Interaction
HelpContributingRecentchangesRecenttalksNewpagesStatisticsRequests
Tools
WhatlinkshereRelatedchangesSpecialpagesPrintableversionPermanentlinkPageinformation
Relatedarticles
PerlPolicy
Perlpackageguidelines
mod_perl
FromWikipedia:
Perlisafamilyofhigh-level,general-purpose,interpreted,dynamicprogramminglanguages.ThelanguagesinthisfamilyincludePerl5andRaku(formerlyPerl6).
ThePerllanguagesborrowfeaturesfromotherprogramminglanguagesincludingC,shellscript(sh),AWK,andsed.Theyprovidepowerfultextprocessingfacilitieswithoutthearbitrarydata-lengthlimitsofmanycontemporaryUnixcommandlinetools,facilitatingeasymanipulationoftextfiles.Perl5gainedwidespreadpopularityinthelate1990sasaCGIscriptinglanguage,inpartduetoitsthenunsurpassedregularexpressionandstringparsingabilities.
Contents
1Installation
2Commands
3Packagemanagement
3.1pacmanandAUR
3.2CPAN.pm
3.2.1Configuringcpan
3.2.2Usageexamples
4Widgetbindings
5Tipsandtricks
5.1Improvedmodulemanagement
5.1.1cpanminus
5.1.2ucpan
5.1.3Bundle::CPAN
5.2Re-runcpanconfiguration
5.3Createnewmodule
5.3.1module-starter
6Seealso
6.1Perl5
6.2Raku
6.3CPAN
6.4Tutorials
6.5Miscellaneous
Installation
Installtheperlpackage.
Commands
ThePerllanguageinterpreter:
$perl
Perlbugreporting:
$perlbug
LookupthePerldocumentationinPODformat:
$perldoc
SendthePerlauthorsandmaintainersathankyoumessage:
$perlthanks
Packagemanagement
TheComprehensivePerlArchiveNetwork(CPAN)isarepositoryofover250,000softwaremodulesandaccompanyingdocumentationwritteninthePerlprogramminglanguagebyover12,000contributors.
CPANisalsothenameofaPerlmodule,CPAN.pm,whichisusedtodownloadandinstallPerlsoftwarefromtheCPANarchive.
pacmanandAUR
AnumberofpopularCPANmodulesareavailableaspackagesintheArchrepositories.TherearefurthermodulesavailableintheAUR.
CPAN.pm
TheCPAN.pmmoduleisincludedwithPerl.ItcanbeusedinteractivelyfromtheshellorinPerlscripts.
Configuringcpan
Beforefirstuse,themoduleneedstobeconfigured.Thisisdoneinteractivelyfromtheshellwith(someoutputomitted):
$cpan
CPAN.pmrequiresconfiguration,butmostofitcanbedoneautomatically.
Ifyouanswer'no'below,youwillenteraninteractivedialogforeach
configurationoptioninstead.
Wouldyouliketoconfigureasmuchaspossibleautomatically?[yes]
Automatedconfigurationwillsuitmostusers.Answeringyes,theconfigurationwillcontinuewith:
Toinstallmodules,youneedtoconfigurealocalPerllibrarydirectoryor
escalateyourprivileges.CPANcanhelpyoubybootstrappingthelocal::lib
moduleorbyconfiguringitselftouse'sudo'(ifavailable).Youmayalso
resolvethisproblemmanuallyifyouneedtocustomizeyoursetup.
Whatapproachdoyouwant?(Choose'local::lib','sudo'or'manual')
[local::lib]
Ifyouwantcpantoinstallmodulesinyourhomedirectorychooselocal::lib.Toinstallthemsystem-widechoosesudo.Choosingsudotheconfigurationends:
Autoconfigurationcomplete.
commit:wrote'/home/username/.cpan/CPAN/MyConfig.pm'
Choosingthelocal::liboptionwillresultinadditionmodulesbeinginstalled.
Choosingnottouseautomatedconfigurationallowstheusertosetcpanoptionsinteractivelyintheshell.Thetablebelowshowssomeoptionnameswithabriefdescriptionanddefaultvalue.Moredetailedinformationisdisplayedforeachoptionduringconfiguration.
Name
Description
Default
cpan_home
CPANbuildandcachedirectory
$HOME/.cpan
keep_source_where
Downloadtargetdirectory
$HOME/.cpan/sources
build_dir
Buildprocessdirectory
$HOME/.cpan/build
prefs_dir
Customizablemodulesoptionsdirectory
$HOME/.cpan/prefs
build_cache
Cachesizeforbuilddirectory
100MB
cleanup_after_install
Removebuilddirectoryaftersuccessfulinstall
No
shell
Preferredshell
/bin/bash
halt_on_failure
Haltonfailure
No
colorize_output
Turnoncoloredoutput
No
histfile
Historyfilelocation
$HOME/.cpan/histfile
histsize
Historyfilesize
100lines
Theconfigurationfile$HOME/.cpan/CPAN/MyConfig.pmcanbeeditedwithyourtexteditorofchoice.
Usageexamples
Tosimplyinstallamodulespassthemasparameterstocpan(multiplemodulenamesareseparatedbyspaces):
$cpanAcme::MetaSyntactic
Thefollowingexamplesareallinthecpaninteractiveshell,startedwith:
$cpan
Displayinformationonamodule:
cpan[1]>mAcme::MetaSyntactic
Reading'/home/username/.cpan/Metadata'
DatabasewasgeneratedonFri,08Dec201702:17:03GMT
Moduleid=Acme::MetaSyntactic
CPAN_USERIDBOOK(PhilippeBruhat(BooK)
延伸文章資訊
- 1perl-module-build 0.4231-7 (any) - Arch Linux
Architecture: any. Repository: Extra. Description: Build, test, and install Perl modules. Upstrea...
- 2perl-io-socket-ssl 2.075-1 (any) - Arch Linux
- 3perl 5.36.0-1 (x86_64) - Arch Linux
Architecture: x86_64. Repository: Core. Description: A highly capable, feature-rich programming l...
- 4perl-json 4.10-1 (any) - Arch Linux
- 5perl-archive-zip 1.68-7 (any) - Arch Linux
Architecture: any. Repository: Extra. Description: Provide a perl interface to ZIP archive files....