SVN: toys/rsget.pl/RSGet: Curl.pm Processor.pm Tools.pm

sparky sparky at pld-linux.org
Fri Oct 2 17:26:30 CEST 2009


Author: sparky
Date: Fri Oct  2 17:26:30 2009
New Revision: 10650

Modified:
   toys/rsget.pl/RSGet/Curl.pm
   toys/rsget.pl/RSGet/Processor.pm
   toys/rsget.pl/RSGet/Tools.pm
Log:
- add verbose() function


Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm	(original)
+++ toys/rsget.pl/RSGet/Curl.pm	Fri Oct  2 17:26:30 2009
@@ -90,6 +90,7 @@
 				map { uri_escape( $_ ) . "=" . uri_escape( $post->{$_} ) }
 				sort keys %$post;
 		}
+		warn "POST( $uri ): $post\n" if verbose( 3 );
 		$curl->setopt( CURLOPT_POSTFIELDS, $post );
 		$curl->setopt( CURLOPT_POSTFIELDSIZE, length $post );
 	}

Modified: toys/rsget.pl/RSGet/Processor.pm
==============================================================================
--- toys/rsget.pl/RSGet/Processor.pm	(original)
+++ toys/rsget.pl/RSGet/Processor.pm	Fri Oct  2 17:26:30 2009
@@ -238,7 +238,7 @@
 
 	if ( $@ ) {
 		p "Error(s): $@\n";
-		return undef unless setting("verbose") > 0;
+		return undef unless verbose( 1 );
 		my $err = $@;
 		return undef unless $err =~ /line \d+/;
 		my @p = split /\n/, $processed;

Modified: toys/rsget.pl/RSGet/Tools.pm
==============================================================================
--- toys/rsget.pl/RSGet/Tools.pm	(original)
+++ toys/rsget.pl/RSGet/Tools.pm	Fri Oct  2 17:26:30 2009
@@ -7,7 +7,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT = qw(set_rev s2string bignum de_ml hadd hprint p isotime require_prog
-	def_settings setting
+	def_settings setting verbose
 	data_file dump_to_file randomize %getters);
 @EXPORT_OK = qw();
 
@@ -140,6 +140,13 @@
 	return $main::def_settings{ $name }->[1];
 }
 
+sub verbose
+{
+	my $min = shift;
+	return 1 if setting( "verbose" ) >= $min;
+	return 0;
+}
+
 sub dump_to_file
 {
 	my $data = shift;


More information about the pld-cvs-commit mailing list