File: Base.pm

package info (click to toggle)
libdata-phrasebook-perl 0.35-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 276 kB
  • sloc: perl: 1,242; makefile: 2
file content (105 lines) | stat: -rw-r--r-- 1,970 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package Data::Phrasebook::Loader::Base;
use strict;
use warnings FATAL => 'all';
use base qw( Data::Phrasebook::Debug );
use Carp qw( croak );

use vars qw($VERSION);
$VERSION = '0.35';

=head1 NAME

Data::Phrasebook::Loader::Base - Base loader plugin class.

=head1 SYNOPSIS

  $class->new( %attributes );

=head1 DESCRIPTION

C<Data::Phrasebook::Loader::Base> acts as a base class for phrasebook
plugins.

=cut

my $something = 0;

=head1 CONSTRUCTOR

=head2 new

C<new> instantiates the plugin object, creating a blessed hash of any
attributes passed as arguments.

=cut

sub new {
    my $self = shift;
    my %hash = @_;
    ($hash{class}) = $self =~ /.*::(.*)$/;
    $self->store(3,"$self->new IN")	if($self->debug);
    my $atts = \%hash;
    bless $atts, $self;
    return $atts;
}

=head1 INHERITABLE METHODS

=head2 load

C<load> is an abstract method here. You must define your own in your
subclass. Loads the phrasebook.

=head2 get

C<get> is an abstract method here. You must define your own in your
subclass. Gets the phrase.

=head2 dicts

C<dicts> is an abstract method here. You must define your own in your
subclass. Returns the list of dictionaries available.

=head2 keywords

C<keywords> is an abstract method here. You must define your own in your
subclass. Returns the list of keywords available.

=head2 class

Returns the current C<class> of loader.

=cut

sub load     { return }
sub get      { return }
sub dicts    { return () }
sub keywords { return () }
sub class    { return shift->{class} }

1;

__END__

=head1 SEE ALSO

L<Data::Phrasebook>,
L<Data::Phrasebook::Loader>.

=head1 SUPPORT

Please see the README file.

=head1 AUTHOR

  Barbie, <barbie@cpan.org>
  for Miss Barbell Productions <http://www.missbarbell.co.uk>.

=head1 COPYRIGHT AND LICENSE

  Copyright (C) 2004-2013 Barbie for Miss Barbell Productions.

  This distribution is free software; you can redistribute it and/or
  modify it under the Artistic License v2.

=cut