CPAN-Audit

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

a module.

To build the distribution, run this file normally:

	% perl Makefile.PL

But, it's more interesting than that. You can load it with C<require>
and call C<arguments> to get the data structure it passes to
C<WriteMakefile>:

	my $package = require '/path/to/Makefile.PL';
	my $arguments = $package->arguments;

Note that C<require>-ing a file makes an entry in C<%INC> for exactly
that name. If you try to C<require> another file with the same name,
even from a different path, C<require> thinks it has already loaded
the file. As such, I recommend you always require the full path to the
file.

The return value of the C<require> is a package name (in this case,
the name of the main module. Use that to call the C<arguments> method.

lib/CPAN/Audit.pm  view on Meta::CPAN

sub _get_db {
	my( $self, %params ) = @_;

	if ( $params{'json_db'} ) {
		my $data = do {
			local $/;
			open my($fh), '<:raw', $params{'json_db'}
				or die "could not read file <$params{json_db}>\n";
			<$fh>;
		};
		state $rc = require JSON;

		my $decoded = eval { JSON::decode_json($data) };
		die "could not decode JSON from <$params{json_db}>: @_\n" unless defined $decoded;
		return $decoded;
	}

	my $rc = eval { require CPANSA::DB };
	if ( $rc ) {
		return CPANSA::DB->db;
	}

script/cpan-audit  view on Meta::CPAN

}

use Data::Dumper;
sub dumper { Data::Dumper->new([@_])->Indent(1)->Sortkeys(1)->Terse(1)->Useqq(1)->Dump }
sub format_dump {
	my( $result ) = @_;
	return dumper($result);
}

sub format_json {
	state $rc = require JSON;
	my( $result ) = @_;
	return JSON::encode_json($result);
}

sub format_text {
	my( $result, $opts ) = @_;
	my $s = '';

	foreach my $distname ( keys %{ $result->{dists} } ) {
		my $advisories = $result->{dists}{$distname}{advisories};



( run in 0.329 second using v1.01-cache-2.11-cpan-0d8aa00de5b )