Ask a Question related to PERL Miscellaneous, Design and Development.
-
brice #1
Creating objects
Hello,
I am using Perl to access the Windows management interface to query
information on some Windows boxes through the Win32::OLE module. I am
on Windows 2000 Professional SP4 using ActivePerl 5.8. I wanted to
create a cleaner interface to this information by trying the following
code:
# ****************************************
# PACKAGE
# ****************************************
package WMI;
use Win32::OLE qw(in);
sub new{
my $host = @_[1];
my $WMI = Win32::OLE->GetObject("winmgmts://$host");
my $class = shift;
my $self = { WMI => $WMI };
bless($self, $class);
return $self;
}
sub getServices{
my $self = shift;
my $WMI = $self->{WMI};
my $set = $WMI->InstancesOf("Win32_Service");
foreach(in($set)){
print "$_->{Name}\n";
}
}
1;
# ***********************************************
# ***********************************************
# Sample Code which successfully prints out a list of running
services.
# ***********************************************
#!C:/perl/bin/perl
use strict;
use WMI;
my $WMI = WMI->new("localhost");
$WMI->getServices();
# ************************************************
So my question now is, is this a silly way to do this by taking an
object and creating another layer over it like I've done? Your
comments are greatly appreciated.
Thanks,
brice
brice Guest
-
Creating Acrobat objects with LotusScript
We have been automating Acrobat 6 with LotusScript (Notes 6.0.3) for some time, and are now upgrading Acrobat. The OLE class object reference for... -
DCOM Errors when creating COM Objects in IIS
Hi all, I'm having a few problems creating COM objects in IIS. The issue only seems to affect a couple of our own custom COM objects. The COM... -
Creating COM objects remotely
I am trying to create a cfobject that will inevitably create a Word Document, and after reading the materials have decided its probably not a good... -
Problem creating objects not as dbo
I have a problem with people logging on as one user, but sql server keeps changing the owner to dbo. Sometimes the owner name will be their loggin... -
Handle leak when creating COM objects from ASP?
Hi Leo I am experiencing the same problem (also windows 2000 server sp3). Do you have any further feedback? Alternatively, has this been... -
James Willmore #2
Re: Creating objects
On 26 Aug 2003 06:02:13 -0700
[email]bricemason@hotmail.com[/email] (brice) wrote:Define what you mean by "silly". I'm of the opinion that, if it's> So my question now is, is this a silly way to do this by taking an
> object and creating another layer over it like I've done? Your
> comments are greatly appreciated.
going to aid in producing code latter on, then it's not "silly" - it's
smart. It's that OO thing again.
Other may have opinions on this, but that's mine to offer.
--
Jim
James Willmore Guest
-
brice #3
Re: Creating objects
James Willmore <jwillmore@cyberia.com> wrote in message news:<20030826150901.2f38ecd7.jwillmore@cyberia.co m>...
Thanks for your response, I feel the same way. I know this will help>
> Define what you mean by "silly". I'm of the opinion that, if it's
> going to aid in producing code latter on, then it's not "silly" - it's
> smart. It's that OO thing again.
>
> Other may have opinions on this, but that's mine to offer.
me in the future grabbing this information from my Windows boxes.
brice
brice Guest
-
Webmaster #4
Creating objects
Hi,
let us say there is Class A.
In the constructor of this class I create an Object B of Class B.
Now what is the difference between these two ?
this->B = new B;
and
B = new B;
Thank you very much!
Wenmaster
Webmaster Guest



Reply With Quote

