]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/mpfire/perl/Audio/MPD/Common/Item.pm
2 # This file is part of Audio::MPD::Common
3 # Copyright (c) 2007 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package Audio
::MPD
::Common
::Item
;
14 use Audio
::MPD
::Common
::Item
::Directory
;
15 use Audio
::MPD
::Common
::Item
::Playlist
;
16 use Audio
::MPD
::Common
::Item
::Song
;
18 #our ($VERSION) = '$Rev: 5645 $' =~ /(\d+)/;
24 my ($pkg, %params) = @_;
26 # transform keys in lowercase.
28 @lowcase{ keys %params } = values %params;
30 return Audio
::MPD
::Common
::Item
::Song
->new(\
%lowcase) if exists $params{file
};
31 return Audio
::MPD
::Common
::Item
::Directory
->new(\
%lowcase) if exists $params{directory
};
32 return Audio
::MPD
::Common
::Item
::Playlist
->new(\
%lowcase) if exists $params{playlist
};
42 Audio::MPD::Common::Item - a generic collection item
47 my $item = Audio::MPD::Common::Item->new( %params );
52 C<Audio::MPD::Common::Item> is a virtual class representing a generic
53 item of mpd's collection. It can be either a song, a directory or a playlist.
55 Depending on the params given to C<new>, it will create and return an
56 C<Audio::MPD::Common::Item::Song>, an C<Audio::MPD::Common::Item::Directory>
57 or an C<Audio::MPD::Common::Playlist> object. Currently, the
58 discrimination is done on the existence of the C<file> key of C<%params>.
63 Note that the only sub worth it in this class is the constructor:
67 =item new( key => val [, key => val [, ...] ] )
69 Create and return either an C<Audio::MPD::Common::Item::Song>, an
70 C<Audio::MPD::Common::Item::Directory> or an C<Audio::MPD::Common::Playlist>
71 object, depending on the existence of a key C<file>, C<directory> or
72 C<playlist> (respectively).
83 =item L<POE::Component::Client::MPD>
90 Jerome Quelin, C<< <jquelin at cpan.org> >>
93 =head1 COPYRIGHT & LICENSE
95 Copyright (c) 2007 Jerome Quelin, all rights reserved.
97 This program is free software; you can redistribute it and/or modify
98 it under the same terms as Perl itself.