/usr/bin/cpan2doap is in librdf-doap-lite-perl 0.002-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #!/usr/bin/env perl
use strict;
use warnings;
require Getopt::Long;
my %options = (
'meta-file' => 'META.json',
'changes-file' => 'Changes',
'output-file' => 'doap.rdf',
'output-format' => 'auto',
);
Getopt::Long::GetOptions(
\%options,
'meta-file|m=s',
'changes-file|c=s',
'output-file|o=s',
'output-format=s',
'help|usage|h',
'version|V',
);
if ($options{'version'})
{
printf("cpan2doap (RDF::DOAP::Lite %s)\n", RDF::DOAP::Lite->VERSION);
exit(0);
}
if ($options{'help'})
{
print <<"HELP"; exit;
Usage: $0 [options]
Options:
--meta-file=F, -m F Input file name conforming to CPAN::Meta::Spec.
Defaults to 'META.json'.
--changes-file=F, -c F Input file name conforming to CPAN::Changes::Spec.
Defaults to 'Changes'.
--output-file=F, -o F File name for output. Defaults to 'doap.rdf'.
--output-format=X Output format. One of 'xml', 'ttl' or 'auto'.
--help, --usage, -h Shows this help.
--version, -V Show version information.
HELP
}
my %attrs;
if (-f $options{'meta-file'})
{
require CPAN::Meta;
$attrs{'meta'} = 'CPAN::Meta'->load_file($options{'meta-file'});
}
else
{
die("Input file $options{'meta-file'} does not exist!\n");
}
if (-f $options{'changes-file'})
{
if (eval { require CPAN::Changes })
{
$attrs{'changes'} = 'CPAN::Changes'->load($options{'changes-file'});
}
else
{
warn("Changes file cannot be processed without CPAN::Changes.\n");
}
}
else
{
warn("Input file $options{'changes-file'} does not exist!\n");
}
require RDF::DOAP::Lite;
my $doap = 'RDF::DOAP::Lite'->new(%attrs);
my $method = 'doap_xml';
if (lc($options{'output-format'}) eq 'ttl')
{
$method = 'doap_ttl';
}
elsif (lc($options{'output-format'}) eq 'xml')
{
$method = 'doap_xml';
}
elsif ($options{'output-file'} =~ /\.(ttl|turtle|n3|txt)$/i)
{
$method = 'doap_ttl';
}
$doap->$method($options{'output-file'});
__END__
=pod
=encoding utf-8
=head1 NAME
cpan2doap - generate DOAP data from a CPAN distribution's root directory
=head1 SYNPOSIS
B<cpan2doap> [options]
=head1 DESCRIPTION
The B<cpan2doap> command generates DOAP data in either RDF/XML or Turtle
serialization from the 'META.json' and 'Changes' files often found in a
CPAN distribution's root directory.
=head1 OPTIONS
=over
=item B<< --meta-file=F, -m F >>
Input file name conforming to CPAN::Meta::Spec.
Defaults to 'META.json'.
=item B<< --changes-file=F, -c F >>
Input file name conforming to CPAN::Changes::Spec.
Defaults to 'Changes'.
=item B<< --output-file=F, -o F >>
File name for output. Defaults to 'doap.rdf'.
=item B<< --output-format=X >>
Output format. One of 'xml', 'ttl' or 'auto'.
=item B<< --help, --usage, -h >>
Shows help.
=item B<< --version, -V >>
Show version information.
=back
=head1 EXAMPLES
For many distributions, accepting the defaults is adequate:
cpan2doap
For older distributions which use 'META.yml' instead of 'META.json':
cpan2doap -m META.yml
To output data in Turtle format (less verbose than RDF/XML):
cpan2doap -o doap.ttl
=head1 BUGS
Please report any bugs to
L<http://rt.cpan.org/Dist/Display.html?Queue=RDF-DOAP-Lite>.
=head1 SEE ALSO
L<RDF::DOAP::Lite>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|