NAME
WWW::Baidu::Record - Record object representing an item in baidu.com's search results
VERSION
This document describes version 0.06 of WWW::Baidu::Record
, released Jan 21, 2007.
SYNOPSIS
# ... construct the WWW::Baidu object $baidu somehow earlier
$record = $baidu->next;
if ($record) {
print "Found page titled ", $record->title;
print " whose URL is ", $record->url;
print " and the summary looks like ", $record->summary;
print ". Its size is ", $record->size;
print ". You can preview the cached version from ", $record->cached_url,
print " if you've got a 404 error. :)";
}
DESCRIPTION
This class represent objects for the search results returned by Baidu.com.
CONSTRUCTIOR
There's a constructor generated automatically by Class::Accessor, but usually you don't need to construct a WWW::Baidu::Record
instance yourself.
Please always use the next
method of WWW::Baidu object to get an object of this class.
PROPERTIES
All the properties of this class are read-only and return strings in the GBK/GB2312 encoding. If you want UTF-8, use the Encode module to decode the strings yourself:
use Encode 'decode';
$utf8 = decode('GBK', $gbk);
$value = $obj->title
-
Returns the matched web page or document's page title.
$value = $obj->url
-
Returns the absolute URL for the matched web document.
$value = $obj->summary
-
A brief summary for the matched web document from Baidu.com
$value = $obj->size
-
Size info for the matched document. Note that it's not an number, instead it's in the form of '32K' or something like that.
$value = $obj->cached_url
-
Returns the url pointing to the cached version of the matched document on Baidu.com. Note that, for documents with types like DOC, PPT and XSL, there won't be a cached version. So this property always returns undef in these cases.
AUTHOR
Agent Zhang <agentzh@gmail.com>
COPYRIGHT
Copyright (c) 2007 by Agent Zhang. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.