Think about Loose Coupling | |
PerlMonks |
Re^3: Proper way to create packages and re-usable code?by Hadrianus (Novice) |
on Feb 12, 2016 at 06:40 UTC ( [id://1155045]=note: print w/replies, xml ) | Need Help?? |
The following is not the proper way to modularize your code, but because you are just 'one yard before the finish line' you could use a script or Makefile to concatenate multiple files to a single program. That is easier and less error prone then the temporary "manually cut and paste" solution, that you are considering. Assuming you have the following files:
Your general libary routines are in my-serial-library.src and postlude_general.src. The 'main' program is the only customized part and is named after your client or location: main_barack. With a simple Makefile you can generate your program serial_com_barak.pl:
For another customer you create a new customized main and run 'make' again:
The Makefile:
Note: Make sure that you have a tab character (\x09, CNTRL-I or ^I) before the cat and other commands in the Makefile.Verify with 'cat -t Makefile':
In Section
Seekers of Perl Wisdom
|
|