1package IMDb;
2
3use strict;
4use Carp;
5$IMDb::VERSION = '0.01';
6
7my %Loaded;
8my @SubMods =
9qw(
10    IMDb::Title
11    IMDb::People
12);
13
14sub _load
15{
16    my($type, $class) = @_;
17    $type  = ucfirst $type;
18    $class = 'IMDb' unless defined $class and length $class;
19    $class = "${class}::$type";
20    return $class if exists $Loaded{$class};
21    croak "Can't load class `$class', not part of IMDb distribution"
22        unless grep $class eq $_, @SubMods;
23    eval("use $class");
24    die $@ if($@);
25    $Loaded{$class} = 1;
26    return $class;
27}
28
29sub new
30{
31    my $class = shift;
32    my $type  = shift;
33    $class    = _load($type, $class);
34    return new $class @_;
35}
36
37sub search
38{
39    my $type  = shift;
40    my $class = _load($type);
41    return eval($class.'::search(@_)');
42}
43
441;
45
46__END__
47
48=head1 NAME
49
50IMDb - Abstract class to query the Internet Movie Database
51
52=head1 SYNOPSIS
53
54=head1 DESCRIPTION
55
56=head1 AUTHOR
57
58Olivier Poitrey E<lt>rs@rhapsodyk.netE<gt>
59
60=head1 AVAILABILITY
61
62The official FTP location is:
63
64B<ftp://ftp.rhapsodyk.net/pub/devel/perl/IMDb/>
65
66Also available on CPAN.
67
68anonymous CVS repository:
69
70CVS_RSH=ssh cvs -d anonymous@cvs.rhapsodyk.net:/devel co IMDb
71
72(supply an empty string as password)
73
74CVS repository on the web:
75
76http://www.rhapsodyk.net/cgi-bin/cvsweb/IMDb/
77
78=head1 LICENCE
79
80This program is free software; you can redistribute it and/or modify
81it under the terms of the GNU General Public License as published by
82the Free Software Foundation; either version 2 of the License, or (at
83your option) any later version.
84
85This program is distributed in the hope that it will be useful, but
86WITHOUT ANY WARRANTY; without even the implied warranty of
87MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
88General Public License for more details.
89
90You should have received a copy of the GNU General Public License
91along with the program; if not, write to the Free Software
92Foundation, Inc. :
93
9459 Temple Place, Suite 330, Boston, MA 02111-1307
95
96=head1 COPYRIGHT
97
98Copyright (C) 2002 - Olivier Poitrey
99