11 May 2019 19:24:26 UTC
- Distribution: Panotools-Script
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (401 / 0 / 0)
- KwaliteeBus factor: 0
- 67.49% Coverage
- License: unknown
- Activity24 month
- Download (160.4KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userBPOSTLE Bruno Postle
Panotools::Makefile - Makefile creation
Simple object interface for generating Makefiles
Writing Makefiles directly from perl scripts with print and "\t" etc... is prone to error, this library provides a simple perl interface for assembling Makefiles.
Note GNU make syntax is assumed, i.e. on BSD systems where pmake is the default you will have to switch to gmake if you want to work with weirdly named targets containing special characters such as spaces or parentheses.
Create a new Makefile object:
my $makefile = new Panotools::Makefile;
Start adding items to the Makefile:
my $var_user = $makefile->Variable ('USER'); $var_user->Values ("Dr. Largio d'Apalansius (MB)"); my $rule_all = $makefile->Rule ('all'); $rule_all->Command ('echo', '$(USER_SHELL)', '>', 'My File.txt'); $makefile->Comment ('.PHONY target isn't strictly necessary in this case'); my $rule_phony = $makefile->Rule; $rule_phony->Targets ('.PHONY'); $rule_phony->Prerequisites ('all');
Assemble all this into string that can be written to a Makefile:
my $string = $makefile->Assemble;
..or write the Makefile:
..or let the module execute rules with 'make' directly:
$makefile->DoIt ('all') || warn "Didn't work :-(";
The following command will be executed, something that isn't possible with perl system() or exec(), and would otherwise require careful assembly with backticks:
echo Dr.\ Largio\ d\'Apalansius\ \(MB\) > My\ File.txt
On the Windows platform you get appropriate quoting:
echo "Dr. Largio d'Apalansius (MB)" > "My File.txt"
Module Install Instructions
To install Panotools::Script, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Panotools::Script
For more information on module installation, please visit the detailed CPAN module installation guide.