[Techtalk] Using a web browser to control stuff locally -eek!

Mary mary-linuxchix at puzzling.org
Sun Aug 21 11:06:58 EST 2005


On Sat, Aug 20, 2005, esme wrote:
> (several lines of HTML...)
> exec xmms bowie.m3u   (or maybe exec /home/esme/music/track1.ogg, track2.ogg, 
> track 3.ogg, track 5.ogg....)
> (more lines of HTML)
> 
> It was THAT easy using iXG on AmigaOS.  I was kind of hoping it'd be that easy 
> using Linux

It's not that much harder on Linux. In bash, which was the shell
scripting language that my example was written in yesterday, your
example would look something like:

--- Begin CGI Script ---
#!/usr/bin/bash

# boilerplate for the webserver
echo Content-type: text/html
echo

# start the HTML
echo <html>
echo <head>
echo <title>My page</title>
echo </head>

# some more HTML goes here

exec xmms bowie.m3u

# more HTML goes here
echo </body>
echo </html>
--- End CGI Script ---

The real power of languages such as PHP, Perl, Python etc is that they
are much more useful than print-print-print-print in complex
circumstances. Some common circumstances people run into in web
scripting:

 - you want to display different pages for users who aren't logged in
 - you want to connect to a database to retrieve data
 - you want to connect to a database to insert new data based on what
   users have typed
 - you want to display data customised for the user based on what you
   got out of the database

Once you're into this kind of task complexity, the tool I'm using above
doesn't scale well. The reason people are recommending tools with a
higher initial learning curve is that if you proceed onto the more
complex tasks which are typical of web programming, doing something like
the above won't be powerful enough.

But it *can* be that easy on Linux, it's just that that approach won't
take you all the way to the goal of a moderately sophisticated web
application, if that's your goal.

-Mary


More information about the Techtalk mailing list