Burak Gürsoy avatar Burak Gürsoy committed b6659fe

Distro fixes

Comments (0)

Files changed (6)

 Revision history for Perl extension CGI::Auth::Basic.
 
-Time zone is GMT+2
-
-1.31 Sun Jul  8 01:50:04 2012
-    => Bump version.
-
-1.30 Wed Sep 30 03:09:11 2009
+1.22 Mon Aug 27 01:22:53 2012
    => Perl::Critic refactoring.
+   => Distro fixes.
 
 1.21 Wed Apr 22 04:30:21 2009
    => Update builder.
-lib/CGI/Auth/Basic.pm
-eg/01_template.pl
-eg/02_turkish.pl
-eg/03_standard.pl
-eg/04_simple.pl
-eg/password.txt
-t/001-use.t
-Changes
-Build.PL
-MANIFEST
-MANIFEST.SKIP
-README
-SPEC
+lib/CGI/Auth/Basic.pm
+eg/01_template.pl
+eg/02_turkish.pl
+eg/03_standard.pl
+eg/04_simple.pl
+eg/password.txt
+t/001-use.t
+Changes
+Build.PL
+MANIFEST
+MANIFEST.SKIP
+README
+SPEC
-#defaults
-^Makefile$
-^blib/
-^pm_to_blib
-^blibdirs
-^Build$
-^_build/
-\.tmp$
+#defaults
+^Makefile$
+^blib/
+^pm_to_blib
+^blibdirs
+^Build$
+^_build/
+\.tmp$
 
 INSTALLATION
 
-To install this module type the following:
+Just use the cpan shell to install this module. From a command prompt, type:
 
-   perl Makefile.PL
-   make
-   make test
-   make install
+    cpan
 
-or under Windows:
+or
 
-   perl Makefile.PL
-   nmake
-   nmake test
-   nmake install
+    perl -MCPAN -e shell
 
-Alternatively, you can use the Build.PL
+to enter the cpan shell. And then enter:
 
-   perl Build.PL
-   perl Build
-   perl Build test
-   perl Build install
+   install CGI::Auth::Basic
 
-DEPENDENCIES
+If you don't have the cpan shell available, then you have a broken perl
+installation.
 
-None() if $your_perl >= 5.004;
+COPYRIGHT & LICENSE
 
-BUILD DEPENDENCIES
-
-   Test::More
-
-COPYRIGHT AND LICENCE
-
-Copyright (C) 2004-2009 Burak G�rsoy <burak@cpan.org>. All rights reserved.
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself. 
+See the LICENSE file bundled with this distribution.

lib/CGI/Auth/Basic.pm

 package CGI::Auth::Basic;
 use strict;
 use warnings;
-use vars qw( $VERSION $RE %ERROR $FATAL_HEADER $CAN_CRYPT );
-use constant EMPTY_STRING => q{};
-use constant CHMOD_VALUE  => 0777;
+use constant EMPTY_STRING        => q{};
+use constant CHMOD_VALUE         => 0777;
 use constant MIN_PASSWORD_LENGTH =>  3;
 use constant MAX_PASSWORD_LENGTH => 32;
-use constant CRYP_CHARS => q{.}, q{,}, q{/}, 0..9, q{A}..q{Z}, q{a}..q{z};
-use constant RANDOM_NUM => 64;
+use constant CRYP_CHARS          => q{.}, q{,}, q{/}, 0..9, q{A}..q{Z}, q{a}..q{z};
+use constant RANDOM_NUM          => 64;
 use Carp qw( croak );
 
-$VERSION = '1.31';
+our $VERSION = '1.22';
 
-CHECK_CRYPT: {
-   # The crypt() function is unimplemented due to excessive paranoia
-   my $eok = eval 'crypt("aa","aa"); 1';
-   $CAN_CRYPT = ( $@ || ! $eok ) ? 0 : 1;
-   if ( ! $CAN_CRYPT ) {
-      $eok = eval { require Crypt::UnixCrypt; 1; };
-      if ( $@ || ! $eok ) {
-         croak 'Your perl version does not implement crypt(). '
-              .'Upgrade perl or Install Crypt::UnixCrypt';
-      }
-   }
-}
-
-$RE = qr{\A\w\./}xms; # regex for passwords
+our $RE = qr{\A\w\./}xms; # regex for passwords
+our $FATAL_HEADER;
 
 # Fatal and other error messages
-%ERROR = (
+our %ERROR = (
    INVALID_OPTION    => 'Options must be in "param => value" format!',
    CGI_OBJECT        => 'I need a CGI object to run!!!',
    FILE_READ         => 'Error opening pasword file: ',
    return;
 }
 
-sub _crypt {
-   my $plain = shift;
-   my $salt  = shift;
-   return $CAN_CRYPT ? crypt($plain, $salt)
-                     : Crypt::UnixCrypt::crypt($plain, $salt);
-}
-
 sub exit_code {
    my $self = shift;
    my $code = shift || return;
 
 sub fatal_header {
    my($self, @args) = @_;
-   if (@args) {
-      $FATAL_HEADER = shift @args;
-   }
+   $FATAL_HEADER = shift @args if @args;
    return $FATAL_HEADER || qq~Content-Type: text/html; charset=ISO-8859-1\n\n~;
 }
 
 sub _match_pass  {
    my $self = shift;
    my $form = shift;
-   return _crypt($form, substr $self->{password}, 0, 2 ) eq $self->{password};
+   return crypt($form, substr $self->{password}, 0, 2 ) eq $self->{password};
 }
 
 sub _encode   {
    my $self  = shift;
    my $plain = shift;
    my $salt  = join EMPTY_STRING, (CRYP_CHARS)[ rand RANDOM_NUM, rand RANDOM_NUM ];
-   return _crypt $plain, $salt;
+   return crypt $plain, $salt;
 }
 
 sub _empty_cookie {
 
 __END__
 
+=pod
+
+=encoding utf8
+
 =head1 NAME
 
 CGI::Auth::Basic - Basic CGI authentication interface.
 See the 'eg' directory in the distribution. Download the distro from 
 CPAN, if you don't have it.
 
-=head1 CAVEATS
-
-If you are using perl 5.5.3 and older on Win32 platform (this issue
-may not be limited with Win32 but I'm not sure), you may need to 
-install L<Crypt::UnixCrypt>. The C<CORE::crypt()> function is not 
-implemented on this version.
-
-=head1 BUGS
-
-Contact the author if you find any.
-
 =head1 SEE ALSO
 
 L<CGI> and L<CGI::Auth>.
 use warnings;
 
 use Test::More qw( no_plan );
-BEGIN {
-    use_ok('CGI::Auth::Basic');
-}
+use CGI::Auth::Basic;
+
+ok(1, 'The module loaded ok');
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.