Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by 1nickt (Abbot)
on Nov 14, 2017 at 14:53 UTC ( #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 (Acolyte) on Nov 14, 2017 at 19: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
Node Status?
node history
Node Type: note [id://1203421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2019-11-19 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (93 votes). Check out past polls.

    Notices?