AFS-PAG

 view release on metacpan or  search on metacpan

t/data/perlcriticrc  view on Meta::CPAN

[-Documentation::PodSpelling]

# Pod::Man and Pod::Text fixed this bug years ago.  I know, I maintain them.
[-Documentation::RequirePodLinksIncludeText]

# The POD sections Perl::Critic wants are incompatible with the POD template
# from perlpodstyle, which is what I use for my POD documentation.
[-Documentation::RequirePodSections]

# This problem was fixed in Perl 5.14, which now properly preserves the value
# of $@ even if destructors run at exit from the eval block.
[-ErrorHandling::RequireCheckingReturnValueOfEval]

# The default of 9 is too small and forces weird code contortions.
[InputOutput::RequireBriefOpen]
lines = 25

# This is correct 80% of the time, but it isn't correct for a lot of scripts
# inside packages, where maintaining $VERSION isn't worth the effort.
# Unfortunately, there's no way to override it, so it gets turned off
# globally.

t/lib/Test/RRA.pm  view on Meta::CPAN


    # If the first import looks like a version, pass it as a bare string.
    my $version = q{};
    if (@imports >= 1 && $imports[0] =~ m{ \A \d+ (?: [.][\d_]+ )* \z }xms) {
        $version = shift(@imports);
    }

    # Get caller information to put imports in the correct package.
    my ($package) = caller;

    # Do the import with eval, and try to isolate it from the surrounding
    # context as much as possible.  Based heavily on Test::More::_eval.
    ## no critic (BuiltinFunctions::ProhibitStringyEval)
    ## no critic (ValuesAndExpressions::ProhibitImplicitNewlines)
    my ($result, $error, $sigdie);
    {
        local $@            = undef;
        local $!            = undef;
        local $SIG{__DIE__} = undef;
        $result = eval qq{
            package $package;
            use $module $version \@imports;
            1;
        };
        $error = $@;
        $sigdie = $SIG{__DIE__} || undef;
    }

    # If the use failed for any reason, skip the test.
    if (!$result || $error) {

t/pag/basic.t  view on Meta::CPAN

# Establish the plan now that we know we're continuing.
use Test::More tests => 6;

# Load the module.
BEGIN { use_ok('AFS::PAG', qw(hasafs haspag setpag unlog)) }

# Determines if the user has valid tokens by running tokens.
#
# Returns: True if the user has valid tokens, false if not or if tokens fails
sub has_tokens {
    my $tokens = eval { capturex('tokens') };
    if (!$@ && $tokens =~ m{ [ ] tokens [ ] for [ ] }xmsi) {
        return 1;
    } else {
        return;
    }
}

# If k_hasafs returns false, we can't run any other tests.
SKIP: {
    if (!hasafs()) {

t/pag/basic.t  view on Meta::CPAN


    # If we had tokens, check to see if k_setpag hides them.
  SKIP: {
        if (!$had_tokens) {
            skip 'cannot check token hiding without existing tokens', 1;
        }
        ok(!has_tokens(), '...and hides existing tokens');
    }

    # Try to obtain tokens with aklog and test unlog.
    my $status = eval { systemx('aklog') };
  SKIP: {
        if ($@ || $status != 0 || !has_tokens()) {
            skip 'aklog cannot obtain tokens, cannot test unlog', 2;
        }
        ok(unlog(),       'unlog succeeds');
        ok(!has_tokens(), '...and we no longer have tokens');
    }
}

t/pag/isolation.t  view on Meta::CPAN

# Establish the plan now that we know we're continuing.
use Test::More tests => 3;

# Load the module.
BEGIN { use_ok('AFS::PAG', qw(hasafs setpag unlog)) }

# Determines if the user has valid tokens by running tokens.
#
# Returns: True if the user has valid tokens, false if not or if tokens fails
sub has_tokens {
    my $tokens = eval { capturex('tokens') };
    if (!$@ && $tokens =~ m{ [ ] tokens [ ] for [ ] }xmsi) {
        return 1;
    } else {
        return;
    }
}

# We need AFS support and existing tokens to run this test.
SKIP: {
    if (!hasafs() || !has_tokens()) {



( run in 1.511 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )