Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: How to use a .pm file in a .pl file in another directory.

by Perlbotics (Chancellor)
on Jan 29, 2012 at 22:04 UTC ( #950665=note: print w/replies, xml ) Need Help??

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 + + + + + + + +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.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950665]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2018-05-24 00:42 GMT
Find Nodes?
    Voting Booth?