Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 72 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
72
Dung lượng
6,44 MB
Nội dung
Chapter 8 Standard Modules 8.15 B::Disassembler Disassembles Perl bytecode. 8.14 B::Deparse 8.16 B::Lint [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.15 B::Disassembler http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_15.htm [2/7/2001 10:31:09 PM] Chapter 8 Standard Modules 8.16 B::Lint Provides program checking for Perl programs, equivalent to running Perl with the -w option. Named after the Unix lint program for checking C programs. Invoked as: perl -MO=Lint[,options] program program is the name of the Perl program to be checked. The options are separated by commas and follow normal backend option conventions. Most of the options are lint-check options, where each option is a word specifying one lint check. Preceding an option with no- turns off that option. Options specified later override earlier options. There is also one non-lint-check option, -u. Here is the list of available options: all Turns all warnings on. context Warns whenever an array is used in implicit scalar context. dollar-underscore Warns whenever $_ is explicitly used anywhere or whenever it is used as the implicit argument of a print statement. implicit-read Warns whenever an operation implicitly reads a Perl special variable. implicit-write Warns whenever an operation implicitly writes to a Perl special variable. none Turns off all warnings. private-names Warns whenever any variable, subroutine, or method name lives in a non-current package but begins with an underscore (_); doesn't warn about an underscore as a single-character name, e.g., $_. [Chapter 8] 8.16 B::Lint http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_16.htm (1 of 2) [2/7/2001 10:31:11 PM] regexp-variables Warns whenever one of the regular-expression variables $', $&, or $` is used. -u Package Normally checks only the main program code and all subroutines defined in package main; -u lets you specify other packages to be checked. undefined-subs Warns whenever an undefined subroutine is invoked. 8.15 B::Disassembler 8.17 B::Showlex [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.16 B::Lint http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_16.htm (2 of 2) [2/7/2001 10:31:11 PM] Chapter 8 Standard Modules 8.17 B::Showlex Shows lexical variables used in functions or files. Invoke as: perl -MO=Showlex[,sub] filename If sub is provided and is the name of a subroutine in file filename, B::Showlex prints the lexical variables used in that subroutine. Otherwise, it prints the file-scope lexicals in filename. 8.16 B::Lint 8.18 B::Stackobj [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.17 B::Showlex http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_17.htm [2/7/2001 10:31:12 PM] Chapter 8 Standard Modules 8.18 B::Stackobj Serves as a helper module for the CC backend. 8.17 B::Showlex 8.19 B::Terse [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.18 B::Stackobj http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_18.htm [2/7/2001 10:31:14 PM] Chapter 8 Standard Modules 8.19 B::Terse Walks the Perl syntax tree, printing terse information about the ops. Invoke as: perl -MO=Terse[,exec] filename If exec is specified, walks the tree in execution order instead of syntax order. 8.18 B::Stackobj 8.20 B::Xref [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.19 B::Terse http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_19.htm [2/7/2001 10:31:15 PM] Chapter 8 Standard Modules 8.20 B::Xref Perl compiler backend that generates a cross-reference listing of variables, subroutines, and formats in a Perl program. Results are grouped by file, then subroutine, then package, then objects within the package with line numbers. The line numbers are given as a comma-separated list. A line number may be preceded by one of the following code letters: Code Meaning % Subroutine or method call f Format definition i Introduction, e.g., a lexical defined with my s Subroutine definition Invoke B::Xref like this: perl -MO=Xref[,options] program program is the Perl program whose cross-reference you want. Options are separated by commas and follow normal backend option conventions. The possible options are: -D Specifies internal debug options. Most useful if specified with -r option. Debug options are: O Prints each operator as it's being processed, in the execution order of the program. t Prints the object on the top of the stack as it is being tracked. -ofilename Sends output to filename instead of STDOUT. -r Produces raw output in machine-readable form for each definition or use of a variable, subroutine, or format. [Chapter 8] 8.20 B::Xref http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_20.htm (1 of 2) [2/7/2001 10:31:17 PM] 8.19 B::Terse 8.21 base [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.20 B::Xref http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_20.htm (2 of 2) [2/7/2001 10:31:17 PM] Chapter 8 Standard Modules 8.21 base Provides a shortcut for setting up @ISA. You can say: use base qw(A B); instead of: BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar); } 8.20 B::Xref 8.22 Benchmark [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.21 base http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_21.htm [2/7/2001 10:31:18 PM] Chapter 8 Standard Modules 8.22 Benchmark Provides routines for timing the execution of your code and formatting the results. Inherits only from the Exporter class. Its functions are: new● clearallcache● clearcache● debug● disablecache● enablecache● timediff● timeit● timestr● timethese● timethis● 8.21 base 8.23 blib [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8.22 Benchmark http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly/perl/perlnut/ch08_22.htm [2/7/2001 10:31:19 PM] [...]... http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly /perl/ perlnut/ch08_ 25. htm [2/7/2001 10:31:22 PM] [Chapter 8] 8.26 CGI::Apache Chapter 8 Standard Modules 8.26 CGI::Apache Sets up the environment for using CGI.pm with the Perl- Apache API The new constructor for this class creates an Apache::CGI class object that interfaces to the API 8. 25 CGI 8.27 CGI::Carp [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl. .. scalar value2; 8.33 Config 8. 35 CPAN [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly /perl/ perlnut/ch08_34.htm [2/7/2001 10:31: 35 PM] [Chapter 8] 8. 35 CPAN Chapter 8 Standard Modules 8. 35 CPAN Lets you access CPAN; search for a module, a bundle, an author,... information on using it interactively and for details of the available commands These commands, available interactively from the shell, are methods of the class CPAN::Shell From a program, they are available both as methods (e.g., CPAN::Shell->install( )) and as functions in the calling package (e.g., install( )) Each of the commands that produce listings of modules (r, autobundle, and u) returns a list of... itself define a new method) Each element in the struct data has an accessor method, which is used to assign to the element and to fetch its value The default accessor can be overridden by declaring a sub of the same name in the package Each element's type can be scalar, array, hash, or class q struct 8.31 CGI::Switch 8.33 Config [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32... distributions Bundles are treated specially in the CPAN package When you tell CPAN to install a bundle, it installs all the modules in the CONTENTS section of the pod You can install your own bundles locally by placing a conforming bundle file somewhere in your @INC path The autobundle command available in the shell interface does that for you by including all currently installed modules in a snapshot bundle... set, Data::Dumper outputs single, non-self-referential values as atoms or terms rather than as statements $VARn names are avoided as much as possible Such output may not be parsable by eval $Data::Dumper::Toaster $obj->Toaster([newval]) If set to a method name, Data::Dumper issues a method call for any objects that are to be dumped using the syntax bless(data, class)->method() Set to an empty string... running with the same Perl version as the one that created the hash The index into the hash is the shell variable name %Config is always exported; the following three functions are exported on request: q config_sh q config_vars q myconfig 8.32 Class::Struct 8.34 constant [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl. .. sources are deleted with the same FIFO mechanism 8. 35. 2 Bundles are The CPAN module recognizes a bundle as a Perl module in the namespace Bundle:: that does not define any functions or methods and usually contains only pod documentation It starts like a Perl module with a package declaration and a $VERSION variable After that the pod section looks like any other pod with the difference that it contains a. .. 10:31:20 PM] [Chapter 8] 8.24 Carp Chapter 8 Standard Modules 8.24 Carp Provides routines for generating error messages Its subroutines generally report errors from the perspective of the calling program Its functions are: q carp q cluck q confess q croak 8.23 blib 8. 25 CGI [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook... scripts as persistently running processes CGI::Fast provides a new constructor to create a CGI object that runs in this environment FastCGI requires both a server and a version of Perl that are FastCGI enabled See www.fastcgi.com for more information 8.28 CGI::Cookie 8.30 CGI::Push [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming . file-scope lexicals in filename. 8.16 B::Lint 8.18 B::Stackobj [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook. Module. 8.24 Carp 8.26 CGI::Apache [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [Chapter 8] 8. 25 CGI http://www.crypto.nc1uw1aoi420d85w1sos.de/documents/oreilly /perl/ perlnut/ch08_ 25. htm. PM] Chapter 8 Standard Modules 8.23 blib Pragma for testing programs against a package before the package has been installed. Given a directory path, blib starts in that directory to look for a