|
发表于 2003-11-7 21:00:11
|
显示全部楼层
我不是高手...
29.2.100. new
new CLASSNAME LIST
new CLASSNAME
There is no built-in new function. It is merely an ordinary constructor method (that is, a user-defined subroutine) that is defined or inherited by the CLASSNAME class (that is, package) to let you construct objects of type CLASSNAME. Many constructors are named "new", but only by convention, just to trick C++ programmers into thinking they know what's going on. Always read the documentation of the class in question so you know how to call its constructors; for example, the constructor that creates a list box in the Tk widget set is just called Listbox().
另:Perl提供内置的制式转换函数
29.2.103. oct
oct EXPR
oct
This function interprets EXPR as an octal string and returns the equivalent decimal value. If EXPR happens to start with "0x", it is interpreted as a hexadecimal string instead. If EXPR starts off with "0b", it is interpreted as a string of binary digits. The following will properly convert to numbers any input strings in decimal, binary, octal, and hex bases written in standard C or C++ notation:
$val = oct $val if $val =~ /^0/;
To perform the inverse function, use sprintf with an appropriate format:
$perms = (stat("filename"))[2] & 07777;
$oct_perms = sprintf "%lo", $perms;
The oct function is commonly used when a data string such as "644" needs to be converted into a file mode, for example. Although Perl will automatically convert strings into numbers as needed, this automatic conversion assumes base 10.
想写一个类似于web爬虫一类的程序,定期检查站点url的可连接性,但是对于那些要求登陆后才可见的web页,我怎样才能让它自动登陆,进行检查呢?
你可以看看perl-CGI类参考书中有关HTTP协议的章节。 |
|