SVN: toys/rsget.pl/RSGet/Form.pm

sparky sparky at pld-linux.org
Mon Oct 12 19:54:08 CEST 2009


Author: sparky
Date: Mon Oct 12 19:54:08 2009
New Revision: 10767

Modified:
   toys/rsget.pl/RSGet/Form.pm
Log:
- also extract forms from custom source


Modified: toys/rsget.pl/RSGet/Form.pm
==============================================================================
--- toys/rsget.pl/RSGet/Form.pm	(original)
+++ toys/rsget.pl/RSGet/Form.pm	Mon Oct 12 19:54:08 2009
@@ -12,6 +12,10 @@
 	my $html = shift;
 	my %opts = @_;
 
+	if ( $opts{source} ) {
+		$html = $opts{source};
+		$opts{num} ||= 0;
+	}
 	my @forms;
 	while ( $html =~ s{^.*?<form\s*(.*?)>(.*?)</form>}{}si ) {
 		my $attr = $1;
@@ -25,7 +29,7 @@
 	}
 	unless ( @forms ) {
 		warn "No forms found\n" if verbose( 2 );
-		dump_to_file( $html, "html" ) if setting( "errorlog" );
+		dump_to_file( $html, "html" ) if setting( "debug" );
 		return undef unless $opts{fallback};
 		push @forms, [ {}, '' ];
 	}
@@ -64,7 +68,7 @@
 			warn "Can't find form whitch matches: $all\n";
 		}
 	}
-	if ( not $found and $opts{num} ) {
+	if ( not $found and exists $opts{num} ) {
 		if ( $opts{num} >= 0 and $opts{num} < scalar @forms ) {
 			$found = $forms[ $opts{num} ];
 		}


More information about the pld-cvs-commit mailing list