I am trying to use Text::DocumentCollection in Perl. I want to be able to read text from a file handle and construct a document collection from that text, although I’m not sure if this is the intended use of this module.
The documentation refers to adding a “document” but I’m not sure what a document is. Is it a file? Can it be a string in a variable?
The following code returns an error:
use Text::DocumentCollection;
my $c = Text::DocumentCollection->new( file => 'test.db' );
$doc = 'test_doc';
$c->Add( 'doc1', $doc );
Error:
Can't locate object method "WriteToString" via package "test_doc" (perhaps you forgot to load "test_doc"?) at ...DocumentCollection.pm line 62.
What does it mean by “load” and what is a “package”?
From the tests included with the CPAN distribution, it looks like the 2nd argument to the
Addmethod should be a reference to aText::Documentobject, not a simple string.For example, from t/collection.t