Re: Getting a process ID

2000-05-25 Thread Garrick Staples

Side note... Since modules are generally 'use'd, you may want to kinda-sorta
simulate a use with a BEGIN{} block:

BEGIN {
 $^O eq 'MSWin32'
   ? do { require Win32::IProc }
   : do { require Proc::ProcessTable }
}

You really should create your own cross-platform package that calls the correct
stuff for you behind the scenes.  Something kinda-sorta like this...

package AnyProc;
use strict;
use vars qw/@ISA/;
if($^O eq 'MSWin32') {
require Win32::IProc;
@ISA=qw/Win32::IProc/;
} else {
require Proc::ProcessTable;
@ISA=qw/Proc::ProcessTable;
}

sub pidbynam {
my ($self, $proc_name)=@_;
if ($^O eq 'MSWin32') {
do nifty stuff here...
} else {
do different nifty stuff here...
}
}

Because of the inheritance, the application can still get access to the actual
methods.  You just have to override the ones you need.

"Martin, James S." wrote:

> I don't think you'll find one module that works on both.. Win32::IProc is
> what you could use on the Windows side.. Why not just do a check in the
> script for OS type then choose the appropriate function?
>
> James
>
> -Original Message-
> From: Eric Hains [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 25, 2000 12:22 PM
> To: Perl-Win32-Users Mailing List
> Subject: Getting a process ID
>
> Hi all,
>
> Before I re-invent the wheel, I am looking for a Perl script/module that
> would be able to give me the process ID of a particular process for
> which I only know the name.  I actually need this to work on but IRIX
> and Windows NT (4.0/2000).
>
> Can anyone help find this or provide any suggestion on how to do it?
>
> Thanks,
> Eric


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: Getting a process ID

2000-05-25 Thread Martin, James S.

I don't think you'll find one module that works on both.. Win32::IProc is
what you could use on the Windows side.. Why not just do a check in the
script for OS type then choose the appropriate function?

James

-Original Message-
From: Eric Hains [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 25, 2000 12:22 PM
To: Perl-Win32-Users Mailing List
Subject: Getting a process ID


Hi all,

Before I re-invent the wheel, I am looking for a Perl script/module that
would be able to give me the process ID of a particular process for
which I only know the name.  I actually need this to work on but IRIX
and Windows NT (4.0/2000).

Can anyone help find this or provide any suggestion on how to do it?

Thanks,
Eric


---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]