| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Email::MIME::RFC2047::Parser; | 
| 2 |  |  |  |  |  |  | $Email::MIME::RFC2047::Parser::VERSION = '0.96'; | 
| 3 | 4 |  |  | 4 |  | 141 | use strict; | 
|  | 4 |  |  |  |  | 12 |  | 
|  | 4 |  |  |  |  | 125 |  | 
| 4 | 4 |  |  | 4 |  | 23 | use warnings; | 
|  | 4 |  |  |  |  | 9 |  | 
|  | 4 |  |  |  |  | 1036 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | # ABSTRACT: Base class for parsers | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub _parse_error { | 
| 9 | 9 |  |  | 9 |  | 31 | my ($class, $string_ref, $what) = @_; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 9 |  |  |  |  | 19 | my $text; | 
| 12 | 9 |  |  |  |  | 22 | my $pos = pos($$string_ref); | 
| 13 | 9 | 100 |  |  |  | 33 | $pos = 0 if !defined($pos); | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 9 | 100 |  |  |  | 37 | if ($pos < length($$string_ref)) { | 
| 16 | 6 |  |  |  |  | 20 | my $char = substr($$string_ref, $pos, 1); | 
| 17 | 6 | 50 |  |  |  | 40 | $text = defined($what) ? | 
| 18 |  |  |  |  |  |  | "invalid $what at character '$char', pos $pos in string" : | 
| 19 |  |  |  |  |  |  | "unexpected character '$char' at pos $pos in string"; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  | else { | 
| 22 | 3 | 50 |  |  |  | 21 | $text = defined($what) ? | 
| 23 |  |  |  |  |  |  | "incomplete or missing $what at end of string" : | 
| 24 |  |  |  |  |  |  | "unexpected end of string"; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 9 |  |  |  |  | 94 | die("Parse error in MIME header: $text $$string_ref\n"); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | 1; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | __END__ |