Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by Perlbotics (Abbot)
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 + 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


Comment on Re: How to use a .pm file in a .pl file in another directory.
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950665]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-09-23 00:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (209 votes), past polls