PBib::Document - Abstract Base and Factory class for Documents
use PBib::Document; my $doc = new PBib::Document( 'filename' => $filename, 'mode' => 'r', 'verbose' => 1, ); print $doc->filename(); my @paragraphs = $doc->paragraphs(); $doc->close();
Factory class to create documents that are processed by PBib.
Arguments are passed as hash:
If class is not defined, it is tried to be guessed by looking at the file. (Currently, the filename's extension only.)
OBSOLETE??
Mode for this document, used to open the file. "r" = Read, "w" = Write
Return the document's filename.
Return the document's Perl FileHandle.
Caution: This method might not be used by all subclasses of PBib::Document.
Return the document's encoding.
Returns undef if not specified.
Close the file.
Read the document from disk. Return the content of the document in a format internal to the document class. (Per default a ref to an array of the lines.)
Write the document back to disk, if the document has been opened and it contains paragraphs().
Check, if this document is exists, independent of being accessable. (Perl's -f test)
Check, if this document is ok, e.g. if the file exists and can be accessed. (Perl's -w or -r, depending on $doc->mode()
Methods used by PBib to access the document.
Process all paragraphs of the $inDoc by calling $func. If $outDoc is defined, the result of the function call is added to $outDoc.
The default implementation assumes a linear sequence of paragraphs, using $inDoc's paragraphCount() and getParagraph().
$func is called on $rc with the current paragraph, its index and @_ as parameters:
$par = $rc->$func($par, $i, @_);
Return the number of paragraphs in document.
Return the paragraph with index $int
Return all paragraphs in document as an array with all paragraphs as plain (ascii) strings.
Calles $doc->read() if the file has not been read before.
Append paragraphs to document.
Methods used by PBib::ReferenceConverter::convert().
Do anything you want to before being converted. (Hook for subclasses.) The document object that is returned is used for conversion.
This is called by PBib::ReferenceConverter::convert() on the input document with $conv as the current converter.
Do anything you want to after being converted. (Hook for subclasses.) The object that is returned is used for further processing.
This is called by PBib::ReferenceConverter::convert() on the output document with $conv as the current converter.
Methods used by PBib to create formatted text.
Methods used by PBib for interactive editing of documents, e.g. open in editor.
Open the file with it's associated default application.
To install Biblio::BP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Biblio::BP
CPAN shell
perl -MCPAN -e shell install Biblio::BP
For more information on module installation, please visit the detailed CPAN module installation guide.