App-CamelPKI
view release on metacpan or search on metacpan
lib/App/CamelPKI/CA.pm view on Meta::CPAN
=pod
If the following code is activated (replacing C<if (0)> by
C<if (1)>), SQL requests done by L<App::CamelPKI::CADB> will be printed
during tests execution.
=cut
App::CamelPKI::CADB->debug_statements(sub {
my ($sql, @bind_values) = @_;
map { $_ = "<der>" if m/[\000-\010]/ } @bind_values;
diag join(" / ", $sql, @bind_values) . "\n";
}) if (0);
my $cadir = catdir(My::Tests::Below->tempdir, "test-CA");
mkdir($cadir);
sub load_ca {
my $cadb = load App::CamelPKI::CADB($cadir);
return load App::CamelPKI::CA($cadir, $cadb);
}
lib/App/CamelPKI/CADB.pm view on Meta::CPAN
delegate => [qw(search max_serial)];
}
=head2 debug_statements($debugsub)
This restricted method (see L<App::CamelPKI::RestrictedClassMethod>)
installs $debugsub as the SQL request observer on all
I<App::CamelPKI::CADB> objects constructed later. This method will be
called thusly for each SQL request:
$debugsub->($sql, @bind_values);
This mecanism is only destined for testing purposes; it should not
be used in production.
=cut
sub debug_statements : Restricted {
my ($class, $debugsub) = @_;
our $debugsub = $debugsub;
}
lib/App/CamelPKI/CADB.pm view on Meta::CPAN
to inspect the requests they caused to be made. If the $debug_queries
variable is set to a true value, SQL requests will also be printed to
STDERR.
=cut
our @queries;
our $debug_queries;
App::CamelPKI::CADB->debug_statements(sub {
my ($sql, @bind_values) = @_;
push(@queries, $sql);
map { $_ = "<der>" if m/[\000-\010]/ } @bind_values;
diag join(" / ", $sql, @bind_values) . "\n" if $debug_queries;
});
sub open_db {
my $cadb = load App::CamelPKI::CADB($testdir);
return $cadb;
}
test "->add()" => sub {
my $cadb = open_db;
$cadb->add($cert, template => "foobar");
lib/App/CamelPKI/SysV/Apache.pm view on Meta::CPAN
$self->tail_error_logfile;
return $self;
}
=head2 https_port()
=head2 https_port($portnum)
Gets or set the port on which the daemon will listen for HTTP/S
requests. The default value is 443 if the current process is
privileged enough to bind to it, or 3443 otherwise. This port number
is persisted onto disk and therefore only needs to be set once.
=head2 test_php_directory()
=head2 test_php_directory($dir)
=head2 test_php_directory(undef)
Gets, sets or disables the test PHP script directory in this instance
of I<App::CamelPKI::SysV::Apache>. The default is to disable this feature,
( run in 2.329 seconds using v1.01-cache-2.11-cpan-2398b32b56e )