On Tue, Mar 27, 2007 at 01:59:58PM -0500, [EMAIL PROTECTED] wrote:
> I'm beginning to suspect a chunk of code isn't doing what I need it to. 
> I've looked through the perldoc on system(), and that's what really 
> started me wondering. What I'm not sure about is which way to go to fix 
> this--especially since it seems to work.  Here's the code I'm looking at:
> eval  {
>    system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );
> };
> $@ and Carp::croak( "Error installing certificate ($@)" );
> where $cert contains the name of a certificate file (foo.cer).  Is there 
> an easier, or cleaner, way of running a program?  How, and what, would I 
> replace in this jumble using backticks--would that be a better way to go?
> Thanks to anyone who'll help me make sure I'm DWIM!

The system() call is sending all stdout/stderr to never-never land. The
only thing system() is returning is the exit status code for certutil.
The eval{} will never catch anything.

It should be something like:

   system("certutil ...") == 0
       or die "Error installing certificate.\n";

If you need to trap the errors, you'll need something more complicated.
The eval{} will not do it.

Cheers,
mark

-- 
[EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED]     
__________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to