Hackernews::Parser is a Perl interface to Hackernews (http://news.ycombinator.com/) stories and data.
The only subroutine of Hackernews::Parser is hn_parse. It takes the following arguments:
1. target - This is what page to download the data from; is either top or new. Defaults to top.
2. number - This is the rank of the story. 1 is the top story, and so on. Defaults to 1.
3. datum - This is the name of the datum and hash key to be return (list follows. The default is all, which returns the hash ref as a scalar.
The subroutine stores data in an anonymous hash that may contain any of the following keys, depending on what the pattern was able to match:
- age_qty - the numercal value of the age
- age_unit - either hour(s) or minute(s)
- age_sec - age in seconds calculated by the above
- comments - number of comments
- desc - description
- domain - the domain on which the link is hosted
- id - the unique numerical identification number of the link
- score - the "karma" level of the link, or number of points
- user - the name of the user who posted the link
my $top_hash_ref = hn_parse( 'top', '1' );
# equivalent to:
my $other_top_hash_ref = hn_parse();
my $second_newest = hn_parse( 'new', '2' );