Fwd: RE: perl executed out of c#

2005-02-17 Thread lowster11

--- "Thomas, Mark - BLS CTR" <[EMAIL PROTECTED]>
wrote:

> From: "Thomas, Mark - BLS CTR" <[EMAIL PROTECTED]>
> To: "'Dan Jablonsky'" <[EMAIL PROTECTED]>
> Date: Thu, 17 Feb 2005 14:14:29 -0500
> CC: Perl-Win32-Users@listserv.ActiveState.com
> Subject: RE: perl executed out of c#
> 
> Dan Jablonsky wrote:
> > I need to catch an error raised in the script.
> > Right now the script contains only one line:
> > #!perl
> > die("died here");
> > Unfortunatelly, I can catch an error like "file
> not
> > found", "no permission" BUT I CANNOT CATCH THE
> die().
> > Any idea how to do it?
> 
> The difference is that a file not found error sets
> errno, the error code
> that is returned by die, whereas if no real error
> occurred, die returns
> without an errno. You can set errno via the $!
> variable before you call die.
> See perldoc perlvar.
> 
> Try this:
> 
> $!=255;
> die("died here");
> 
> -- 
> Mark Thomas 
> Internet Systems Architect
> ___
> BAE SYSTEMS Information Technology 
> 2525 Network Place
> Herndon, VA  20171  USA 
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Fwd: RE: perl executed out of c#

2005-02-17 Thread Christopher

--- "Thomas, Mark - BLS CTR" <[EMAIL PROTECTED]>
wrote:

> From: "Thomas, Mark - BLS CTR" <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: perl executed out of c#
> Date: Thu, 17 Feb 2005 15:53:23 -0500
> 
> You seem to be sending blank emails.
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, February 17, 2005 3:27 PM
> > To: Thomas, Mark - BLS CTR; 'Dan Jablonsky'
> > Cc: Perl-Win32-Users@listserv.ActiveState.com
> > Subject: RE: perl executed out of c#
> > 
> > 
> > 
> > 
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl executed out of c#

2005-02-17 Thread lowster11


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl executed out of c#

2005-02-17 Thread lowster11


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl executed out of c#

2005-02-17 Thread lowster11


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl executed out of c#

2005-02-17 Thread Thomas, Mark - BLS CTR
Dan Jablonsky wrote:
> I need to catch an error raised in the script.
> Right now the script contains only one line:
> #!perl
> die("died here");
> Unfortunatelly, I can catch an error like "file not
> found", "no permission" BUT I CANNOT CATCH THE die().
> Any idea how to do it?

The difference is that a file not found error sets errno, the error code
that is returned by die, whereas if no real error occurred, die returns
without an errno. You can set errno via the $! variable before you call die.
See perldoc perlvar.

Try this:

$!=255;
die("died here");

-- 
Mark Thomas 
Internet Systems Architect
___
BAE SYSTEMS Information Technology 
2525 Network Place
Herndon, VA  20171  USA 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl executed out of c#

2005-02-17 Thread Chris

Hi all,
i have the following code in a c# application:

--

I need to catch an error raised in the script.
Right now the script contains only one line:
#!perl
die("died here");
Unfortunatelly, I can catch an error like "file not
found", "no permission" BUT I CANNOT CATCH THE die().
Any idea how to do it?

Thanks,
Dan




Maybe use warn or print followed by exit.

- Chris

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl executed out of c#

2005-02-17 Thread Dan Jablonsky
Hi all,
i have the following code in a c# application:

public void execscript()
{
  Process myprocess = new Process();
  try
 {
string perl_script = "err0.pl";
myprocess.StartInfo.FileName "c:\\perl_dev\\" +
perl_script;
myprocess.StartInfo.CreateNoWindow = false;
myprocess.StartInfo.WindowStyle =
ProcessWindowStyle.Maximized;
myprocess.StartInfo.UseShellExecute = true;
myprocess.Start();
myprocess.WaitForExit(1);
EventLog.WriteEntry("exterr", "test mesg");
myprocess.Close();
 }
catch (Exception e)
 {
throw new System.Exception();
 }
}

I need to catch an error raised in the script.
Right now the script contains only one line:
#!perl
die("died here");
Unfortunatelly, I can catch an error like "file not
found", "no permission" BUT I CANNOT CATCH THE die().
Any idea how to do it?

Thanks,
Dan



__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs