#!/usr/local/bin/perl # # slashdump - example to download Slashdot headlines and print/dump the info # # Copyright (c) 1999 Ian Kluft. All rights reserved. This program is # free software; you can redistribute it and/or modify it under the # same terms as Perl itself. # use strict; use Carp; use WebFetch::Slashdot; use vars qw( $obj $rec $fnum $fdata ); # this uses the WebFetch Embedding API - available in version 0.10 and later if ( $WebFetch::VERSION lt "0.10" ) { croak "must use WebFetch 0.10 or later for the Embedding API\n"; } $obj = new WebFetch::Slashdot( "dir" => "." ); foreach $rec ( @{$obj->{data}{records}}) { for ( $fnum=0; $fnum < scalar( @{$obj->{data}{fields}}); $fnum++ ) { print $obj->{data}{fields}[$fnum].": " .$rec->[$fnum]."\n"; } print "\n"; }