tucano has asked for the wisdom of the Perl Monks concerning the following question:

The issue is:
A SIMPLE DIPLAY FOR MP3 TAGS EMBEDDED IN THE WEB PAGE
a lot of person like php and flash... mierda...
I try to put a perl script INTO a php script called from a flash movie.
I make it for a Internet Radio that need something that diplay the current song
I know is something really strange but you can see the result at
.:http://recipient.cc:.
Is the box in the left that call the mp3 tags from the file. For the code i use mp3::Info.... Is realy simple, because in the current file you can find the path for the mp3 song


PERL/QUICKTIME get_tag
#!/usr/bin/perl #use strict; use warnings; use MP3::Info; my $file=$ARGV[0]; open (CURRENT, "$file") or die "can't open file"; my $line=<CURRENT>; chomp $line; $line=~s/u=//; #print "FILE CURRENT:\n",$line,"\n"; close (CURRENT); my $tag = get_mp3tag ($line, ID3v2); print "AUTORE=",$tag->{ARTIST},"&ALBUM=",$tag->{ALBUM},"&BRANO=",$tag- +>{TITLE};
Realy simple you can see... it just take the file, read with the module Mp3::Info, and give a string with print


PHP Here is the code of the php file called current.php
This line call the perl script and take a string.
<? system ("/path/to/script/mp3tagfinder.pl".escapeshellarg('/path/to/har +d/link/file/current')); ?>


Flash
Flash take the variabile from the php script with the function: load_vars
If you want, you can see it working at the radio ( CURRENT TEST)
So... it is all. Please post comments, i'm realy newbye of perl.

Replies are listed 'Best First'.
Re: Flash and perl
by dondelelcaro (Monk) on May 27, 2004 at 06:50 UTC
    First things first, you want to uncomment use strict;

    Second, there's no reason to call the perl script through php when you can just call the perl script itself as a cgi script.

    Finally, consider using the following:
    print "AUTORE=$tag->{ARTIST}&ALBUM=$tag->{ALBUM}&BRANO=$tag->{TITLE}";
    in your code as well, instead of bunches of "foo",$bar,"baz",$bleh";