/usr/share/perl5/WWW/Search/Googlism.pm is in libwww-search-perl 2.51.60-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | package WWW::Search::Googlism;
use 5.006;
use strict;
use warnings;
require Exporter;
our @ISA = qw(WWW::Search Exporter);
our $VERSION = '0.02';
use Carp;
use WWW::Search qw/generic_option/;
require WWW::SearchResult;
my $MAINTAINER = 'xern <xern@cpan.org>';
sub native_setup_search {
my($self, $native_query, $native_options_ref) = @_;
$self->{_debug} = $native_options_ref->{'search_debug'};
$self->{_debug} = 0 if (!defined($self->{_debug}));
$self->{agent_e_mail} = 'xern@cpan.org';
$self->user_agent('WWW::Search::Googlism Agent');
$self->{_next_to_retrieve} = 1;
$self->{'_num_hits'} = 0;
if (!defined($self->{_options})) {
$self->{'search_base_url'} = 'http://www.googlism.com/';
$self->{_options} = {
'search_url' => 'http://www.googlism.com/index.htm',
'ism' => $native_query,
};
}
my $options_ref = $self->{_options};
if (defined($native_options_ref)){
foreach (keys %$native_options_ref)
{
$options_ref->{$_} = $native_options_ref->{$_};
}
}
my($options) = '';
foreach (sort keys %$options_ref)
{
next if (generic_option($_));
croak("Unknown option") unless $_ eq 'ism' || $_ eq 'type';
my %dict = qw/who 1 what 2 where 3 when 4/;
if( $_ eq 'type' ){
croak("Invalid type") unless $dict{$options_ref->{'type'}};
$options_ref->{'type'} = $dict{$options_ref->{'type'}};
}
$options .= $_ . '=' . $options_ref->{$_} . '&';
}
chop $options;
$self->{_next_url} = $self->{_options}{'search_url'}.'?'.$options;
# print $self->{_next_url};
}
sub native_retrieve_some {
my ($self) = @_;
return unless $self->{_next_url};
my($response) = $self->http_request('GET', $self->{_next_url});
$self->{response} = $response;
$response->{_content} =~ m!<br><h1><span class="suffix">Googlism for:</span> .+?</h1><br>(.+)<br>\n!s;
for my $r (split /<br>\n/, $1){
$self->{_num_hits}++;
push @{$self->{cache}}, $r;
}
undef $self->{_next_url};
}
1;
__END__
# Below is stub documentation for your module. You better edit it!
=head1 NAME
WWW::Search::Googlism - Searching Googlism
=head1 SYNOPSIS
use WWW::Search::Googlism;
$query = "googlism";
$search = new WWW::Search('Googlism');
$search->native_query(WWW::Search::escape_query($query), { type => 'who' });
while (my $result = $search->next_result()) {
print "$result\n";
}
=head1 DESCRIPTION
WWW::Search::Googlism is a subclass of WWW::Search. Users can use this module to search http://www.googlism.com/.
See also L<bin/googlism.pl> distributed with this module.
=head1 TYPES
Four types of searching Googlism are "who is", "what is", "where is", and "when is". Specify it with parameter 'type'.
=head1 AUTHOR
xern <xern@cpan.org>
=head1 LICENSE
Released under The Artistic License
=head1 SEE ALSO
L<WWW::Search>, L<bin/googlism.pl>
=cut
|