http://www.perlmonks.org?node_id=950665


in reply to How to use a .pm file in a .pl file in another directory.

Your original question seems to be answered, but maybe this would be an opportunity to re-factor your project into something that is a little closer to common Perl project structure? Doing so would allow you to profit from existing tools that support building, testing, packaging, installing, etc. modules.

First step would be to move your modules into lib, move your tests into t, and rename tests *.pl to *.t. If you're already using Test::*, running prove -l should be sufficient to run the test suite. Another approach would be to let something like Module::Starter create an initial directory structure including all the templates and standard files. The latter approach might be a little bit more work concerning importing an already existing project, but I assume it will pay off in the long run.

+lib + Chess + Piece + Bishop.pm + King.pm + Knight.pm + Pawn.pm + Board.pm + Piece.pm + Square.pm +t + Bishop.t + King.t + Knight.t + Pawn.t + Square.t

See also Test::Simple, Test::More, Module::Starter(::PBP) (chose Module::Build or ExtUtils::MakeMaker), maybe Dist::Zilla. Meditation: RFC: How to Release Modules on CPAN in 2011

Replies are listed 'Best First'.
Re^2: How to use a .pm file in a .pl file in another directory.
by tommyxd (Acolyte) on Jan 30, 2012 at 19:27 UTC

    Thank you for your suggestion!

    To be honest, I haven't given much thought on the subject of project structure. I'm currently testing with Test::More and running the test suite with a single command looks pretty great! I'll definitely reorganize my directory structure to a one that is more common for Perl.

    Regards,

    Tommy