Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

What holiday is today? <!-- googleholiday.pl -->

by crazyinsomniac (Prior)
NODE.owner = 10277 N.title = monktitlebar sitedoclet N.owner = 17342 -->
on Mar 17, 2002 at 11:02 UTC ( #152305=snippet: print w/ replies, xml ) Need Help??
Description: So you're wondering what holiday is today (of the major ones), and all you've got is a terminal and perl.
#!/usr/bin/perl -w
use strict;
use LWP::Simple qw/ get /;
use HTML::TokeParser;
my $html = get('http://www.google.com/#googleholiday.pl');
my $p = HTML::TokeParser->new(\$html);
my $t = $p->get_tag('img');
die $t->[1]->{alt};

__END__
#the one liner version
#one
perl -MLWP::Simple -MHTML::TokeParser -e"die HTML::TokeParser->new(\(g
+et('http://www.google.com/#googleholiday.pl')))->get_tag('img')->[1]-
+>{alt};"

#two
perl -MLWP::Simple -MHTML::TokeParser -e'die HTML::TokeParser->new(\(g
+et("http://www.google.com/#googleholiday.pl")))->get_tag("img")->[1]-
+>{alt};'
Replies are listed 'Best First'.
Re: What holiday is today? !-- googleholiday.pl --
by gellyfish (Monsignor) on Mar 17, 2002 at 16:26 UTC

    Luvverly, However for everyday use one might want to consider Date::Calc ;-}

    /J\

Re: What holiday is today? !-- googleholiday.pl --
by theguvnor (Chaplain) on Mar 17, 2002 at 17:06 UTC

    Cool - I set my .bashrc file to call this script upon startup!

    ..Jon

Re: What holiday is today? !-- googleholiday.pl --
by erikharrison (Deacon) on Mar 17, 2002 at 16:01 UTC

    Now, that's just plain nifty.

    Cheers,
    Erik
      ehhhhhhhhhhhhhhhhhhhhhhhhh nifty? spiffy!
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://152305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2016-06-29 06:06 GMT
Sections?
NODE.owner = 10277 N.title = Sections sitedoclet N.owner = 17342 -->
Information?
NODE.owner = 10277 N.title = Information sitedoclet N.owner = 17342 -->
Find Nodes?
NODE.owner = 10277 N.title = Find Nodes sitedoclet N.owner = 17342 -->
Leftovers?
    NODE.owner = 10277 N.title = Leftovers sitedoclet N.owner = 17342 -->
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (368 votes). Check out past polls.