PEAR: Common Modules

Source: Internet
Author: User
Tags benchmark crypt naming convention pear php code php script
In the previous article, we introduced the concept of pear, coding rules, simple use method, you may have a preliminary understanding of it. This time, we'll introduce the functionality and usage of some of the modules in the existing Pear library.
First, naming convention
Before we get to the existing Pear module, let's take a look at how Pear organizes its classification and naming conventions. The modules in pear are organized in the same way as CPAN, and each module's related files are placed under its own category directory, and some are placed directly under the root directory of pear (a single file). Because Pear does not have a namespace like Java, so your class name should be able to reflect the relationship between your module name or the parent class name, keep a certain agreement, for example, your module name: "Mp3/common", then, your PHP file should be located in: mp3/common.php, The class name of your module should be: Mp3_common. In general, if your module is based on an existing module, it is recommended to put your existing module under the same directory. If you are designing a new class and module, you can create a new directory yourself, or put it under the same directory for similar purposes. For example, you have a new module for processing logs, it is recommended that you put it under the log/, the application module for log processing, if the new module is used to deal with MP3, then you can create a new directory MP3, placed under the MP3 directory.
Two, existing pear module
Since most of pear's modules are still under development, here is a list of the modules in pear that are published along with php4.05, and it should be noted that some abstract classes or base classes (such as mail.php,log.php,cache.php) are not enumerated. We're just focusing on modules that have specific functions. Here is a list of these modules:
Benchmark/timer Test your PHP code for operational efficiency
Benchmark/benchmark_iterate test the performance of a function when you loop through it
Cache/output can cache the output of your PHP script, you can cache it in a variety of ways (there are files, databases, or shared memory), if you use this module to increase the load on the server, so if you want to use the cache of dynamic scripts to provide efficiency, you might as well be using Zend Optimize, this module may not be suitable for
Cache/graphics can cache pictures that you need to dynamically output
Console/getopt the processing module of command line arguments
CMD a virtual shell that can be used to run some system commands
CRYPT/CBC implementation of Perl CRYPT::CBC module simulation
Crypt/hcemd5 to implement Perl CRYPT::HCE_MD5 module functions

DATE/CALC implementation date-related operations
The conversion of Date/human Human calendar
DB provides a unified, abstract database operation layer with back-end support for multiple databases
File/find File Lookup
FILE/PASSWD manipulate password classes of files, such as Password,httppass,cvspassword

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.