r48092 - in /trunk/libparse-debcontrol-perl/debian/patches: error.diff patch.diff series strict_parse.diff

azatoth-guest at users.alioth.debian.org azatoth-guest at users.alioth.debian.org
Tue Dec 1 22:10:39 UTC 2009


Author: azatoth-guest
Date: Tue Dec  1 22:10:34 2009
New Revision: 48092

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48092
Log:
split out error handling from strict patch

Added:
    trunk/libparse-debcontrol-perl/debian/patches/error.diff
Modified:
    trunk/libparse-debcontrol-perl/debian/patches/patch.diff
    trunk/libparse-debcontrol-perl/debian/patches/series
    trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff

Added: trunk/libparse-debcontrol-perl/debian/patches/error.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/error.diff?rev=48092&op=file
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/error.diff (added)
+++ trunk/libparse-debcontrol-perl/debian/patches/error.diff Tue Dec  1 22:10:34 2009
@@ -1,0 +1,314 @@
+Index: libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm	2009-12-01 22:55:59.000000000 +0100
+@@ -0,0 +1,104 @@
++use strict;
++use warnings;
++
++package Parse::DebControl::Error;
++=pod
++
++=head1 NAME
++Parse::DebControl::Error - Exception classes for Parse::DebControl
++
++=head1 SYNOPSIS
++
++    use Parse::DebControl::Error;
++
++    throw Parse::DebControl::Error();
++
++    throw Parse::DebControl::Error::Parse( "reason for exception" );
++    throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data );
++    throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data, $context_line );
++
++    throw Parse::DebControl::Error::IO( "information regarding the error" );
++
++=head1 COPYRIGHT
++
++Parse::DebControl is copyright 2003,2004 Jay Bonci E<lt>jaybonci at cpan.orgE<gt>.
++
++Parse::DebControl::Error is copyright 2009 Carl Fürstenberg E<lt>azatoth at gmail.comE<gt>.
++
++This program is free software; you can redistribute it and/or modify it under
++the same terms as Perl itself.
++
++=cut
++use base 'Error';
++our $VERSION = '0.1';
++sub new
++{
++    my $self = shift;
++    local $Error::Depth = $Error::Depth + 1;
++
++    $self->SUPER::new(@_);
++}
++
++package Parse::DebControl::Error::Parse;
++
++use base 'Parse::DebControl::Error';
++our $VERSION = '0.1';
++
++sub new
++{
++    my $self = shift;
++    my $text = "".shift;
++    my @args = ();
++
++    my $line = shift;
++    my $context = shift;
++
++    push(@args, '-context', $context) if defined($context);
++    push(@args, '-line', $line) if defined($line);
++
++    local $Error::Depth = $Error::Depth + 1;
++
++    $self->SUPER::new(-text => $text, @args);
++}
++
++sub stringify {
++    my $self = shift;
++    my $text;
++    if( $self->context ) {
++        $text = sprintf("Parse error: %s at line %d of data (\"%s\").\n",  $self->SUPER::stringify, $self->line, $self->context);
++    } elsif( $self->line ) {
++        $text = sprintf("Parse error: %s at line %d of data.\n",  $self->SUPER::stringify, $self->line);
++    } else {
++        $text = sprintf("Parse error: %s.\n", $self->SUPER::stringify);
++    }
++    $text;
++}
++
++sub context {
++    my $self = shift;
++    exists $self->{'-context'} ? $self->{'-context'} : undef;
++}
++
++package Parse::DebControl::Error::IO;
++
++use base 'Parse::DebControl::Error';
++our $VERSION = '0.1';
++sub new
++{
++    my $self = shift;
++    my $text = "".shift;
++    my @args = ();
++
++    local $Error::Depth = $Error::Depth + 1;
++
++    $self->SUPER::new(-text => $text, @args);
++}
++
++sub stringify {
++    my $self = shift;
++    my $text;
++    $text = sprintf("IO error: %s.\n", $self->SUPER::stringify );
++    $text;
++}
++
++1;
+Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
+===================================================================
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2009-12-01 22:51:46.000000000 +0100
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2009-12-01 23:01:10.000000000 +0100
+@@ -13,6 +13,7 @@
+ use IO::Scalar;
+ use Compress::Zlib;
+ use LWP::UserAgent;
++use Parse::DebControl::Error;
+ 
+ use vars qw($VERSION);
+ $VERSION = '2.005';
+@@ -33,15 +34,13 @@
+ 	my ($this, $filename, $options) = @_;
+ 	unless($filename)
+ 	{
+-		$this->_dowarn("parse_file failed because no filename parameter was given");
+-		return;
++		throw Parse::DebControl::Error::IO("parse_file failed because no filename parameter was given");
+ 	}	
+ 
+ 	my $fh;
+ 	unless(open($fh,"$filename"))
+ 	{
+-		$this->_dowarn("parse_file failed because $filename could not be opened for reading");
+-		return;
++		throw Parse::DebControl::Error::IO("parse_file failed because $filename could not be opened for reading");
+ 	}
+ 	
+ 	return $this->_parseDataHandle($fh, $options);
+@@ -52,16 +51,14 @@
+ 
+ 	unless($data)
+ 	{
+-		$this->_dowarn("parse_mem failed because no data was given");
+-		return;
++		throw Parse::DebControl::Error::IO("parse_mem failed because no data was given");
+ 	}
+ 
+ 	my $IOS = new IO::Scalar \$data;
+ 
+ 	unless($IOS)
+ 	{
+-		$this->_dowarn("parse_mem failed because IO::Scalar creation failed.");
+-		return;
++		throw Parse::DebControl::Error::IO("parse_mem failed because IO::Scalar creation failed.");
+ 	}
+ 
+ 	return $this->_parseDataHandle($IOS, $options);
+@@ -73,8 +70,7 @@
+ 
+ 	unless($url)
+ 	{
+-		$this->_dowarn("No url given, thus no data to parse");
+-		return;
++		throw Parse::DebControl::Error::IO("No url given, thus no data to parse");
+ 	}
+ 
+ 	my $ua = LWP::UserAgent->new;
+@@ -83,8 +79,7 @@
+ 
+ 	unless($request)
+ 	{
+-		$this->_dowarn("Failed to instantiate HTTP Request object");
+-		return;
++		throw Parse::DebControl::Error::IO("Failed to instantiate HTTP Request object");
+ 	}
+ 
+ 	my $response = $ua->request($request);
+@@ -92,8 +87,7 @@
+ 	if ($response->is_success) {
+ 		return $this->parse_mem($response->content(), $options);
+ 	} else {
+-		$this->_dowarn("Failed to fetch $url from the web");
+-		return;
++		throw Parse::DebControl::Error::IO("Failed to fetch $url from the web");
+ 	}
+ }
+ 
+@@ -102,22 +96,19 @@
+ 
+ 	unless($filenameorhandle)
+ 	{
+-		$this->_dowarn("write_file failed because no filename or filehandle was given");
+-		return;
++		throw Parse::DebControl::Error::IO("write_file failed because no filename or filehandle was given");
+ 	}
+ 
+ 	unless($dataorarrayref)
+ 	{
+-		$this->_dowarn("write_file failed because no data was given");
+-		return;
++		throw Parse::DebControl::Error::IO("write_file failed because no data was given");
+ 	}
+ 
+ 	my $handle = $this->_getValidHandle($filenameorhandle, $options);
+ 
+ 	unless($handle)
+ 	{
+-		$this->_dowarn("write_file failed because we couldn't negotiate a valid handle");
+-		return;
++		throw Parse::DebControl::Error::IO("write_file failed because we couldn't negotiate a valid handle");
+ 	}
+ 
+ 	my $string = $this->write_mem($dataorarrayref, $options);
+@@ -134,8 +125,7 @@
+ 
+ 	unless($dataorarrayref)
+ 	{
+-		$this->_dowarn("write_mem failed because no data was given");
+-		return;
++		throw Parse::DebControl::Error::IO("write_mem failed because no data was given");
+ 	}
+ 
+ 	my $arrayref = $this->_makeArrayref($dataorarrayref);
+@@ -165,8 +155,7 @@
+ 	{
+ 		unless($filenameorhandle->opened())
+ 		{
+-			$this->_dowarn("Can't get a valid filehandle to write to, because that is closed");
+-			return;
++			throw Parse::DebControl::Error::IO("Can't get a valid filehandle to write to, because that is closed");
+ 		}
+ 
+ 		return $filenameorhandle;
+@@ -180,8 +169,7 @@
+ 
+ 		unless(open $handle,"$openmode$filenameorhandle")
+ 		{
+-			$this->_dowarn("Couldn't open file: $openmode$filenameorhandle for writing");
+-			return;
++			throw Parse::DebControl::Error::IO("Couldn't open file: $openmode$filenameorhandle for writing");
+ 		}
+ 
+ 		return $handle;
+@@ -248,8 +236,7 @@
+ 
+ 	unless($handle)
+ 	{
+-		$this->_dowarn("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
+-		return;
++		throw Parse::DebControl::Error("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
+ 	}
+ 
+ 	if($options->{tryGzip})
+@@ -309,8 +296,7 @@
+ 
+ 				$lastfield = $key;
+ 			}else{
+-				$this->_dowarn("Parse error on line $linenum of data; invalid key/value stanza");
+-				return $structs;
++                throw Parse::DebControl::Error::Parse('invalid key/value stansa', $linenum, $line);
+ 			}
+ 
+ 		}elsif($line =~ /^([\t\s])(.*)/)
+@@ -319,8 +305,7 @@
+ 
+ 			unless($lastfield)
+ 			{
+-				$this->_dowarn("Parse error on line $linenum of data; indented entry without previous line");
+-				return $structs;
++                throw Parse::DebControl::Error::Parse("indented entry without previous line", $linenum);
+ 			}
+ 			if($options->{verbMultiLine}){
+ 				$data->{$lastfield}.="\n$1$2";
+@@ -343,8 +328,7 @@
+ 			$data = $this->_getReadyHash($options);
+ 			$lastfield = "";
+ 		}else{
+-			$this->_dowarn("Parse error on line $linenum of data; unidentified line structure");
+-			return $structs;
++            throw Parse::DebControl::Error::Parse("unidentified line structure", $linenum, $line);
+ 		}
+ 
+ 	}
+@@ -379,8 +363,7 @@
+ 		eval("use Tie::IxHash");
+ 		if($@)
+ 		{
+-			$this->_dowarn("Can't use Tie::IxHash. You need to install it to have this functionality");
+-			return;
++			throw Parse::DebControl::Error("Can't use Tie::IxHash. You need to install it to have this functionality");
+ 		}
+ 		tie(%$data, "Tie::IxHash");
+ 		return $data;
+@@ -389,19 +372,6 @@
+ 	return {};
+ }
+ 
+-sub _dowarn
+-{
+-        my ($this, $warning) = @_;
+-
+-        if($this->{_verbose})
+-        {
+-                warn "DEBUG: $warning";
+-        }
+-
+-        return;
+-}
+-
+-
+ 1;
+ 
+ __END__

