http://qs321.pair.com?node_id=1082851

ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi
is it possible to access sub routines of a module without using Exporter and creating object ?

Replies are listed 'Best First'.
Re: accessing subroutines of a module
by vinoth.ree (Monsignor) on Apr 19, 2014 at 05:21 UTC

    You can explicitly refer to variables and functions within a package using the :: package qualifier.

    Ex,

    Here is the below sample module.

    MyModule.pm package MyModule; use strict; use warnings; sub func1 { your code here... } sub func2 { your code here... } 1;

    Use the above code into you code as,

    use MyModule; use strict; use warnings; MyModule::funct1();

    So here MyModule::funct1() is the package qualifier, to access the function without creating object and exporting function from MyModule namespace into main namespace.


    All is well
Re: accessing subroutines of a module
by Anonymous Monk on Apr 19, 2014 at 03:27 UTC

    is it possible to access sub routines of a module without using Exporter and creating object ?

    yes, of course, just use the full name, see zentara package/module tutorial

     

    Are you copying some interview questions from somewhere?