Module: Opener::BuildTools::Perl
- Defined in:
- lib/opener/build-tools/perl.rb
Overview
Module that provides helper methods for dealing with Perl specific projects.
Class Method Summary collapse
-
.perl_version ⇒ String
Returns a String containing the Perl version in a RubyGems comparible format.
-
.require_perl_module(name) ⇒ Object
Checks if a given Perl module is installed.
Class Method Details
.perl_version ⇒ String
Returns a String containing the Perl version in a RubyGems comparible format.
34 35 36 |
# File 'lib/opener/build-tools/perl.rb', line 34 def perl_version `perl --version 2>&1`.match(/\(v([\d\.]+)\)/)[1] end |
.require_perl_module(name) ⇒ Object
Checks if a given Perl module is installed. If the module can not be found the current script is terminated.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/opener/build-tools/perl.rb', line 16 def require_perl_module(name) print "Checking for Perl module #{name}... " output = `perl -M#{name} -e 'print "exists";' 2>&1`.strip if output == 'exists' puts 'yes' else abort 'no' end end |