Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 06-25-2007, 03:49 AM   #1 (permalink)
Greg's Avatar
 
Indeed.

Join Date: Dec 2004

Posts: 1,554

Greg is on a distinguished road

Default Help me with CGI/Perl

I'm trying to write a CGI script that will generate an HTML file showing what is playing in my media player, Amarok. The command that outputs the artist and title is:
Code:
echo `dcop amarok player nowPlaying`
but when I include it in the CGI script it is just blank. The "date" command, however, works like a charm. When you load the page it will tell you the current time and date in bold, just like it should. Here is the current script with the working date command:
Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head>\n";
print "<title>Test</title></head>\n";
print "<body>\n";
print "<b>";
print `date`;
print "</b>\n";
print "</body></html>\n";
Now how do I get it to work with the other command? Keep in mind I know basically nothing about Perl.

Oh, and when I just run the script from the command line it works fine as well. Here is what it gives me:
Code:
greg@Carl:~/apache/nowplaying$ perl playing.pl
Content-type: text/html

<html><head>
<title>Test</title></head>
<body>
<b>The Flaming Lips - Superhumans
</b>
</body></html>
greg@Carl:~/apache/nowplaying$
Thanks in advance for any help, and sorry for this crappy post. It's late and I'm tired.
__________________
Greg is offline  
Old 06-26-2007, 06:47 AM   #2 (permalink)
Greg's Avatar
 
Indeed.

Join Date: Dec 2004

Posts: 1,554

Greg is on a distinguished road

Default Re: Help me with CGI/Perl

Nevermind. I just ended up writing an Amarok script. Here is the result:

http://img243.imageshack.us/img243/8245/screeniean9.png

Simple, but it does exactly what I want it to do.
__________________
Greg is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On