Re: My first module is failing on CPAN
by bart (Canon) on Jun 29, 2008 at 08:20 UTC
|
Error: Can't locate Crypt/Rijndael.pm in @INC
Add it in Makefile.PL under PREREQ_PM, next to the mention of Test::More. | [reply] [d/l] [select] |
Re: My first module is failing on CPAN
by almut (Canon) on Jun 29, 2008 at 09:24 UTC
|
This has nothing to do with why your test(s) are failing... but while
looking into the code to figure out if you're really depending on
Crypt::Rijndael (or if that require Crypt::Rijndael was maybe
just a misguided attempt to load the module only if available (which wouldn't work... but doesn't seem to be the case here)), I incidentally noticed that you might simplify your hex <-->
bin conversions
sub yubikey_hex2bin
{
my $in = $_[0];
my $out = "";
for(my $k=0;$k<length($in);$k+=2)
{
$out .= chr(hex(substr($in,$k,2)));
}
return $out;
}
sub yubikey_bin2hex
{
my $in = $_[0];
my $out = "";
for(my $k=0;$k<length($in);$k++)
{
$out .= sprintf("%2x",ord(substr($in,$k,1)));
}
$out =~ s/ /0/g; # this is a hack.. not sure why it has
+ to be like this...
return $out;
}
by using the Perl builtins un/pack with the "H" template, i.e.
# hex2bin
$bin = pack "H*", $hex;
# bin2hex
$hex = unpack "H*", $bin;
Or, if you wanted to stick with your conversion routines, you could
get rid of the $out =~ s/ /0/g hack by using "%02x" in sprintf().
Yeah, I know you didn't ask for a code review, so my apologies, if
this advice is unsolicited... :)
| [reply] [d/l] [select] |
Re: My first module is failing on CPAN
by holli (Abbot) on Jun 29, 2008 at 08:23 UTC
|
First (and unrelated to your problem), using an underscore in the module name is iiiiek. Second, you do not list any prerequisities in your Makefile.pm
| [reply] [d/l] |
Re: My first module is failing on CPAN
by syphilis (Archbishop) on Jun 29, 2008 at 11:34 UTC
|
You've already received good advice re the Crypt::Rijndael failure, but I see at http://www.nntp.perl.org/group/perl.cpan.testers/2008/06/msg1805989.html that at least one tester had Crypt::Rijndeal installed, and the only failing test was the pod coverage test. It seems odd that you didn't get the same failure when you ran the test suite on your own machine. Perhaps the tester was running a different version of Test::Pod::Coverage. The tester's report doesn't indicate the version of Test::Pod::Coverage being used - though I believe that info would have been supplied in the report if you had specified Test::Pod::Coverage in PREREQ_PM (and I therefore recommend that you do that :-)
Cheers, Rob | [reply] [d/l] |
|
|
It seems odd that you didn't get the same failure when you ran the test suite on your own machine. Perhaps the tester was running a different version of Test::Pod::Coverage.
Or perhaps the tester had it installed, but Massyn didn't, so the test was always skipped on his machine. There is some danger involved in using a template for a module if you don't know what it does.
| [reply] |
Re: My first module is failing on CPAN
by leocharre (Priest) on Jun 29, 2008 at 23:54 UTC
|
I just want to state a couple of obvious pointers about getting module distros to work on cpan.
after you run your 'make dist', copy the output file to /tmp/ and test it out as somebody else would. You can make a script to test this automatically in bash or perl.
Doing this you may find that you left some files out in the MANIFEST - for one.
Also make sure that your Makefile.PL does list all the dependencies. Assume that none will be present in the host.
I have some personal hacks in LEOCHARRE::Dev as examples, that do things like automatically fill in your Makefile.PL and MANIFEST, etc.
| [reply] |
|
|
Yeah, there is a way to test the distribution built with make dist, it is called make disttest
Prior to releasing anything to CPAN, I usually do this:
perl Makefile.PL && make test && make dist && make disttest
| [reply] [d/l] |
|
|
| [reply] |
Re: My first module is failing on CPAN
by Khen1950fx (Canon) on Jun 30, 2008 at 13:59 UTC
|
I got your module to pass all tests, but I had to make a few changes. First, the Makefile.PL:
PREREQ_PM => {
'Test::More' => 0,
'Pod::Coverage' => '0.18',
'Test::Pod' => '1.22',
'Test::Pod::Coverage' => '1.08',
'Crypt::Rijndael' => 0
},
Then change the pod-coverage.t to:
use strict;
use warnings;
use Test::More qw(no_plan);
use Test::Pod::Coverage 1.08;
plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD co
+verage"
unless eval "use Test::Pod::Coverage 1.08";
all_pod_coverage_ok();
Updated: Changed "plan skip_all". | [reply] [d/l] [select] |
|
|
That did not work for me:
t/pod-coverage....You tried to plan twice at t/pod-coverage.t line 6.
I would rather use the default pod-coverage.t created by Module::Starter. It checks for both Test::Pod::Coverage and Pod::Coverage:
$mkdir -p /opt/my-new-module/
$ module-starter --module=My::New::Module --author="Me, Myself" --emai
+l=myself@cpan.org
$ cat t/pod-coverage.t
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing PO
+D coverage"
if $@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD cover
+age"
if $@;
all_pod_coverage_ok();
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
| [reply] [d/l] [select] |
Re: My first module is failing on CPAN
by andreas1234567 (Vicar) on Jul 01, 2008 at 06:38 UTC
|
I'm hoping to get some guidance as to what I missed in the module side of things.
First, thank you for contributing to the free software community.
Second, I agree with holli that you should perhaps rename your module so that it contains letters and semi-colons only.
Third, when looking at your code, the thing I would like to see added is tests of the core functionality. E.g. like the one below (I'd create one file for each main function). I was once surprised just how difficult it is to write working code for multiple platforms, given different architectures and endianness.
# 01-yubikey_decrypt.t
use strict;
use warnings;
use Test::More;
use Auth::Yubikey_Decrypter;
my $fulltoken = "dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh";
my $aeskey = "ecde18dbe76fbd0c33330f1c354871db";
my ($publicID,$secretid_hex,$counter_dec,$timestamp_dec,$session_use_d
+ec,$random_dec,$crc_dec,$crc_ok) =
Auth::Yubikey_Decrypter::yubikey_decrypt($fulltoken,$aeskey);
plan tests => 8;
is($publicID, q{dteffuje}, q{Expect publicID eq dteffuje});
is($secretid_hex, q{8792ebfe26cc}, q{Expect secretid_hex eq 8792ebf
+e26cc});
is($counter_dec, q{19}, q{Expect counter_dec eq 19});
is($timestamp_dec, q{49712}, q{Expect timestamp_dec eq 49712}
+);
is($session_use_dec, q{17}, q{Expect session_use_dec eq 17})
+;
is($random_dec, q{40904}, q{Expect random_dec eq 40904});
is($crc_dec, q{51235}, q{Expect crc_dec eq 51235});
is($crc_ok, q{1}, q{Expect crc_ok eq 1});
__END__
Fourth, in a question of personal preference, I think the yubikey_decrypt subroutine probably would be better off returning a named hash rather than an 8-element list.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
| [reply] [d/l] [select] |
Re: My first module is failing on CPAN
by DrHyde (Prior) on Jun 30, 2008 at 10:02 UTC
|
Have you tried asking the people who sent failure reports for help? | [reply] |
|
|
| [reply] |