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.


In reply to Re: perl as a 'helper app' to IE or NS - how to get data? by choocroot
in thread perl as a 'helper app' to IE or NS - how to get data? by djinn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.