Modified: trunk/libparse-debcontrol-perl/debian/patches/patch.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/patch.diff?rev=48092&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/patch.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/patch.diff Tue Dec  1 22:10:34 2009
@@ -1,10 +1,11 @@
 Index: libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm	2009-12-01 22:43:22.000000000 +0100
-@@ -0,0 +1,191 @@
++++ libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm	2009-12-01 23:09:47.000000000 +0100
+@@ -0,0 +1,192 @@
 +package Parse::DebControl::Patch;
 +=pod
++
 +=head1 NAME
 +
 +Parse::DebControl::Patch - Easy OO parsing of debian patch file metadata (DEP3) data
@@ -197,7 +198,7 @@
 Index: libparse-debcontrol-perl/t/35patch.t
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/35patch.t	2009-12-01 22:43:22.000000000 +0100
++++ libparse-debcontrol-perl/t/35patch.t	2009-12-01 23:08:51.000000000 +0100
 @@ -0,0 +1,76 @@
 +#
 +#===============================================================================
@@ -278,7 +279,7 @@
 Index: libparse-debcontrol-perl/t/testfiles/patch1.diff
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/testfiles/patch1.diff	2009-12-01 22:43:22.000000000 +0100
++++ libparse-debcontrol-perl/t/testfiles/patch1.diff	2009-12-01 23:08:51.000000000 +0100
 @@ -0,0 +1,27 @@
 +From: Ulrich Drepper <drepper at redhat.com>
 +Subject: Fix regex problems with some multi-bytes characters

