TVDB: better handling of first run
[nonametv.git] / lib / NonameTV / Exporter.pm
blob68facfa3b103dd812588fce6b16048130696bcf1
1 package NonameTV::Exporter;
3 use strict;
5 =head1 NAME
7 NonameTV::Exporter
9 =head1 DESCRIPTION
11 Abstract base-class for the NonameTV::Exporter::* classes.
13 A package derived from NonameTV::Exporter can be used to export
14 data from the NonameTV programming database to another format.
16 NonameTV::Exporter::*-objects are instantiated from the nonametv.conf
17 configuration file. To instantiate an object, add an entry
18 in the 'Exporters'-hash. Each entry consists of a hash with
19 the package-name of the exporter in the Type-key and any other
20 parameters to the object in other keys.
22 =head1 METHODS
24 =over 4
26 =cut
28 =item new
30 The constructor for the object. Called with a hashref as the first parameter.
31 This is a ref to the configuration for the object from the nonametv.conf-
32 file. The second parameter is a NonameTV::DataStore object.
34 =cut
36 sub new
38 my $class = ref( $_[0] ) || $_[0];
40 my $self = { };
41 bless $self, $class;
43 # Copy the parameters supplied in the constructor.
44 foreach my $key (keys(%{$_[1]}))
46 $self->{$key} = ($_[1])->{$key};
49 $self->{datastore} = $_[2];
51 return $self;
54 =item Export
56 Export is called from the nonametv-export executable. It takes a hashref
57 as a parameter. The hashref points to a hash with the command-line
58 parameters decoded by Getopt::Long using the $NonameTV::Exporter::*::Options
59 arrayref as format specification.
61 =cut
63 sub Export
65 my( $self, $param ) = @_;
67 die "You must override Export in your own class"
70 =head1 CLASS VARIABLES
72 =item $Options
74 Arrayref containing format specifications for Getopt::Long.
76 Example: $Options = [ qw/offset=i days=i/ ]
78 =head1 COPYRIGHT
80 Copyright (C) 2004 Mattias Holmlund.
82 =cut