in reply to Re^2: Using require in a module and alongside that module in a program
in thread Using require in a module and alongside that module in a program

If you use do, you literally execute the contents of the file in your current context, very similar to a straight in-lining. The interpreter will have no knowledge that the subroutines in your main program and in your Modis::ParseMe module should be related - you will essentially be using two identical, independent libraries.

There are a number of drawbacks to this approach; for example, if your subs from subs.pl use closures, there will be no relationship between the variables wrapped in main and in Modis::ParseMe. Thus, if you are talking about a long term solution, you want use an Exporter.

  • Comment on Re^3: Using require in a module and alongside that module in a program