Modified: trunk/libparse-debcontrol-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/series?rev=48092&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/series (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/series Tue Dec  1 22:10:34 2009
@@ -1,2 +1,3 @@
+error.diff
 strict_parse.diff
 patch.diff

Modified: trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff?rev=48092&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff Tue Dec  1 22:10:34 2009
@@ -1,122 +1,8 @@
-Index: libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm	2009-12-01 22:43:08.000000000 +0100
-@@ -0,0 +1,104 @@
-+use strict;
-+use warnings;
-+
-+package Parse::DebControl::Error;
-+=pod
-+
-+=head1 NAME
-+Parse::DebControl::Error - Exception classes for Parse::DebControl
-+
-+=head1 SYNOPSIS
-+
-+    use Parse::DebControl::Error;
-+
-+    throw Parse::DebControl::Error();
-+
-+    throw Parse::DebControl::Error::Parse( "reason for exception" );
-+    throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data );
-+    throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data, $context_line );
-+
-+    throw Parse::DebControl::Error::IO( "information regarding the error" );
-+
-+=head1 COPYRIGHT
-+
-+Parse::DebControl is copyright 2003,2004 Jay Bonci E<lt>jaybonci at cpan.orgE<gt>.
-+
-+Parse::DebControl::Error is copyright 2009 Carl Fürstenberg E<lt>azatoth at gmail.comE<gt>.
-+
-+This program is free software; you can redistribute it and/or modify it under
-+the same terms as Perl itself.
-+
-+=cut
-+use base 'Error';
-+our $VERSION = '0.1';
-+sub new
-+{
-+    my $self = shift;
-+    local $Error::Depth = $Error::Depth + 1;
-+
-+    $self->SUPER::new(@_);
-+}
-+
-+package Parse::DebControl::Error::Parse;
-+
-+use base 'Parse::DebControl::Error';
-+our $VERSION = '0.1';
-+
-+sub new
-+{
-+    my $self = shift;
-+    my $text = "".shift;
-+    my @args = ();
-+
-+    my $line = shift;
-+    my $context = shift;
-+
-+    push(@args, '-context', $context) if defined($context);
-+    push(@args, '-line', $line) if defined($line);
-+
-+    local $Error::Depth = $Error::Depth + 1;
-+
-+    $self->SUPER::new(-text => $text, @args);
-+}
-+
-+sub stringify {
-+    my $self = shift;
-+    my $text;
-+    if( $self->context ) {
-+        $text = sprintf("Parse error: %s at line %d of data (\"%s\").\n",  $self->SUPER::stringify, $self->line, $self->context);
-+    } elsif( $self->line ) {
-+        $text = sprintf("Parse error: %s at line %d of data.\n",  $self->SUPER::stringify, $self->line);
-+    } else {
-+        $text = sprintf("Parse error: %s.\n", $self->SUPER::stringify);
-+    }
-+    $text;
-+}
-+
-+sub context {
-+    my $self = shift;
-+    exists $self->{'-context'} ? $self->{'-context'} : undef;
-+}
-+
-+package Parse::DebControl::Error::IO;
-+
-+use base 'Parse::DebControl::Error';
-+our $VERSION = '0.1';
-+sub new
-+{
-+    my $self = shift;
-+    my $text = "".shift;
-+    my @args = ();
-+
-+    local $Error::Depth = $Error::Depth + 1;
-+
-+    $self->SUPER::new(-text => $text, @args);
-+}
-+
-+sub stringify {
-+    my $self = shift;
-+    my $text;
-+    $text = sprintf("IO error: %s.\n", $self->SUPER::stringify );
-+    $text;
-+}
-+
-+1;
 Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
 ===================================================================
---- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2009-12-01 22:38:56.000000000 +0100
-+++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2009-12-01 22:43:08.000000000 +0100
-@@ -13,10 +13,94 @@
- use IO::Scalar;
- use Compress::Zlib;
- use LWP::UserAgent;
-+use Parse::DebControl::Error;
- 
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2009-12-01 23:01:10.000000000 +0100
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2009-12-01 23:06:29.000000000 +0100
+@@ -18,6 +18,90 @@
  use vars qw($VERSION);
  $VERSION = '2.005';
  
@@ -203,143 +89,11 @@
 +    }
 +};
 +
++
  sub new {
  	my ($class, $debug) = @_;
  	my $this = {};
-@@ -33,15 +117,13 @@
- 	my ($this, $filename, $options) = @_;
- 	unless($filename)
- 	{
--		$this->_dowarn("parse_file failed because no filename parameter was given");
--		return;
-+		throw Parse::DebControl::Error::IO("parse_file failed because no filename parameter was given");
- 	}	
- 
- 	my $fh;
- 	unless(open($fh,"$filename"))
- 	{
--		$this->_dowarn("parse_file failed because $filename could not be opened for reading");
--		return;
-+		throw Parse::DebControl::Error::IO("parse_file failed because $filename could not be opened for reading");
- 	}
- 	
- 	return $this->_parseDataHandle($fh, $options);
-@@ -52,16 +134,14 @@
- 
- 	unless($data)
- 	{
--		$this->_dowarn("parse_mem failed because no data was given");
--		return;
-+		throw Parse::DebControl::Error::IO("parse_mem failed because no data was given");
- 	}
- 
- 	my $IOS = new IO::Scalar \$data;
- 
- 	unless($IOS)
- 	{
--		$this->_dowarn("parse_mem failed because IO::Scalar creation failed.");
--		return;
-+		throw Parse::DebControl::Error::IO("parse_mem failed because IO::Scalar creation failed.");
- 	}
- 
- 	return $this->_parseDataHandle($IOS, $options);
-@@ -73,8 +153,7 @@
- 
- 	unless($url)
- 	{
--		$this->_dowarn("No url given, thus no data to parse");
--		return;
-+		throw Parse::DebControl::Error::IO("No url given, thus no data to parse");
- 	}
- 
- 	my $ua = LWP::UserAgent->new;
-@@ -83,8 +162,7 @@
- 
- 	unless($request)
- 	{
--		$this->_dowarn("Failed to instantiate HTTP Request object");
--		return;
-+		throw Parse::DebControl::Error::IO("Failed to instantiate HTTP Request object");
- 	}
- 
- 	my $response = $ua->request($request);
-@@ -92,8 +170,7 @@
- 	if ($response->is_success) {
- 		return $this->parse_mem($response->content(), $options);
- 	} else {
--		$this->_dowarn("Failed to fetch $url from the web");
--		return;
-+		throw Parse::DebControl::Error::IO("Failed to fetch $url from the web");
- 	}
- }
- 
-@@ -102,22 +179,19 @@
- 
- 	unless($filenameorhandle)
- 	{
--		$this->_dowarn("write_file failed because no filename or filehandle was given");
--		return;
-+		throw Parse::DebControl::Error::IO("write_file failed because no filename or filehandle was given");
- 	}
- 
- 	unless($dataorarrayref)
- 	{
--		$this->_dowarn("write_file failed because no data was given");
--		return;
-+		throw Parse::DebControl::Error::IO("write_file failed because no data was given");
- 	}
- 
- 	my $handle = $this->_getValidHandle($filenameorhandle, $options);
- 
- 	unless($handle)
- 	{
--		$this->_dowarn("write_file failed because we couldn't negotiate a valid handle");
--		return;
-+		throw Parse::DebControl::Error::IO("write_file failed because we couldn't negotiate a valid handle");
- 	}
- 
- 	my $string = $this->write_mem($dataorarrayref, $options);
-@@ -134,8 +208,7 @@
- 
- 	unless($dataorarrayref)
- 	{
--		$this->_dowarn("write_mem failed because no data was given");
--		return;
-+		throw Parse::DebControl::Error::IO("write_mem failed because no data was given");
- 	}
- 
- 	my $arrayref = $this->_makeArrayref($dataorarrayref);
-@@ -165,8 +238,7 @@
- 	{
- 		unless($filenameorhandle->opened())
- 		{
--			$this->_dowarn("Can't get a valid filehandle to write to, because that is closed");
--			return;
-+			throw Parse::DebControl::Error::IO("Can't get a valid filehandle to write to, because that is closed");
- 		}
- 
- 		return $filenameorhandle;
-@@ -180,8 +252,7 @@
- 
- 		unless(open $handle,"$openmode$filenameorhandle")
- 		{
--			$this->_dowarn("Couldn't open file: $openmode$filenameorhandle for writing");
--			return;
-+			throw Parse::DebControl::Error::IO("Couldn't open file: $openmode$filenameorhandle for writing");
- 		}
- 
- 		return $handle;
-@@ -248,8 +319,7 @@
- 
- 	unless($handle)
- 	{
--		$this->_dowarn("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
--		return;
-+		throw Parse::DebControl::Error("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
- 	}
- 
- 	if($options->{tryGzip})
-@@ -273,12 +343,16 @@
+@@ -260,12 +344,16 @@
  		chomp $line;
  		
  
@@ -362,7 +116,7 @@
  
  		$linenum++;
  		if($line =~ /^[^\t\s]/)
-@@ -289,6 +363,13 @@
+@@ -276,6 +364,13 @@
  				my $key = $1;
  				my $value = $2;
  
@@ -376,18 +130,14 @@
  				if($options->{discardCase})
  				{
  					$key = lc($key);
-@@ -309,19 +390,25 @@
- 
- 				$lastfield = $key;
- 			}else{
--				$this->_dowarn("Parse error on line $linenum of data; invalid key/value stanza");
--				return $structs;
-+				throw Parse::DebControl::Error::Parse('invalid key/value stansa', $linenum, $line);
+@@ -299,14 +394,22 @@
+                 throw Parse::DebControl::Error::Parse('invalid key/value stansa', $linenum, $line);
  			}
  
- 		}elsif($line =~ /^([\t\s])(.*)/)
+-		}elsif($line =~ /^([\t\s])(.*)/)
 -		{
 -			#appends to previous line
++        }elsif($line =~ /^([\t\s])(.*)/)
 +        {
 +            #appends to previous line
 +
@@ -405,16 +155,16 @@
  
 -			unless($lastfield)
 -			{
--				$this->_dowarn("Parse error on line $linenum of data; indented entry without previous line");
--				return $structs;
+-                throw Parse::DebControl::Error::Parse("indented entry without previous line", $linenum);
 -			}
  			if($options->{verbMultiLine}){
  				$data->{$lastfield}.="\n$1$2";
  			}elsif($2 eq "." ){
-@@ -332,20 +419,23 @@
+@@ -316,20 +419,23 @@
+ 				$val =~ s/[\s\t]+$//;
  				$data->{$lastfield}.="\n$val";
  			}
- 
+-
 -		}elsif($line =~ /^[\s\t]*$/){
 -		        if ($options->{verbMultiLine} 
 -			    && ($data->{$lastfield} =~ /\n/o)) {
@@ -426,9 +176,6 @@
 -			$data = $this->_getReadyHash($options);
 -			$lastfield = "";
 -		}else{
--			$this->_dowarn("Parse error on line $linenum of data; unidentified line structure");
--			return $structs;
--		}
 +        }elsif($line =~ /^[\s\t]*$/){
 +            if ($options->{verbMultiLine}
 +                && ($data->{$lastfield} =~ /\n/o)) {
@@ -444,42 +191,13 @@
 +            $data = $this->_getReadyHash($options);
 +            $lastfield = "";
 +        }else{
-+            throw Parse::DebControl::Error::Parse("unidentified line structure", $linenum, $line);
+             throw Parse::DebControl::Error::Parse("unidentified line structure", $linenum, $line);
+-		}
 +        }
  
  	}
  
