in reply to Looking for suggestions for accessing/running scripts needed by a local Perl library

My guess is that you want to keep this stuff in Perl scripts because you only occasionally use this functionality. I would convert my scripts both to actual modules and in some cases methods that load via AutoLoader.

Main Script
#!/usr/bin/perl -w use strict; use lib qq~./mydir~; require qq~./code.pm~; #use Foo; print Foo::foo(); 1;
Module
package Foo; use AutoLoader 'AUTOLOAD'; # import the default AUTOLOAD subroutine 1;
Autoloaded Stuff

Note that your .al files have to be in a particular directory. in this case it is here: ./mydir/auto/Foo/foo.al

package Foo; sub foo { return 'tastes so good...'; } 1;
Try it Out
perl code.pl tastes so good...

Celebrate Intellectual Diversity

  • Comment on Re: Looking for suggestions for accessing/running scripts needed by a local Perl library
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Looking for suggestions for accessing/running scripts needed by a local Perl library
by nysus (Parson) on Jan 24, 2024 at 04:10 UTC

    So this is like an AUTOLOAD for packages instead of subroutines?

    $PM = "Perl Monk's";
    $MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
    $nysus = $PM . ' ' . $MC;
    Click here if you love Perl Monks