[ale] Crazy Perl + Java question

Christopher Fowler cfowler at outpostsentinel.com
Sun May 23 15:25:01 EDT 2004


Here is what I came up with.

I created an interface that used Getopt to allow the user to pass all
arguments needed to create a JD object.  I then added a -e (exec)
options that allowed the user to pass the method and arguments for that
class that needed to be executed.

In this example I called up my remote JCD server and asked it for the
console buffer contents of my Soalris 9 machine.

./jcd.pl -u ensign -p password -s 192.168.2.231 -S -e
"get_buffer('Solaris')"

What I got back was:


sol9 console login: root
Password: 
May 21 14:28:38 sol9 login: ROOT LOGIN /dev/console
Last login: Thu May 20 23:53:11 on console
Sun Microsystems Inc.   SunOS 5.9       Generic May 2002
# passwd
passwd: Changing password for root
New Password: 
Re-enter new Password: 
passwd(SYSTEM): They don't match.

Please try again
New Password: 
Re-enter new Password: 
passwd: password successfully changed for root
# ^D
sol9 console login: 
sol9 console login: 
sol9 console login: 


The beauty of this is that the '-S' switched used SSL as the connection
and I did not have to waste my times with the problems of java not
allowing a connection to a remote site that did not have a signed cert.

Unless there is a way to call perl code directly from Java I think this
would be the best way.  I guess I could write a JNI interface that can
return Java objects but that might be a royal PITA.



On Sun, 2004-05-23 at 15:00, Christopher Fowler wrote:
> I was on my way to Home Depot to by some shelving for my ever growing
> collection of technical manuals.  I purchased about 10 books in the last
> 2 weeks.  I'm running out of space in my home office for all this
> storage.  Back on subject.... I was thinking about some classes that I
> need to write in Java to use in our J2EE app that I've written in Perl. 
> I would like to know if there is any way to reuse that perl code so I do
> not have to write more in Java?
> 
> All of the data that is returned are Strings.  I could create a simple
> command line interface to the perl class and have Java execute it in a
> process thread.  Is that a crazy idea?  Is there a better more efficient
> way?
> 
> Chris
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list