cPanel-APIClient

 view release on metacpan or  search on metacpan

lib/cPanel/APIClient/Response/WHM1.pm  view on Meta::CPAN


    my $metadata = $self->{'metadata'};

    if ( $metadata && ( my $output = $metadata->{'output'} ) ) {
        for my $type (qw( warnings messages )) {
            my $msgs = $output->{$type};

            next if !$msgs;

            if ( !ref $msgs ) {
                $msgs = [ split m<\n>, $msgs ];
            }

            if ( 'ARRAY' eq ref $msgs ) {
                push @messages, [ $type_xform{$type} => $_ ] for @$msgs;
            }
            else {
                warn "Unexpected type for metadata.output.$type: $msgs";
            }
        }
    }

lib/cPanel/APIClient/Utils/HTTPResponse.pm  view on Meta::CPAN


    return $self->[1] . $self->[2];
}

# needed for sessions
sub header {
    my ( $self, $name ) = @_;

    $name =~ tr<A-Z><a-z>;

    my @lines = split m<\x0d?\x0a>, $self->[1];

    for my $line (@lines) {
        my ( $thisname, $value ) = split m<\s*:\s*>, $line;
        $thisname =~ tr<A-Z><a-z>;

        if ( $name eq $thisname ) {
            return $value;
        }
    }

    return undef;
}

lib/cPanel/APIClient/X/CommandFailed.pm  view on Meta::CPAN

use warnings;

use parent qw( cPanel::APIClient::X::Base );

sub _new {
    my ( $class, $cmd_ar, $child_err ) = @_;

    my $signal = $child_err & 127;
    if ($signal) {
        require Config;
        my @signame = split m< >, $Config::Config{'sig_name'};

        my $name = $signame[$signal] || '??';

        $signal .= "/$name";
    }

    my $exit = $child_err >> 8;
    my $core = $child_err & 128;

    my $err = $signal ? "got signal $signal" : "exit $exit";

t/lib/TestHTTPUAPIMixin.pm  view on Meta::CPAN

            \%headers,
            superhashof(
                {
                    'Content-Type' => 'application/x-www-form-urlencoded',
                    Cookie         => ignore(),
                }
            ),
            'headers',
        ) or diag explain \%headers;

        my @cookies = sort split m<\s*;\s*>, $headers{'Cookie'};

        cmp_bag(
            \@cookies,
            [
                'cpsession=johnny%3a3KCfM88PHoZ4MoUf%2ce95011e2b6a51118250861a505638a8c',
                ignore(),
            ],
            'session cookie sent',
        );

        $cookies[1] =~ s<\Alogin=><> or die "bad login cookie: $cookies[1]";
        my $login = URI::Escape::uri_unescape( $cookies[1] );
        my @params = split m<&>, $login;

        cmp_bag(
            \@params,
            [
                'user=johnny',
                'pass=mysecret',
                'tfa_token=mytfa',
                'login_only=1',
            ],
            'login parameters',

t/lib/TestHTTPUAPIMixin.pm  view on Meta::CPAN

            {
                foo => 1,
                bar => [ 2, 3, '"' ],
                baz => q<>,
                '"' => '"',
            },
        )
    );

    my $content = $got->get_data()->{'content'};
    my @pieces = split m<&>, $content, -1;

    cmp_bag(
        \@pieces,
        [
            'foo=1',
            'bar=2',
            'bar=3',
            'bar=%22',
            'baz=',
            '%22=%22',



( run in 0.894 second using v1.01-cache-2.11-cpan-71847e10f99 )