ActivePerlIt is a tool software that allows you to execute Perl programs at will. It includes four sets of development tool programs including Perl for Win32, Perl for ISAPI, PerlScript, and Perl Package Manager. It allows you to write programs suitable for unix, windows, and linux systems. CGI program comes.
ActivePerl features
The core of Perl
Perl Package Manager
Installation program
Complete online documentation
Additional features of Windows version:
Perl supports ISAPI
PerlEx
PerlScript
PerlEz
ActivePerl installation method
1. After decompressing the official version of ActivePerl, run the installation package.
2. Click Next.
3. Select [Modify] to install. After the installation is complete, check whether the installation is successful through cmd.
4. Enter the command [perl -v], the following prompt will appear, and the installation is successful.
How to use ActivePerl
1. Use ActivePerl to write a HelloWorld on Windows. After the test is completed, we create a file on the C drive.
HelloWorld.pl
2. Right-click the HelloWorld.pl file -> open the file with Notepad, and then enter the following code:
#!/usr/bin/env perl
Print "HelloWorld"
3. Then save
4. Return to the cmd command prompt.
cd
Return to the root directory of drive C
Perl HelloWorld.pl
Or type HelloWorld.pl directly
Explain: the role of 2 lines of code
#!/usr/bin/env perl is a typical interpreter path declaration (magic declaration). If cross-platform is considered and used on Unix/Linux, this declaration must be added. If it is simply used on Windows, When learning Perl, this statement is irrelevant.
Print "HelloWorld" is a statement, its function is to output a string on the screen, and the content inside "" is a string. For example, friends can try to modify the content inside "".
ActivePerl FAQ
Solve the problem of ActivePerl output Chinese garbled characters
Take ActivePerl on Windows as an example. The editor's code is very simple. It just prints "Hello", but garbled characters appear, as shown in the picture.
When we encounter such a problem, what should we do?
1. It is actually a problem with perl encoding, which is actually related to the encoding of our operating system. We open the cmd command prompt and enter chcp to obtain the encoding type code. It can be seen that the windows codenamed by the editor here is 936 as the default encoding format.
2. Then we can see that the 936 code page corresponds to gb2313 (i.e. Chinese), or gbk.
3. We know that our windows are encoded with gb2312. At this time, we only need to change the encoding format.
4. Enter at the head of the code:
Use utf8;
#Introduce the utf8 module. The strings in the script use utf8 as the encoding format.
Binmode(STDOUT,":encoding(gbk)");
#Standard output uses gbk as the encoding format, you can also change gbk to gb2312
Binmode(STDIN,":encoding(gbk)");
#If it involves input streams, such as reading files, reading Chinese files without adding this will cause garbled characters.
Binmode(STDERR,":encoding(gbk)");
#If the string in the exception error has Chinese characters, please add STDERR, otherwise garbled characters will also appear.
Print "Hello"
5. Will it be possible to output Chinese normally at this time?
6. Be sure to note that if the code involves reading Chinese files, you must add binmode(STDIN,":encoding(gbk)");
Perl and StrawberryPerl vs. ActivePerl
Perl is the abbreviation of Practical Extraction and Report Language "Practical Report Extraction Language". ActiveStatePerl and Strawberry Perl Compilers for Perl on Windows platforms. The relationship between Perl and the latter two is that the C language and the Linux system have their own GCC.
The biggest difference between ActiveState Perl and Strawberry Perl is that Strawberry Perl contains many modules from CPAN, so the installation file downloaded by Strawberry Perl is more than 80M, while ActiveState Perl is only about 20M. ActiveState Perl: ActiveState provides a free community version and a commercially supported Perl binary distribution for Win32 and Perl. Strawberry Perl: 100% open source Perl for Windows, no binary packages required to use modules from CPAN.
ActivePerl includes four sets of development tool programs including Perl for Win32, Perl for ISAPI, PerlScript, and Perl Package Manager, which allows users to write CGI programs suitable for unix, windows, and linux systems.
Summary: Users can choose the appropriate software to download and use according to their own needs.
ActivePerl update log
1. Optimized some functions
2. Solved many unbearable bugs
Huajun editor recommends:
ActivePerl (32bit) has always been the most commonly used software by most netizens. Huajun Software Park also has appmaker, .NET, Cloud Machine Manager, etc., which are also very popular software among netizens. You can download it from Huajun Software Park!