CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
how can I call Java applet using Perl script

 



tridib.bolar
New User

Dec 17, 2008, 12:56 PM

Post #1 of 5 (1237 views)
how can I call Java applet using Perl script Can't Post

Hi,



I have one unusual requirement for my current project. I need to call a Java applet using Perl script and unfortunately I am new in Perl programming. Is there any one have any idea regarding this?



Thanks

-Tridib


FishMonger
Veteran / Moderator

Dec 17, 2008, 1:47 PM

Post #2 of 5 (1236 views)
Re: [tridib.bolar] how can I call Java applet using Perl script [In reply to] Can't Post

It all depends on what your Java applet does and how you want/need to interface with it.

To simply execute it, you could use a system call or backticks, or the qx operator.

There's also
IPC::Run http://search.cpan.org/author/RSOD/IPC-Run-0.80/lib/IPC/Run.pm
IPC::Open2 http://search.cpan.org/author/NWCLARK/perl-5.8.9/lib/IPC/Open2.pm
IPC::Open3 http://search.cpan.org/author/NWCLARK/perl-5.8.9/lib/IPC/Open3.pm

Or, you could look at some of the Java modules on cpan.
http://search.cpan.org/search?query=java&mode=all


tridib.bolar
New User

Dec 18, 2008, 8:13 AM

Post #3 of 5 (1230 views)
Re: [FishMonger] how can I call Java applet using Perl script [In reply to] Can't Post

Hi,



Thanks for the reply. But I think I need to reframe my question to let you understand my requirement exactly.



My requirement is, I need to write a script which can automatically log into my website and from there it should crawl into a particular link, which will help to open an applet, and the script should be able to click on some button on the applet to get some response from the applet. I have to write a script to automate this whole task.

Currently I can able to log into the website using LWP::UserAgent, but after that I am not able to understand how to crawl into the destination link and how to open the applet. I have come to know from google that there is the LinkExtor class in perl to crawl into the different link, but I am not able to use the same.

I am sending my auto login code for your ease. If there is any possible solution please let me know. Thanks in advance.



use HTTP::Request::Common;

use LWP::UserAgent;

use HTML::LinkExtor;



$URL='http://<my_server>:<my_port>/<my_path>/login.jsp';

$browser = LWP::UserAgent->new();

$browser->timeout(1000);

$response = $browser->post($URL,

[

UserId => ‘user_id’,

Password => 'password'

]

);



if ($response->is_error()){printf "%s\n", $response->status_line;}



$contents=$response->content();

print $response->as_string;;

print $contents;



Thanks

-Tridib


FishMonger
Veteran / Moderator

Dec 18, 2008, 8:26 AM

Post #4 of 5 (1228 views)
Re: [tridib.bolar] how can I call Java applet using Perl script [In reply to] Can't Post

use WWW::Mechanize;
http://search.cpan.org/~petdance/WWW-Mechanize-1.52/lib/WWW/Mechanize.pm

or
use Win32::IE::Mechanize;
http://search.cpan.org/~abeltje/Win32-IE-Mechanize-0.009/lib/Win32/IE/Mechanize.pm


tridib.bolar
New User

Dec 18, 2008, 4:08 PM

Post #5 of 5 (1219 views)
Re: [FishMonger] how can I call Java applet using Perl script [In reply to] Can't Post

Thank you, I am working on it.

Thanks

-Tridib

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives