Re: VMWARE PERL API



hi
The problem was like i had to read the config file in /etc/vmware/
directory.

*************************************************************************************
if (open CONFIG, '</etc/vmware/config') {
my $libdir;
my $line;

while (defined($line = <CONFIG>)) {
chomp $line;
if ($line =~ /^\s*libdir\s*=\s*\"(.*)\"\s*$/) {
$libdir = $1;
last;
}
}
close CONFIG;
if (defined($libdir)) {
my $perl_binary = $libdir . '/perl5/bin/perl';

if (-x $perl_binary) {
$ENV{'VMWARE_PERL_NESTED_EXEC'} = 1;
exec $perl_binary,
'-I'.$libdir.'/perl5/site_perl/5.005',
$0, @ARGV;
}
}
}
*************************************************************************************
this is the part that i included to get things working.
ie. adding a library path.

I think this stuff is going a bit complicated.. please give my some links on
perl concepts. i have fome pdf files from perk.org.. but they are a bit
basic and not deep into such things.

please refer dome books that might by of some use to me :)

can u explain this part in detail

if (-x $perl_binary) {
$ENV{'VMWARE_PERL_NESTED_EXEC'} = 1;
exec $perl_binary, '-I'.$libdir.'/perl5/site_perl/5.005',$0,
@ARGV;
}

thanks for ur help





On 8/2/07, John W. Krahn <krahnj@xxxxxxxxx> wrote:

Jeff Pang wrote:

From: vishnu <ckmvishnu@xxxxxxxxx>

Im trying to Build an API in perl.

I've included path of my installation like:


sub BEGIN {
push (@INC,
("/usr/lib/vmware-server/perl5/site_perl/5.005/i386-linux",
"."));
}

It's not sub BEGIN but BEGIN block,

BEGIN {
push @INC,"/your/lib/path";
}

perldoc perlmod

[ SNIP ]

BEGIN, CHECK, INIT and END

Four specially named code blocks are executed at the beginning and at
the
end of a running Perl program. These are the "BEGIN", "CHECK",
"INIT",
and "END" blocks.

These code blocks can be prefixed with "sub" to give the appearance
of a

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subroutine (although this is not considered good style). One should
note
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
that these code blocks don't really exist as named subroutines
(despite
their appearance). The thing that gives this away is the fact that
you can
have more than one of these code blocks in a program, and they will
get
all executed at the appropriate moment. So you can't execute any of
these
code blocks by name.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/





--
Vishnu,
cell:99944 75599

"if you don't make mistakes,
chances are you are not stretching yourself."


Relevant Pages

  • Re: VMWARE PERL API
    ... Im trying to Build an API in perl. ... sub BEGIN { ... Four specially named code blocks are executed at the beginning and at the ... So you can’t execute any of these ...
    (perl.beginners)
  • Re: Do my variables scoped to a subroutine get reconstructed every time?
    ... The reason is that some of my code blocks in the qr/// I want to ... affect lexically scoped variables in the sub. ... apply the pattern and return a token ID and lvalue data. ... I'll put it back inside the subroutine. ...
    (comp.lang.perl.misc)
  • Re: OK, lets be a bit negative and look at what APL has not achieved !
    ... extend the idea of "executable code blocks" to "applicable code blocks", which would allow similar operations on monadic and dyadic definitions, along the lines of ... I forget to mention that THETA takes 4 hours to evaluate, and with the current "dereference and execute immediately" rule, THETA gets evaluated twice in your version ... we could then use existing primitives to define just about every control structure known to man -- plus other stuff that other languages can't do, because they're constrained to use only those control structures defined in the language ...
    (comp.lang.apl)
  • Re: OK, lets be a bit negative and look at what APL has not achieved !
    ... extend the idea of "executable code blocks" to "applicable code blocks", which would allow similar operations on monadic and dyadic definitions, along the lines of ... I forget to mention that THETA takes 4 hours to evaluate, and with the current "dereference and execute immediately" rule, THETA gets evaluated twice in your version ...
    (comp.lang.apl)
  • Re: Perl comparison function for binary search
    ... I wrote this binary search function. ... a comparison function as the last parameter. ... "sub" and I noticed that the built in sort function doesn't need it. ... Short answer, no, code blocks are not accessible from normal Perl. ...
    (perl.beginners)