Skip to content

Commit

Permalink
Merge branch 'master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
FreekKalter committed May 22, 2012
2 parents 5a51122 + 9f5a7b5 commit 0bc68b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/WWW/Scraper/F1.pm
Expand Up @@ -44,18 +44,15 @@ sub get_upcoming {
} }


sub get_top { sub get_top {
my %options = @_; my $options = shift;
$options->{points} = $options->{points} || "yes";
$options->{length} = $options->{length} || 5;
my $total_info = &get_info; my $total_info = &get_info;
my $championship_table = $total_info->{'championship_info'}; my $championship_table = $total_info->{'championship_info'};
my ( $top_length, $points) = @_;
my $output = ''; my $output = '';
#some defaults


my $length = $options{top_length} ? $options{top_length} : 5; for ( my $i = 1 ; $i <= $options->{length} ; $i++ ) {
my $points_display = $options{points} ? $options{points} : 'yes'; given ($options->{points}) {

for ( my $i = 1 ; $i <= $length ; $i++ ) {
given ($points_display) {
when (/no/) { when (/no/) {
$output .= sprintf( "%d %-20s\n", $output .= sprintf( "%d %-20s\n",
$i, $championship_table->[$i]->{'driver'} ); $i, $championship_table->[$i]->{'driver'} );
Expand Down Expand Up @@ -191,4 +188,7 @@ WWW::Scraper::F1
=head1 SYNOPSIS =head1 SYNOPSIS
Scrape info for upcoming race and current championship from formula1.com. use WWW::Scraper:F1;
print get_upcoming_race([length => 5 , points => just]);

0 comments on commit 0bc68b5

Please sign in to comment.