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.