NAME
Data::Phrasebook::Generic - Base class for Phrasebook Models
SYNOPSIS
use Data::Phrasebook;
my $q = Data::Phrasebook->new(
class => 'Fnerk',
loader => 'XML',
file => 'phrases.xml',
dict => 'English',
);
DESCRIPTION
This module provides a base class for phrasebook implementations.
CONSTRUCTOR
new
new
takes an optional hash of arguments. Each value in the hash is given as an argument to a method of the same name as the key.
This constructor should never need to be called directly Phrasebook creation should go through the Data::Phrasebook factory.
Subclasses who wish to override behaviour should actually override init
(see source for details).
All, or at least most, phrasebook implementations should inherit from this class.
METHODS
loader
Set, or get, the loader class. Uses a default if none have been specified. See Data::Phrasebook::Loader.
file
A description of a file that is passed to the loader. In most cases, this is a file. A loader that gets its data from a database could conceivably have this as a hash like thus:
$q->file( {
dsn => "dbi:SQLite:dbname=bookdb",
table => 'phrases',
} );
That is, which loader you use determines what your file
looks like.
The default loader takes just an ordinary filename.
loaded
Accessor to determine whether the current dictionary has been loaded
dict
Accessor to store the dictionary to be used.
data
Loads the data source, if not already loaded, and returns the data block associated with the given key.
my $data = $self->data($key);
This is typically only used internally by implementations, not the end user.
SEE ALSO
Data::Phrasebook, Data::Phrasebook::Loader.
AUTHOR
Original author: Iain Campbell Truskett (16.07.1979 - 29.12.2003).
Maintainer: Barbie <barbie@cpan.org>.
LICENCE AND COPYRIGHT
Copyright E<copy> Iain Truskett, 2003. All rights reserved.
Copyright E<copy> Barbie, 2004-2005. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
The full text of the licences can be found in the F<Artistic> and
F<COPYING> files included with this module, or in L<perlartistic> and
L<perlgpl> in Perl 5.8.1 or later.