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

I am developing a client-side app to be run on w32 or linux, which launches when the user clicks a link for a specific type of file.

This is a trusted relationship, the end-user will register our MIME type to kick off the application we provide to them. What I am having trouble getting to work is how to get the perl app on the client-side to accept the data that, in theory, NS or IE is sending to its registered helper app.

I would prefer to not have to initiate this as a pull from the client side using LWP or other, but instead push to the client.

TIA
  • Comment on perl as a 'helper app' to IE or NS - how to get data?

Replies are listed 'Best First'.
Re: perl as a 'helper app' to IE or NS - how to get data?
by hossman (Prior) on Jun 19, 2002 at 08:11 UTC
    I don't know about IE, but in Netscape (on Linux), you specify how you want the helper called using tokens like %s or %u to signify either the local temp file name that was saved, or the url that the helper app should contact.

    ie: for text/xml, I have this...

    text/xml Eterm -e less "%s"

    and for streaming Real files i have this...

    audio/x-realaudio realplay "%u"
Re: perl as a 'helper app' to IE or NS - how to get data?
by choocroot (Friar) on Jun 19, 2002 at 08:04 UTC
    On Linux with Mozilla (this should also work with Netscape 4.x) you can register your application by creating a new entry with the correct mime_type/extension in the Edit/Preferences/Navigator/HelperApp menu.

    When mozilla find a registered file type, it download the file into /tmp, then launch your application and pass this file as the first argument.

    Here is a simple helper application that will log the filename and its content to the $HOME/helper.log file :

    #!/usr/bin/perl -w use strict; # get the filename (/tmp/xxx) my $file = shift; # open a log file open(LOG, ">>$ENV{HOME}/helper.log") or die "Oops : $!\n"; print LOG "Got file $file\n"; # open the file downloaded by mozilla if( not open(FILE, "<$file") ) { print LOG "Error opening file $file\n"; close LOG; exit 1; } # read the whole file undef $/; my $content = <FILE>; print LOG "Content {\n$content\n}\n"; close FILE; close LOG;

    Another way would be to use something like Plugger, that allow you to register an application that will work like a plugin, and allow you to access the content like a stream.