Catalyst-Plugin-Setenv-0.03/0000775000076500007650000000000011172336451015303 5ustar marcusmarcusCatalyst-Plugin-Setenv-0.03/Build.PL0000444000076500007650000000106111172336451016571 0ustar marcusmarcususe strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Catalyst::Plugin::Setenv', license => 'perl', dist_author => 'Jonathan Rockway ', dist_version_from => 'lib/Catalyst/Plugin/Setenv.pm', requires => { 'Catalyst::Runtime' => '5.7', # duh 'NEXT' => 0, # duh }, build_requires => { 'Test::More' => 0, 'FindBin' => 0, }, add_to_cleanup => [ 'Catalyst-Plugin-Setenv-*' ], ); $builder->create_build_script(); Catalyst-Plugin-Setenv-0.03/Changes0000444000076500007650000000040711172336451016573 0ustar marcusmarcusRevision history for Catalyst-Plugin-Setenv 0.03 18 April 2008 * MRO::Compat 0.02 25 January 2006 * Add the ability to append config'd environemnt variable to current value 0.01 12 October 2006 * First version, released on an unsuspecting world. Catalyst-Plugin-Setenv-0.03/lib/0000775000076500007650000000000011172336451016051 5ustar marcusmarcusCatalyst-Plugin-Setenv-0.03/lib/Catalyst/0000775000076500007650000000000011172336451017635 5ustar marcusmarcusCatalyst-Plugin-Setenv-0.03/lib/Catalyst/Plugin/0000775000076500007650000000000011172336451021073 5ustar marcusmarcusCatalyst-Plugin-Setenv-0.03/lib/Catalyst/Plugin/Setenv.pm0000444000076500007650000000647511172336451022705 0ustar marcusmarcuspackage Catalyst::Plugin::Setenv; use warnings; use strict; use MRO::Compat; =head1 NAME Catalyst::Plugin::Setenv - Allows you to set up the environment from Catalyst's config file. =head1 VERSION Version 0.03 =cut our $VERSION = '0.03'; =head1 SYNOPSIS In your application: use Catalyst qw/Setenv/; In your config file: environment: FOO: bar BAR: baz When your app starts, C<$ENV{FOO}> will be "bar", and C<$ENV{BAR}> will be "baz". You can also append and prepend to existing environment variables. For example, if C<$PATH> is C, you can append C by writing: environment: PATH: "::/myapp/bin" After that, C<$PATH> will be set to C. You can prepend, too: environment: PATH: "/myapp/bin::" which yields C. If you want a literal colon at the beginning or end of the environment variable, escape it with a C<\>, like C<\:foo> or C. Note that slashes aren't meaningful elsewhere, they're inserted verbatim into the relevant environment variable. =head1 EXPORT A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module. =head1 FUNCTIONS =head2 setup Calls the other setup methods, and then sets the environment variables. =cut sub setup { my $c = shift; $c->next::method(@_); my $env = $c->config->{environment}; return unless ref $env eq 'HASH'; foreach my $key (keys %$env){ my $value = $env->{$key}; if($value =~ /^:(.+)$/){ $ENV{$key} .= $1; } elsif($value =~ /^(.+[^\\]):$/){ $ENV{$key} = $1. $ENV{$key}; } else { $value =~ s/(^\\:|\\:$)/:/; $value =~ s/(^\\\\:|\\\\:$)/\\:/; $ENV{$key} = $value; } } return; } =head1 AUTHOR Jonathan Rockway, C<< >> =head1 BUGS =head2 Escaping Things like "\:foo" can't be literally inserted into an environment variable, due to my simplistic escaping scheme. Patches to fix this (but not interpert C<\>s anywhere else) are welcome. =head2 REPORTING Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Catalyst::Plugin::Setenv You can also look for information at: =over 4 =item * The Catalyst Website L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * RT: CPAN's request tracker L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS Thanks to Bill Moseley's message to the mailing list that prompted me to write this. =head1 COPYRIGHT & LICENSE Copyright 2006 Jonathan Rockway, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # End of Catalyst::Plugin::Setenv Catalyst-Plugin-Setenv-0.03/MANIFEST0000444000076500007650000000025311172336451016430 0ustar marcusmarcusBuild.PL Changes lib/Catalyst/Plugin/Setenv.pm MANIFEST This list of files META.yml README t/00-load.t t/01-live.t t/boilerplate.t t/pod-coverage.t t/pod.t t/TestApp.pm Catalyst-Plugin-Setenv-0.03/META.yml0000444000076500007650000000105311172336451016547 0ustar marcusmarcus--- name: Catalyst-Plugin-Setenv version: 0.03 author: - 'Jonathan Rockway ' abstract: Allows you to set up the environment from Catalyst's config file. license: perl resources: license: http://dev.perl.org/licenses/ requires: Catalyst::Runtime: 5.7 NEXT: 0 build_requires: FindBin: 0 Test::More: 0 provides: Catalyst::Plugin::Setenv: file: lib/Catalyst/Plugin/Setenv.pm version: 0.03 generated_by: Module::Build version 0.3 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 Catalyst-Plugin-Setenv-0.03/README0000444000076500007650000000166011172336451016162 0ustar marcusmarcusCatalyst-Plugin-Setenv Allows you to set up the environment from Catalyst's config file. INSTALLATION To install this module, run the following commands: perl Build.PL ./Build ./Build test ./Build install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Catalyst::Plugin::Setenv You can also look for information at: Search CPAN http://search.cpan.org/dist/Catalyst-Plugin-Setenv CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Plugin-Setenv AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/Catalyst-Plugin-Setenv CPAN Ratings: http://cpanratings.perl.org/d/Catalyst-Plugin-Setenv COPYRIGHT AND LICENCE Copyright (C) 2006 Jonathan Rockway This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Catalyst-Plugin-Setenv-0.03/t/0000775000076500007650000000000011172336451015546 5ustar marcusmarcusCatalyst-Plugin-Setenv-0.03/t/00-load.t0000444000076500007650000000026611172336451017067 0ustar marcusmarcus#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Catalyst::Plugin::Setenv' ); } diag( "Testing Catalyst::Plugin::Setenv $Catalyst::Plugin::Setenv::VERSION, Perl $], $^X" ); Catalyst-Plugin-Setenv-0.03/t/01-live.t0000444000076500007650000000074711172336451017114 0ustar marcusmarcus#!/usr/bin/perl # 01-live.t # Copyright (c) 2006 Jonathan Rockway BEGIN { $ENV{EXISTS} = q{XXX}; $ENV{PREPEND} = q{XXX}; $ENV{SLASH} = q{FAIL}; $ENV{END} = q{FAIL}; }; use Test::More tests => 7; use FindBin qw($Bin); use lib "$Bin"; use Catalyst::Test qw(TestApp); is($ENV{FOO}, 'foo'); is($ENV{BAR}, 'bar'); is($ENV{EXISTS}, 'XXX:YYY'); is($ENV{PREPEND}, 'YYY:XXX'); is($ENV{NEW}, ':YYY'); is($ENV{SLASH}, '\:YYY'); is($ENV{END}, 'YYY\:'); Catalyst-Plugin-Setenv-0.03/t/boilerplate.t0000444000076500007650000000233511172336451020234 0ustar marcusmarcus#!perl -T use strict; use warnings; use Test::More tests => 3; sub not_in_file_ok { my ($filename, %regex) = @_; open my $fh, "<", $filename or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } module_boilerplate_ok('lib/Catalyst/Plugin/Setenv.pm'); Catalyst-Plugin-Setenv-0.03/t/pod-coverage.t0000444000076500007650000000025411172336451020303 0ustar marcusmarcus#!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); Catalyst-Plugin-Setenv-0.03/t/pod.t0000444000076500007650000000021411172336451016506 0ustar marcusmarcus#!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); Catalyst-Plugin-Setenv-0.03/t/TestApp.pm0000444000076500007650000000064011172336451017460 0ustar marcusmarcus#!/usr/bin/perl # TestApp.pm # Copyright (c) 2006 Jonathan Rockway package TestApp; use FindBin qw($Bin); use Catalyst qw/Setenv/; __PACKAGE__->config({environment => {FOO => 'foo', BAR => 'bar', EXISTS => '::YYY', PREPEND => 'YYY::', NEW => "\\:YYY", SLASH => "\\\\:YYY", END => "YYY\\\\:", }} ); __PACKAGE__->setup; 1;