Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: accessing subroutines of a module

by vinoth.ree (Monsignor)
on Apr 19, 2014 at 05:21 UTC ( [id://1082864]=note: print w/replies, xml ) Need Help??


in reply to accessing subroutines of a module

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1082864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found