-@@ -379,8 +469,7 @@
- 		eval("use Tie::IxHash");
- 		if($@)
- 		{
--			$this->_dowarn("Can't use Tie::IxHash. You need to install it to have this functionality");
--			return;
-+			throw Parse::DebControl::Error("Can't use Tie::IxHash. You need to install it to have this functionality");
- 		}
- 		tie(%$data, "Tie::IxHash");
- 		return $data;
-@@ -389,19 +478,6 @@
- 	return {};
- }
- 
--sub _dowarn
--{
--        my ($this, $warning) = @_;
--
--        if($this->{_verbose})
--        {
--                warn "DEBUG: $warning";
--        }
--
--        return;
--}
--
--
- 1;
- 
- __END__
-@@ -501,6 +577,20 @@
+@@ -471,6 +577,20 @@
  		it is off by default so we don't have to scrub over all the text for
  		performance reasons.
  
@@ -503,7 +221,7 @@
 Index: libparse-debcontrol-perl/t/34strict.t
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/34strict.t	2009-12-01 22:43:08.000000000 +0100
++++ libparse-debcontrol-perl/t/34strict.t	2009-12-01 23:02:42.000000000 +0100
 @@ -0,0 +1,71 @@
 +#
 +#===============================================================================




More information about the Pkg-perl-cvs-commits mailing list