Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6902833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:50:54+00:00 2026-05-27T07:50:54+00:00

I am trying to use Text::DocumentCollection in Perl. I want to be able to

  • 0

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”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:50:55+00:00Added an answer on May 27, 2026 at 7:50 am

    From the tests included with the CPAN distribution, it looks like the 2nd argument to the Add method should be a reference to a Text::Document object, not a simple string.

    For example, from t/collection.t

    use Text::DocumentCollection;
    use Text::Document;
    
    my $d1 = Text::Document->new();
    $d1->AddContent( ' danelle folta michelle pfeiffer ' );
    
    my $d2 = Text::Document->new();
    $d2->AddContent( ' danelle folta mary elizabeth mastrantonio ' );
    
    my $c = Text::DocumentCollection->new( file => 't/collection.db');
    
    $c->Add( 'a', $d1 );
    $c->Add( 'b', $d2 );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use urllib and urllib2 to read from a text file that
I'm trying to use XSLT text output to generate a file (in a file
I'm trying to use the text value from a text field as a float
I am trying to use XML::RAI perl module on UTF8 coded text and I
I'm trying to use the RegisteredWindowMessage API function to send text from one application
I'm trying to use word to automatically correct some text that is not in
I have a <div contenteditable=true> that I am trying to use to get text
From: https://stackoverflow.com/a/959982/101055 I am trying to use: using System.Text.RegularExpressions; Dictionary<string, string> parameters = new
I'm trying to use quoted text in one of node's attributes: var network_json =
I'm trying to use Selenium WebDriver to input text to a GWT input element

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.