My Code:
#!/usr/bin/perl# use module
use MP3::Tag;# set filename of MP3 track
$filename = "../httpdocspodcasts/DBP_Promo.mp3";#s$cgi->param('fname');# create new MP3-Tag object
$mp3 = MP3::Tag->new($filename);
$mp3->get_tags();# if ID3v2 tags exists
if (exists $mp3->{ID3v2})
{
# get a list of frames as a hash reference
$frames = $mp3->{ID3v2}->get_frame_ids();# iterate over the hash
# process each frame
foreach $frame (keys %$frames)
{
# for each frame
# get a key-value pair of content-description
($value, $desc) = $mp3->{ID3v2}->get_frame($frame);
print "$frame $desc: ";
# sometimes the value is itself a hash reference containing more values
# deal with that here
if (ref $value)
{
while (($k, $v) = each (%$value))
{
print "\n - $k: $v";
}
print "\n";
}
else
{
print "$value\n";
}
}
}# clean up
$mp3->close();
Whenever I access it I get this error:
Internal Server ErrorFile not found
1) I was wondering what is wrong with this and what I can do to fix it.
2) And if someone could explain what the code is doing. That would be great becuase i am new at perl. I have been working with php for some time now so I understan some of it.
Thanks,
electricocean
#!/usr/bin/perl
# use module
use MP3::Tag;
use CGI qw(:standard);
print header,start_html;
rest of your code here
print end_html;
Can you please explain everything?
electricocean
perl nameofscript.pl
the output is displayed in a console (or a DOS window).
But to run a script from a browser, you need to have an HTTP server installed, just like web servers on the internet do. You can download and install Apache:
www.apache.org
which is the most popular web server, and it's free. You need to edit the Apache configuration file to get it to run, but there are many tutorials on the internet that show how to do that (It's not hard but a little confusing at first). Do a search for:
installing apache on windows (or whatever OS you use).
Once Apache is installed, you have to start it first before trying to run scripts in the browser, I just have a shortcut to apache on my system tray I click to start it, then open a browser and you typically type:
[localhost...]
in the address box of the browser and click "go" or press enter. The Apache folder will have the cgi-bin folder in the htdocs folder, which is the same type of setup most webservers use. Thats where you will save your pel script to on your computer. But of course you can set it up nearly anyway you want to once you learn how to edit the apache configuration files, which are just text files. It's a whole new ball game and you will have to do some learning first, but I assure you it is not hard. It might take a day or two to get it all figured out.
electricocean