App-CELL
view release on metacpan or search on metacpan
lib/App/CELL/Guide.pm view on Meta::CPAN
prepared and placed in the sitedir in advance.
=head4 Meta parameters
Meta parameters are by definition mutable: the application can change a
meta parameter's value any number of times, and L<App::CELL> will not care.
Initial C<meta> param settings are placed in a file entitled
C<$str_MetaConfig.pm> (where C<$str> is a string free of underscore
characters) in the sitedir. For example, if the application name is FooApp, its
initial C<meta> parameter settings could be contained in a file called
C<FooApp_MetaConfig.pm>. At initialization time, L<App::CELL> looks in
the sitedir for files matching this description, and attempts to load them.
(See L</How configuration files are named>.)
=head4 Core parameters
As in Request Tracker, C<core> parameters have immutable values and are
intended to be used as "factory defaults", set by the developer, that the
site administrator can override by setting site parameters. If the
application is called FooApp, its core configuration settings could be
contained in a file called C<FooApp_Config.pm> located in the sitedir.
lib/App/CELL/Guide.pm view on Meta::CPAN
a C<sitedir> parameter containing the full path to the sitedir can be
passed. If it is present, CELL will try it first. If needed for
portability, the path can be constructed using L<File::Spec> (e.g. the
C<catfile> method) or similar. It should be string containing the full path
to the directory. If the C<sitedir> argument points to a valid sitedir, it
is loaded and OK is returned. If a C<sitedir> argument is present but
invalid, an ERR status results. If no C<sitedir> argument was given, CELL
continues to the next step.
=item C<enviro> parameter --
if no C<sitedir> parameter is given, C<< $CELL->load >> looks for a
parameter called C<enviro> which it interprets as the name of an
environment variable containing the sitedir path. If the C<enviro>
argument points to a valid sitedir, it is loaded and OK is returned. If an
C<enviro> argument is present but invalid, an ERR status results. If there
is no C<enviro> argument at all, CELL continues to the next step.
=item C<CELL_SITEDIR> environment variable --
if no viable sitedir can be found by consulting the function call
parameters, CELL's load routine falls back to this hardcoded environment
variable. If the C<CELL_SITEDIR> environment variable exists and points to
lib/App/CELL/Guide.pm view on Meta::CPAN
=head3 Format of message file names
At initialization time, App::CELL walks the site configuration directory
tree looking for filenames that meet certain regular expressions. The
regular expression for message files is:
^.+_Message(_[^_]+){0,1}.conf$
In less-precise human terms, this means that the initialization routine
looks for filenames consisting of at least three, but possibly four,
components:
=over
=item 1. the application name (this can be anything)
=item 2. followed by C<_Message>
=item 3. optionally followed by C<_languagetag> where "languagetag" is a
language tag (see L</..link..> for details)
lib/App/CELL/Guide.pm view on Meta::CPAN
derived from the filename using a regular expression like this one:
_Message_([^_]+).conf$
(The part in parentheses signifies the part between C<_Message_> and
C<.conf> -- this is stored in the C<language> attribute of the message
object.)
No sanity checks are conducted on the language tag. Whatever string
the regular expression produces becomes the language tag for all
messages in that file. If no language tag is found, CELL first looks for a
config parameter called C<CELL_DEFAULT_LANGUAGE> and, failing that, the
hard-coded fallback value is C<en>.
I'll repeat that, since it's important: CELL assumes that the message
file names contain the relevant language tag. If the message
file name is C<MyApp_Message_foo-bar.conf>, then CELL will tag all
messages in that file as being in the C<foo-bar> language. Message files
can also be named like this: C<MyApp_Message.conf>, i.e. without a language
tag. In this case, CELL will attempt to determine the default language from
a site configuration parameter (C<CELL_DEFAULT_LANGUAGE>). If this
t/002-util.t view on Meta::CPAN
use File::Spec;
use Test::More;
use Test::Warnings;
my $status;
$log->init( ident => 'CELLtest' );
$log->info("-------------------------------------------------------- ");
$log->info("--- 002-util.t ---");
$log->info("-------------------------------------------------------- ");
# test that App::CELL::Util::timestamp returns something that looks
# like a timestamp
my $timestamp_regex = qr/^\d{4,4}-\d{2,2}-\d{1,2} \d{2,2}:\d{2,2}/;
my $timestamp = utc_timestamp();
ok( $timestamp =~ $timestamp_regex, "App::CELL::Util::timestamp" );
#diag( "Timestamp: " . $timestamp );
# App::CELL::Util::is_directory_viable with a viable directory
my $test_dir = File::Spec->catfile (
File::Spec->rootdir(),
);
( run in 0.442 second using v1.01-cache-2.11-cpan-64827b87656 )