Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

perl suppressing warnings when executing java class

by sandeepda (Novice)
on May 13, 2013 at 20:33 UTC ( #1033353=perlquestion: print w/replies, xml ) Need Help??
sandeepda has asked for the wisdom of the Perl Monks concerning the following question:

0 down vote favorite I have a java code at server side which calls perl at client side and perl calls a java class for validationin client side.In server side I expect output like this which is constructed at my client side java class The below tag is constructed in client java class at server java i check this tag and say my execution was success and make some decisionins
<Composites> i=0 compositedetail=swlib:soaprov/soacomposite=eis/FileAdapter#eis/Fil +eAdapter# swlib:soaprov/soacomposite=eis/FileAdapter#eis/FileAdapter# starts + with swlib </Composites>
I Execute perl which contains below lines
my $keyStoreLoc = $emState.'Test.jks'; my $secOptions="$keyStoreLoc +"; my $className = 'xyz.AdapterValidator'; my $command = $java . ' -classpath ' . $classpath . ' ' . $secOptions . ' ' . $className . ' ' . $serviceUrl . ' ' . $composites;
Now the isssue in SSL it generate some warning messages and gives output like below <May 7, 2013 1:21:59 AM IST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify> <May 7, 2013 1:21:59 AM IST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify> <May 7, 2013 1:21:59 AM IST> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=CertGenCA,OU=FOR TESTING ONLY,O=MyOrganization,L=MyTown,ST=MyState,C=ka". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
<Composites> i=0 compositedetail=swlib:soaprov/soacomposite=eis/FileAdapter#eis/FileAda +pter# swlib:soaprov/soacomposite=eis/FileAdapter#eis/FileAdapter# starts wit +h swlib </Composites>
Is there a way to do supress them in perl?I need only my tag not warnings One more doubt without calling system command how is my java class getting calledBecause in my perl i am just doing
my $command = $java . ' -classpath ' . $classpath . ' ' . $secOptions + . ' ' . $className . ' ' . $serviceUrl . ' ' . $composites; print `$command`;

Replies are listed 'Best First'.
Re: perl suppressing warnings when executing java class
by Anonymous Monk on May 13, 2013 at 21:01 UTC

    Why are you doing print `$command`?! That's pretty silly; why capture the output instead of letting it print, and then do nothing but print it?

    To hide the warnings, why not simply redirect STDERR to null? Or alternatively, redirect STDOUT to a file and save the data directly.

    PS: "0 down vote favorite"? Good way to collect some downvotes for trying to tell people how to vote.

      I am surprised how my java is getting called without system command

        print `foo` means pretty much the same thing as system("foo"); it's just less efficient (because it reads all of foo's output into a scalar before printing it out).

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
        The back-tick (`) operator invokes the Shell and passes the content to it to be executed. See "Quote and Quote-like operators" in the online documentation ($ perldoc -f ` ).

        I Go Back to Sleep, Now.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1033353]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-09-24 14:55 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (274 votes). Check out past polls.