nv-l
[Top] [All Lists]

Re: Using NetView API/libs from perl

To: nv-l@lists.tivoli.com
Subject: Re: Using NetView API/libs from perl
From: Chris Cowan <chris.cowan@2ND-WAVE.COM>
Date: Tue, 29 Feb 2000 15:58:54 -0600
Michael Gutteridge wrote:
>
> Heya
>
> I'd been looking at writing some custom code for an implementation I'm
> doing for a customer.  Some of the NetView API calls are very nice
> for some miscellaneous tasks.  However, for a variety of reasons, I'm
> reluctant to get into writing a C program (reasons like, I don't know C!)
>
> One thing I came across was the Perl XS module
> (http://www.perl.com/pub/doc/manual/html/pod/perlxs.html) , which,
> according to the introduction:
>
>      XS is a language used to create an extension interface between Perl
>      and some C library which one wishes to use with Perl. The XS
>      interface is combined with the library to create a new library which
>      can be linked to Perl. An XSUB is a function in the XS language and
>      is the core component of the Perl application interface
>
> Anyone done this?  Have a similar method of doing this?  Thoughts about
> the wisdom of this?
>
> Thanks
>
> --
> Michael Gutteridge                              mikeg@halcyon.com
>
> "Better beans and bacon in peace than cakes and ale in fear."
>   -Aesop, The Town Mouse and the Country Mouse


Yes, I've used XSUB, just not with Netview.   In fact, I was considering
doing this myself.   (It's just a bandwidth issue for me, don't have the
time, right now).   This is one of the common techniques for writing
extension modules in perl.    If you browse CPAN, you will discover that
this is quite common.

Basically, perl dynamically loads the library or libraries as part of
the running interpreter process, and then makes the calls directly from
the same process space.   XS is basically a mapping language to insure
that data is converted or massaged from the perl representation into to
the correct C language types for the call to be made.

In most circumstances, this should be a significant performance
improvement over obtaining the equivalent information from a CLI (e.g.
using nvUtil inside of backticks, system() vs. the equivalent set of NV
API calls).

However, the caveat is that your extension module becomes a slave to
Netview's update cycle.    If the API changes then you may have to
possibility go back and update all this stuff.  However, if you have
ANSI function prototypes, the job should not be that complicated.   In
fact, there are some utilities to assist with this.

Attachment: chris.cowan.vcf
Description: Card for Chris Cowan

<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web