SVN: toys/fun/rsget.pl

sparky sparky at pld-linux.org
Wed Jan 7 01:39:54 CET 2009


Author: sparky
Date: Wed Jan  7 01:39:54 2009
New Revision: 10056

Modified:
   toys/fun/rsget.pl
Log:
- use Term::Size


Modified: toys/fun/rsget.pl
==============================================================================
--- toys/fun/rsget.pl	(original)
+++ toys/fun/rsget.pl	Wed Jan  7 01:39:54 2009
@@ -11,11 +11,13 @@
 my %gotlist;
 
 package Line; # {{{
+use Term::Size;
 
 $| = 1;
 my $actual_line = 0;
 my $max_line = 0;
-my $columns = $ENV{COLUMNS} || 124; # XXX
+
+my $columns = Term::Size::chars;
 
 sub new
 {
@@ -347,7 +349,7 @@
 	my $class = shift;
 	my $url = shift;
 	my $slots = 1;
-	if ( $_[0] eq "slots" ) {
+	if ( scalar @_ and $_[0] eq "slots" ) {
 		shift;
 		$slots = shift;
 	}
@@ -411,6 +413,8 @@
 	my $next_stage = shift;
 	my $msg = shift || "waiting";
 
+	$time = 30 * 60 if $time > 30 * 60;
+
 	$self->{wait_next} = $next_stage;
 	$self->{wait_msg} = $msg . " ";
 	Wait::start( $self, $time );
@@ -656,9 +660,7 @@
 		return $self->error( "file currently unavailable" );
 	}
 	if ( $body =~ /You could download your next file in.*countdown\(([0-9]+)/ ) {
-		my $wait = $1 / 100;
-		$wait = 1200 if $wait > 1200;
-		return $self->wait( $wait, \&stage1, "free limit reached, waiting" );
+		return $self->wait( $1 / 100, \&stage1, "free limit reached, waiting" );
 	}
 	unless ( $body =~ /please wait .*countdown\(([0-9]+),/ ) {
 		if ( $self->{s6problems} ) {


More information about the pld-cvs-commit mailing list