"Pandey Rajeev-A19514" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I want to create a module, say ABC.pm.
> I dont want to build and install the module.
>
> I want to use a function xyz() of the module ABC in some other script.
> AND, I want to call the function as
> xyz();
> instead of
> ABC::xyz();
>
> Can anyone tell me how to do that without installing the module ?
> Is it sufficient to push the Module path in @INC ?

The current directory '.' is a member of @INC, so if you
simply write your Perl module file in same directory as
the calling program it will work fine (as long as you don't
use a module name that already exists amongst the installed
modules). Try the following files. It should be easy enough
to expand from there to what you want.

** FILE ABC.pm

  package ABC;
  use strict;

  require Exporter;

  our @ISA = qw/ Exporter /;

  our @EXPORT = qw/ xyz /;

  sub xyz {
    print "ABC::xyz() called\n";
  }

** FILE xyz.pl

  use strict;
  use warnings;

  use ABC;

  xyz();

** OUTPUT

  ABC::xyz() called




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to