Provide access to generated Charmony config. Once the "charmony" action has been run and the Perl config file generated, provide access to the resulting config.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8dafae6b Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8dafae6b Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8dafae6b Branch: refs/heads/master Commit: 8dafae6b2c77f0142aa739c63e8fe3da064f5bc2 Parents: 84e87fc Author: Marvin Humphrey <[email protected]> Authored: Mon Dec 3 11:22:59 2012 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Jan 2 12:10:11 2013 -0800 ---------------------------------------------------------------------- .../perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm | 16 +++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/8dafae6b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm ---------------------------------------------------------------------- diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm index 13abca9..edbd1d9 100644 --- a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm +++ b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm @@ -87,6 +87,22 @@ sub ACTION_charmony { system(@command) and die "Failed to run $CHARMONIZER_EXE_PATH: $!"; } +my $config; + +sub charmony { + my ( undef, $key ) = @_; + if (!$config) { + eval { require 'Charmony.pm'; }; + if ( !$@ ) { + $config = Charmony->config; + } + } + if ($config) { + return $config->{$key}; + } + return; +} + sub _quotify { my $string = shift; $string =~ s/\\/\\\\/g;
