function - perl how to access func when the module is imported on the fly -
I have a module that looks like this:
package test; Strict use; Use warnings; Hello {my $ val = shift print "val = $ val \ n"; } And in the second module, I include this one like this:
My $ Module = 'Test' Aval '$ Module Required is"; How can I call the function Hello in another module / I mean that a function is not like any method.
You can use a symbolic reference:
{No strict ' Refs'; # Blocked Block & amp; Disable rigorously for $ $ module ': Hello'}; } Alternatively, you can see the function in the calling package (see):
package test; Exporters use 'import'; Our @EXPORT = qw (hello); Hello hello {...} Then in your code:
Use my $ module = 'test' aval '$ module; Hi ("test");
Comments
Post a Comment