Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
googlism is the obsession of the moment. Here is a script that will query and format the results as an RSS channel.


#!/usr/bin/env perl use strict; use warnings; use LWP::UserAgent; use XML::RSS; my $input = join ' ', @ARGV; $input =~ /(who|what|where|when)\s*(is)?\s*(\w+)/i; my $type = $1; my $ism = $3; unless ($ism) { die "Must specify a term to search for.\n"; } if ($type =~ /who/i) { $type = 1; } elsif ($type =~ /what/i) { $type = 2; } elsif ($type =~ /where/i) { $type = 3; } elsif ($type =~ /when/i) { $type = 4; } else { die "Unknown query type! Should be: who, what, where, or when.\n"; } my $ua = LWP::UserAgent->new(); my $response = $ua->post('', { ism => $ism, type => $type }, ); unless($response->is_success) { die "$response->status_line\n"; } my $googlism = $response->content; my $output = XML::RSS->new(version => '0.91'); $output->channel( title => "Googlism for: $ism", link => "$ism&type=$typ +e", language => 'en', description => ' will find out what thinks of + you', ); while ($googlism =~ /($ism is.+)<br>/g) { $output->add_item(title => $1); } print $output->as_string; __END__ =pod =head1 NAME googlism -- Query =head1 SYNOPSIS B<googlism who|what|where|when [is] searchterm > =head1 DESCRIPTION Googlism was created as a fun tool to see what Google "thinks" of cert +ain topics and people. Of course, the results are not really Google's opin +ion, they're yours, the web site owners of the world. Within the Google res +ults are thousands of your thoughts and opinions about thousands of different t +opics and people, we simply search Google and let you know what website owne +rs think about the name or topic you suggested. This script lets you query and formats the results of + your query in RSS 0.91 XML format. You can then postprocess this in variou +s ways such as converting it to HTML to add to your web site. =head1 INSTALLATION Make the script executable. You will also need the B<LWP>, and B<XML: +:RSS> packages from CPAN. =head1 SEE ALSO L<> =head1 AUTHOR Jaldhar H. Vyas E<lt>jaldhar@braincells.comE<gt> =head1 LICENSE This code is free software under the Crowley Public License ("Do what thou wilt shall be the whole of the license") =head1 VERSION 1.0 -- Nov 10, 2002 =cut

In reply to Jaldhar is largely correct on this by jaldhar

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (8)
    As of 2019-11-15 19:04 GMT
    Find Nodes?
      Voting Booth?
      Strict and warnings: which comes first?

      Results (84 votes). Check out past polls.