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
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |