| 1 | # | ||||||||||
| 2 | # This file is part of Test-DBICSchemaLoaderDigest | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt>. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||
| 8 | # | ||||||||||
| 9 | package Test::DBICSchemaLoaderDigest; | ||||||||||
| 10 | { | ||||||||||
| 11 | 6 | $Test::DBICSchemaLoaderDigest::VERSION = '0.04'; | |||||||||
| 12 | } | ||||||||||
| 13 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 6 | ▶ | use 5.00800; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 6 | ▶ | use base qw/Exporter/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 6 | ▶ | use Test::More; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 6 | ▶ | use Digest::MD5 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 6 | our @EXPORT = qw/test_dbic_schema_loader_digest/; | |||||||||
| 20 | |||||||||||
| 21 | 6 | our $MARK_RE = qr{^(# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:)([A-Za-z0-9/+]{22})\n}; | |||||||||
| 22 | |||||||||||
| 23 | 4 | ▶ | sub test_dbic_schema_loader_digest { | ||||||||
|
Subroutine
test_dbic_schema_loader_digest: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 24 | 4 | my $fname = shift; | |||||||||
| 25 | |||||||||||
| 26 | 4 | ▶ | open my $fh, '<', $fname or die "$fname $!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 3 | my $buf = ''; | |||||||||
| 29 | 3 | ▶ | while ( my $line = <$fh> ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 31 | ▶ | if ( $line =~ $MARK_RE ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 2 | $buf .= $1; | |||||||||
| 32 | 2 | is Digest::MD5::md5_base64( $buf ), $2, "$fname is valid"; | |||||||||
| 33 | 2 | close $fh; | |||||||||
| 34 | 2 | return; | |||||||||
| 35 | } | ||||||||||
| 36 | else { | ||||||||||
| 37 | 29 | $buf .= $line; | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | 1 | close $fh; | |||||||||
| 41 | |||||||||||
| 42 | 1 | ok undef, "md5sum not found: $fname"; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | # ABSTRACT: test the DBIC::Schema::Loader's MD5 sum | ||||||||||
| 46 | |||||||||||
| 47 | 6 | 1; | |||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | =pod | ||||||||||
| 51 | |||||||||||
| 52 | =for :stopwords Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt> Chris Weyl | ||||||||||
| 53 | AAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH | ||||||||||
| 54 | |||||||||||
| 55 | =head1 NAME | ||||||||||
| 56 | |||||||||||
| 57 | Test::DBICSchemaLoaderDigest - test the DBIC::Schema::Loader's MD5 sum | ||||||||||
| 58 | |||||||||||
| 59 | =head1 VERSION | ||||||||||
| 60 | |||||||||||
| 61 | This document describes version 0.04 of Test::DBICSchemaLoaderDigest - released June 30, 2012 as part of Test-DBICSchemaLoaderDigest. | ||||||||||
| 62 | |||||||||||
| 63 | =head1 SYNOPSIS | ||||||||||
| 64 | |||||||||||
| 65 | use Test::More tests => 1; | ||||||||||
| 66 | use Test::DBICSchemaLoaderDigest; | ||||||||||
| 67 | test_dbic_schema_loader_digest('lib/Proj/Schema/Foo.pm'); | ||||||||||
| 68 | |||||||||||
| 69 | =head1 DESCRIPTION | ||||||||||
| 70 | |||||||||||
| 71 | Hey DBIC::Schema::Loader dumps follow code: | ||||||||||
| 72 | |||||||||||
| 73 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2lkIltTa9Ey3fExXmUB/gw | ||||||||||
| 74 | |||||||||||
| 75 | But, some programmer MODIFY THE ABOVE OF | ||||||||||
| 76 | THIS CODE!!!!!!!!!! AAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!! | ||||||||||
| 77 | |||||||||||
| 78 | This module tests for manual changes to the forbidden zone. If you use this | ||||||||||
| 79 | test, you can stop this problem before it becomes a real problem. | ||||||||||
| 80 | |||||||||||
| 81 | =encoding utf8 | ||||||||||
| 82 | |||||||||||
| 83 | =head1 METHODS | ||||||||||
| 84 | |||||||||||
| 85 | =head2 test_dbic_schema_loader_digest('lib/Proj/Schema/Foo.pm') | ||||||||||
| 86 | |||||||||||
| 87 | Check the MD5 sum. | ||||||||||
| 88 | |||||||||||
| 89 | =head1 CODE COVERAGE | ||||||||||
| 90 | |||||||||||
| 91 | ---------------------------- ------ ------ ------ ------ ------ ------ ------ | ||||||||||
| 92 | File stmt bran cond sub pod time total | ||||||||||
| 93 | ---------------------------- ------ ------ ------ ------ ------ ------ ------ | ||||||||||
| 94 | ...DBICSchemaLoaderDigest.pm 100.0 100.0 n/a 100.0 100.0 100.0 100.0 | ||||||||||
| 95 | Total 100.0 100.0 n/a 100.0 100.0 100.0 100.0 | ||||||||||
| 96 | ---------------------------- ------ ------ ------ ------ ------ ------ ------ | ||||||||||
| 97 | |||||||||||
| 98 | =head1 SEE ALSO | ||||||||||
| 99 | |||||||||||
| 100 | Please see those modules/websites for more information related to this module. | ||||||||||
| 101 | |||||||||||
| 102 | =over 4 | ||||||||||
| 103 | |||||||||||
| 104 | =item * | ||||||||||
| 105 | |||||||||||
| 106 | L<DBIx::Class::Schema::Loader> | ||||||||||
| 107 | |||||||||||
| 108 | =back | ||||||||||
| 109 | |||||||||||
| 110 | =head1 SOURCE | ||||||||||
| 111 | |||||||||||
| 112 | The development version is on github at L<http://github.com/RsrchBoy/test-dbicschemaloaderdigest> | ||||||||||
| 113 | and may be cloned from L<git://github.com/RsrchBoy/test-dbicschemaloaderdigest.git> | ||||||||||
| 114 | |||||||||||
| 115 | =head1 BUGS | ||||||||||
| 116 | |||||||||||
| 117 | Please report any bugs or feature requests on the bugtracker website | ||||||||||
| 118 | https://github.com/RsrchBoy/test-dbicschemaloaderdigest/issues | ||||||||||
| 119 | |||||||||||
| 120 | When submitting a bug or request, please include a test-file or a | ||||||||||
| 121 | patch to an existing test-file that illustrates the bug or desired | ||||||||||
| 122 | feature. | ||||||||||
| 123 | |||||||||||
| 124 | =head1 AUTHORS | ||||||||||
| 125 | |||||||||||
| 126 | =over 4 | ||||||||||
| 127 | |||||||||||
| 128 | =item * | ||||||||||
| 129 | |||||||||||
| 130 | Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt> | ||||||||||
| 131 | |||||||||||
| 132 | =item * | ||||||||||
| 133 | |||||||||||
| 134 | Chris Weyl <cweyl@alumni.drew.edu> | ||||||||||
| 135 | |||||||||||
| 136 | =back | ||||||||||
| 137 | |||||||||||
| 138 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 139 | |||||||||||
| 140 | This software is copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt>. | ||||||||||
| 141 | |||||||||||
| 142 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 143 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 144 | |||||||||||
| 145 | =cut | ||||||||||
| 146 | |||||||||||
| 147 | |||||||||||
| 148 | __END__ | ||||||||||