Subject: | bug in example in Description |
Howdy,
The example in the DESCRIPTION section of the docs has a couple of problems.
Here's the code
1: use SVN::Dump;
2:
3: my $dump = SVN::Dump->new( 'mydump.svn' );
4: print $dump->as_string(); # only print the dump header
5:
6: while( $rec = $dump->next_record() ) {
7: print $rec->as_string();
8: }
1. in line 3, The argument to the constructor should be a hash:
my $dump = SVN::Dump->new( {file => 'mydump.svn' } );
2. Line 4 results in
Can't call method "as_string" on an undefined value at [...]/SVN/Dump.pm line 73.
because nothing has been read from the dump file. It looks
like next_record() needs to be called first. Here's the start
of my dump file:
SVN-fs-dump-format-version: 2
UUID: 25fd25a6-c234-44fc-9872-c99ed41caf87
This corresponds to two records returned by SVN::Dump::Reader,
so to get the example code to work, it needs to look like
this:
$dump->next_record;
$dump->next_record;
print $dump->as_string();
which seems a bit magical if you don't know the SVN format.
Thanks!
Diab