You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
474 B

package Text::Playlist;
use strict;
use warnings;
our $VERSION = 0.1;
sub items {
my ($self) = @_;
return wantarray ? @{$self->{items}} : $self->{items};
}
sub load {
my ($self, $file) = @_;
open(my $FH, "<", $file) or return $!;
local $/ = undef;
my $content = <$FH>;
close($FH);
return $self->parse($content);
}
sub save {
my ($self, $file) = @_;
open(my $FH, ">", $file) or die $!;
print $FH $self->dump();
close($FH);
return 1;
}
1;