in reply to Using Multiple Modules

Specify the whole path as "lib", and only the file as "required". As use executes at compile time, be sure to set the variables in a BEGIN block:
my ($codes_dir, $runner_lib); BEGIN { $codes_dir = '...'; $runner_lib = '...'; } use lib "$codes_dir/perl_libs", "$runner_lib/runner_libs"; require 'perl_db_interface.pl'; require 'CodesModule.pm';

Note that normally, you shouldn't require files but packages:

require CodesModule;

Why don't you use them directly, anyway?

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Using Multiple Modules
by hmeharward (Novice) on Jan 21, 2016 at 21:02 UTC

    Thank you! I will try this instead. I was a little confused on what should be required but this clears things up!

Re^2: Using Multiple Modules
by hmeharward (Novice) on Jan 21, 2016 at 21:25 UTC

    Everytime I've tried to use them directly I haven't been successful. The code compiles but stops when it gets to the first subroutine

      How does the .pm export its subroutines? If it uses Exporter, you need to run
      require CodesModule; 'CodesModule'->import;

      Or you might even need to name the subroutines as the import's parameters if the module doesn't use @EXPORT but @EXPORT_OK.

      Update: if you switched to

      use CodesModule;

      you need to name the subs for @EXPORT_OK in this way:

      use CodesModule qw{ func1 func2 };
      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Thank you so much for your help. In my code I use .pm this way:

         use runner_libs::CodesModule qw(exit_gracefully subprogram_runner warning_or_failure open_or_fail error_display cal_time start_time end_time trim CheckError);

        And the .pm exports this way:

        package CodesModule; use Exporter 'import'; @EXPORT_OK = qw(exit_gracefully subprogram_runner warning_or_failure o +pen_or_fail error_display cal_time start_time end_time trim CheckErro +r);