see the other methods for more specific configuration options which
can also specified to C<init>.
-If C<infile> or C<instring> are specified (see L<parse>), C<parse()>
+If C<infile>, C<inhandle>, or C<instring> are specified, C<parse()>
is called from C<init>. If a fatal error is encountered during parsing
(e.g. the file can't be opened), C<init> will not return a
valid object but C<undef>!
$self->reset_parse_errors;
- if ($self->{config}{infile} || $self->{config}{instring}) {
+ if ($self->{config}{infile}
+ || $self->{config}{inhandle}
+ || $self->{config}{instring}) {
defined($self->parse) or return undef;
}
=item 1.
-the filename of the parsed file or C<String> if a string was
-parsed directly
+the filename of the parsed file or C<FileHandle> or C<String>
+if the input came from a file handle or a string. If the
+reportfile configuration option was given, its value will be
+used instead
=item 2.
=head3 parse
-Parses either the file named in configuration item C<infile> or the string
-saved in configuration item C<instring>.
+Parses either the file named in configuration item C<infile>, the content
+of the filehandle in configuration item C<inhandle>, or the string
+saved in configuration item C<instring> (the latter requires IO::String).
+You can set a filename to use for reporting errors with configuration
+item C<reportfile>.
Accepts a hash ref as optional argument which can contain configuration
items.
$file, $! );
return undef;
};
+ } elsif ($fh = $self->{config}{inhandle}) {
+ $file = 'FileHandle';
} elsif (my $string = $self->{config}{instring}) {
eval { require IO::String };
if ($@) {
$self->_do_fatal_error(_g('no changelog file specified'));
return undef;
}
+ if (defined($self->{config}{reportfile})) {
+ $file = $self->{config}{reportfile};
+ }
$self->reset_parse_errors;