how to call perl script from html using python
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Aug 14 03:19:25 EDT 2012
On Mon, 13 Aug 2012 23:21:34 -0700, Pervez Mulla wrote:
> I wanna call perl objects using Python . I checked in internet ,I can
> make use of inline function for this, But in HTML......??
You need to explain more about your problem, because I don't understand
what you want to do in detail.
For example:
1) "I have a URL to a perl script, like this:
http://example.com/somewhere/script.pl
and I want to download the script, run it, and collect the results."
Difficulty: (0 is trivial, 10 is impossible) About 2 or 3.
2) "I have a web page like this:
http://example.com/somewhere/homepage.html
Inside this web page I have a block of text that is actually Perl code. I
want to download the HTML page, extract the Perl code, and run it."
Difficulty: (0 is trivial, 10 is impossible) Between 6 and 10, depending
on the exact details of how the Perl code is stored.
Please explain in more detail what you want to do.
Where is the Perl code? In a script? Inside a HTML file? Mixed in with
other text, or in a HTML element of its own?
Once you know where the Perl code lives, you can write a function to
extract it. If you don't know where the code lives, you can't.
Once you have the Perl code, you can then run it using the subprocess
module, and collect its results.
Once you have the results, you can store it in a database.
--
Steven
More information about the Python-list
mailing list