CGI-Application-Standard-Config-1.01/0040775000175200017520000000000011057732411015720 5ustar markmarkCGI-Application-Standard-Config-1.01/t/0040775000175200017520000000000011057732411016163 5ustar markmarkCGI-Application-Standard-Config-1.01/t/boilerplate.t0100664000175200017520000000234611057732410020653 0ustar markmark#!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/CGI/Application/Standard/Config.pm'); CGI-Application-Standard-Config-1.01/t/pod.t0100664000175200017520000000021411057732411017124 0ustar markmark#!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(); CGI-Application-Standard-Config-1.01/t/pod-coverage.t0100664000175200017520000000025411057732411020721 0ustar markmark#!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(); CGI-Application-Standard-Config-1.01/t/00-load.t0100664000175200017520000000032411057732411017500 0ustar markmark#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'CGI::Application::Standard::Config' ); } diag( "Testing CGI::Application::Standard::Config $CGI::Application::Standard::Config::VERSION, Perl $], $^X" ); CGI-Application-Standard-Config-1.01/MANIFEST0100664000175200017520000000026311057732410017046 0ustar markmarkBuild.PL Changes MANIFEST META.yml # Will be created by "make dist" README lib/CGI/Application/Standard/Config.pm t/00-load.t t/boilerplate.t t/pod-coverage.t t/pod.t Makefile.PL CGI-Application-Standard-Config-1.01/lib/0040775000175200017520000000000011057732411016466 5ustar markmarkCGI-Application-Standard-Config-1.01/lib/CGI/0040775000175200017520000000000011057732411017070 5ustar markmarkCGI-Application-Standard-Config-1.01/lib/CGI/Application/0040775000175200017520000000000011057732411021333 5ustar markmarkCGI-Application-Standard-Config-1.01/lib/CGI/Application/Standard/0040775000175200017520000000000011057732411023073 5ustar markmarkCGI-Application-Standard-Config-1.01/lib/CGI/Application/Standard/Config.pm0100664000175200017520000001222611057732411024636 0ustar markmarkpackage CGI::Application::Standard::Config; use base 'Exporter'; use vars (qw/@EXPORT $VERSION/); $VERSION = '1.01'; # Note: We are loading the config plugin into our callers # namespace, not our own! sub import { my $class = shift; my $app = caller; # Export a stub config if there is not one defined already. if (not _meet_config_standard($app) ) { push @EXPORT, (qw/config std_config/); } } sub config { return undef }; sub std_config { return 1 }; sub _meet_config_standard { my $app = shift; if ( $app->can('config') # If they declared they meet the standard, we trust 'em. and $app->can('std_config') ) { return 1; } else { return 0; } } =pod Last updated: Sat Feb 18 23:42:29 EST 2006 =head1 NAME CGI::Application::Standard::Config -- Define a standard configuration API for CGI::Application =head1 RATIONALE This module defines a minimum standard interface that configuration plugins for CGI::Application should meet. Having such a standard allows other plugin authors to rely on basic configuration functionality without coding exceptions for several configuration modules, or giving up on such integration. =head1 SYNOPSIS =head2 For Average Users Simply load the config plugin before other modules that might use it: use CGI::Application::Plugin::ConfigAuto; use CGI::Application::Plugin::Session; =head2 For Configuration plugin authors Configuration plugin authors only need to follow the standards documented below. =head2 For other plugin authors who wish to rely on the standard Plugin authors who want to possibly use this standard can do so by simply using this module: package CGI::Application::Plugin::Session; use CGI::Application::Standard::Config; If a standards complaint config module hasn't already been loaded a stub for L will be added which will safely return C. =head3 Example use by another plugin Here code first tries to get configuration details first from a config file, then from options passed to a plugin-specific config method, and finally applies defaults if no configuration options are found. my $session_options = $self->config('Session_options') || $self->session_config() || $self->session_defaults; =head1 Standard Interface Definition The following defines a minimum standard for configuration plugins to meet. Config plugins are free to provide to additional functionality. Configuration plugins are also encourage to explicity document that they are using C. If there are existing methods that follow the standard but have different names, you can use this example to always export your method: sub import { my $app = caller; no strict 'refs'; my $full_name = $app . '::config'; # Change cfg to your config()-compliant method name *$full_name = \&cfg; CGI::Application::Plugin::YourNameHere->export_to_level(1,@_); } =head2 $self->std_config This method should be exported by default to simply declare that you meet the standard report which version of the standard you meet. This simple implementation is recommended: sub std_config { return 1; } =head2 $self->config The intended use is to load to read-only configuration details once from a config file at start up time. This service is provided by plugins (list below). They must support at at least this syntax: my $value = $self->config('key'); By default, C simply returns undef, making it safe for other plugins to directly to check if C<$self->config('key')> returns the value it needs. config() must be exported by default. For applications that need little configuration, L is not necessary-- using C in an instance script should suffice. Also, the C is the appropriate method to use to set a configuration value at run time. Configuration plugins that provide at least this basic API include: =over 4 =item L. =back =cut =head3 Standard config variables Users are encouraged to use these standard config variable names, to ease compatibility between plugins: ROOT_URI - A URI corresponding to the project root (http://foo.com/proj ) ROOT_DIR - a file system path to the same location ( /home/joe/www/proj ) All-caps are used to denote that config variables are essentially global constants. Why URI and not URL? The wikipedia explains: The contemporary point of view among the working group that oversees URIs is that the terms URL and URN are context-dependent aspects of URI and rarely need to be distinguished. Furthermore, the term URL is increasingly becoming obsolete, as it is rarely necessary to differentiate between URLs and URIs, in general. =head1 Standard Version This is 1.0 of the CGI::Application L standard. =head1 AUTHOR Written by Mark Stosberg with input from the CGI::Application community. =head1 COPYRIGHT and LICENSE Copyright (C) 2008, Mark Stosberg. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; CGI-Application-Standard-Config-1.01/META.yml0100664000175200017520000000051311057732411017165 0ustar markmark--- #YAML:1.0 name: CGI-Application-Standard-Config version: 1.01 author: - Mark Stosberg abstract: ~ license: perl build_requires: Test::More: 0 provides: CGI::Application::Standard::Config: file: lib/CGI/Application/Standard/Config.pm version: 1.01 generated_by: Module::Build version 0.2611 CGI-Application-Standard-Config-1.01/Changes0100664000175200017520000000035211057732411017210 0ustar markmarkRevision history for CGI-Application-Standard-Config 1.01 Thu Sep 4 06:13:36 EDT 2008 * Add explicit copyright and license statement. 1.00 Sat Feb 18 23:53:06 EST 2006 First version, released on an unsuspecting world. CGI-Application-Standard-Config-1.01/Makefile.PL0100664000175200017520000000064411057732411017673 0ustar markmark# Note: this file was auto-generated by Module::Build::Compat version 0.03 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'CGI::Application::Standard::Config', 'VERSION_FROM' => 'lib/CGI/Application/Standard/Config.pm', 'PREREQ_PM' => { 'Test::More' => '0' }, 'INSTALLDIRS' => 'site', 'PL_FILES' => {} ) ; CGI-Application-Standard-Config-1.01/README0100664000175200017520000001110411057732411016572 0ustar markmark Last updated: Sat Feb 18 23:42:29 EST 2006 NAME CGI::Application::Standard::Config -- Define a standard configuration API for CGI::Application RATIONALE This module defines a minimum standard interface that configuration plugins for CGI::Application should meet. Having such a standard allows other plugin authors to rely on basic configuration functionality without coding exceptions for several configuration modules, or giving up on such integration. SYNOPSIS For Average Users Simply load the config plugin before other modules that might use it: use CGI::Application::Plugin::ConfigAuto; use CGI::Application::Plugin::Session; For Configuration plugin authors Configuration plugin authors only need to follow the standards documented below. For other plugin authors who wish to rely on the standard Plugin authors who want to possibly use this standard can do so by simply using this module: package CGI::Application::Plugin::Session; use CGI::Application::Standard::Config; If a standards complaint config module hasn't already been loaded a stub for config() will be added which will safely return "undef". Example use by another plugin Here code first tries to get configuration details first from a config file, then from options passed to a plugin-specific config method, and finally applies defaults if no configuration options are found. my $session_options = $self->config('Session_options') || $self->session_config() || $self->session_defaults; Standard Interface Definition The following defines a minimum standard for configuration plugins to meet. Config plugins are free to provide to additional functionality. Configuration plugins are also encourage to explicity document that they are using "CGI::Application::Standard::Config". If there are existing methods that follow the standard but have different names, you can use this example to always export your method: sub import { my $app = caller; no strict 'refs'; my $full_name = $app . '::config'; # Change cfg to your config()-compliant method name *$full_name = \&cfg; CGI::Application::Plugin::YourNameHere->export_to_level(1,@_); } $self->std_config This method should be exported by default to simply declare that you meet the standard report which version of the standard you meet. This simple implementation is recommended: sub std_config { return 1; } $self->config The intended use is to load to read-only configuration details once from a config file at start up time. This service is provided by plugins (list below). They must support at at least this syntax: my $value = $self->config('key'); By default, "config()" simply returns undef, making it safe for other plugins to directly to check if "$self-"config('key')> returns the value it needs. config() must be exported by default. For applications that need little configuration, config() is not necessary-- using "PARAMS" in an instance script should suffice. Also, the "param()" is the appropriate method to use to set a configuration value at run time. Configuration plugins that provide at least this basic API include: CGI::Application::Plugin::ConfigAuto. Standard config variables Users are encouraged to use these standard config variable names, to ease compatibility between plugins: ROOT_URI - A URI corresponding to the project root (http://foo.com/proj ) ROOT_DIR - a file system path to the same location ( /home/joe/www/proj ) All-caps are used to denote that config variables are essentially global constants. Why URI and not URL? The wikipedia explains: The contemporary point of view among the working group that oversees URIs is that the terms URL and URN are context-dependent aspects of URI and rarely need to be distinguished. Furthermore, the term URL is increasingly becoming obsolete, as it is rarely necessary to differentiate between URLs and URIs, in general. Standard Version This is 1.0 of the CGI::Application config() standard. AUTHOR Written by Mark Stosberg with input from the CGI::Application community. COPYRIGHT and LICENSE Copyright (C) 2008, Mark Stosberg. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. CGI-Application-Standard-Config-1.01/Build.PL0100664000175200017520000000104711057732411017213 0ustar markmarkuse strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'CGI::Application::Standard::Config', license => 'perl', dist_author => 'Mark Stosberg ', dist_version_from => 'lib/CGI/Application/Standard/Config.pm', create_makefile_pl => 'traditional', create_readme => 1, build_requires => { 'Test::More' => 0, }, add_to_cleanup => [ 'CGI-Application-Standard-Config-*' ], ); $builder->create_build_script();