Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl archeology: Need help in refactoring of old Perl code that does not use strict

by 1nickt (Canon)
on Nov 14, 2017 at 19:53 UTC ( [id://1203421]=note: print w/replies, xml ) Need Help??


in reply to Perl archeology: Need help in refactoring of old Perl code that does not use strict

Hi,

Since no one has addressed this part...

How can I access subs a,b,c without qualifying them with namespace x from the main:: namespace?

See Exporter or Exporter::Tiny. Also see perlmod.

"main" script:

use strict; use warnings; use Foo qw/ bar /; print bar('baz'); __END__

file 'Foo.pm':
package Foo; use strict; use warnings; use parent qw/ Exporter /; our @EXPORT_OK = qw/ bar /; sub bar { return uc shift } 1;

Hope this helps!


The way forward always starts with a minimal test.
  • Comment on Re: Perl archeology: Need help in refactoring of old Perl code that does not use strict
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Perl archeology: Need help in refactoring of old Perl code that does not use strict
by likbez (Sexton) on Nov 15, 2017 at 00:09 UTC
    Thank you very much. Never heard about existence of Exporter::Tiny. That might help me.

Log In?
Username:
Password:

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

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

    No recent polls found