D
David K. Worman
Here's what I'm working with so far, but all I wind up with is a 0 byte
file at the end, and the error;
"Filehandle PLIST opened only for output at ./medialist.pl line 20."
I know this error is pretty self explanatory, but for some reason I'm
unable to correct it, and I was under the impression that I was opening /
creating my file in the correct manner. Can someone take a look at my
code below and point me in the right direction?
TIA,
- dkw
#!/usr/bin/perl -w
#
# The purpose is to create one "master playlist" of my mp3 collection
# on my Gnome desktop, by cat'ing the auto-generated playlists created
# when I rip and encode my cd collection into said "master playlist"
# and then add the correct path to the final playlist, then cleanup after
# myself.
#
# So far this script doesn't exactly work as planned.
#
# David K. Worman
# (e-mail address removed)
########################
$PLIST = "/home/dkworman/.gnome-desktop/playlist.m3u";
$FLIST = "/home/dkworman/.gnome-desktop/filelist.m3u";
system("rm $PLIST");
system("cat /misc/media/*.m3u > $FLIST");
open(PLIST, ">$PLIST") || die "Can't open $PLIST: $!n";
while (<PLIST>) {
open(FLIST) || die "Can't open $FLIST: $!n";
while (<FLIST>) {
chomp;
($song = $_);
$path = "/misc/media/";
print PLIST "$path$song";
}
close(FLIST);
}
close(PLIST);
system("rm $FLIST");
die();
file at the end, and the error;
"Filehandle PLIST opened only for output at ./medialist.pl line 20."
I know this error is pretty self explanatory, but for some reason I'm
unable to correct it, and I was under the impression that I was opening /
creating my file in the correct manner. Can someone take a look at my
code below and point me in the right direction?
TIA,
- dkw
#!/usr/bin/perl -w
#
# The purpose is to create one "master playlist" of my mp3 collection
# on my Gnome desktop, by cat'ing the auto-generated playlists created
# when I rip and encode my cd collection into said "master playlist"
# and then add the correct path to the final playlist, then cleanup after
# myself.
#
# So far this script doesn't exactly work as planned.
#
# David K. Worman
# (e-mail address removed)
########################
$PLIST = "/home/dkworman/.gnome-desktop/playlist.m3u";
$FLIST = "/home/dkworman/.gnome-desktop/filelist.m3u";
system("rm $PLIST");
system("cat /misc/media/*.m3u > $FLIST");
open(PLIST, ">$PLIST") || die "Can't open $PLIST: $!n";
while (<PLIST>) {
open(FLIST) || die "Can't open $FLIST: $!n";
while (<FLIST>) {
chomp;
($song = $_);
$path = "/misc/media/";
print PLIST "$path$song";
}
close(FLIST);
}
close(PLIST);
system("rm $FLIST");
die();