[Cpan-forum-commit] rev 191 - in trunk: . lib/CPAN lib/CPAN/Forum t/other
svn at pti.co.il
svn at pti.co.il
Tue Aug 29 15:15:48 IDT 2006
Author: gabor
Date: 2006-08-29 15:15:48 +0300 (Tue, 29 Aug 2006)
New Revision: 191
Added:
trunk/t/other/critic.t
Modified:
trunk/
trunk/lib/CPAN/Forum.pm
trunk/lib/CPAN/Forum/Build.pm
trunk/lib/CPAN/Forum/INC.pm
trunk/lib/CPAN/Forum/Markup.pm
trunk/t/other/pod-coverage.t
trunk/t/other/pod.t
Log:
more documentation
add Perl::Critic
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11042
+ 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11043
Modified: trunk/lib/CPAN/Forum/Build.pm
===================================================================
--- trunk/lib/CPAN/Forum/Build.pm 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/lib/CPAN/Forum/Build.pm 2006-08-29 12:15:48 UTC (rev 191)
@@ -76,7 +76,7 @@
mkpath $dir or die "Cannot create directory '$dir' $!\n";
}
- open my $m, "MANIFEST" or die "Could not find the MANIFEST file $!\n";
+ open my $m, '<', 'MANIFEST' or die "Could not find the MANIFEST file $!\n";
while (my $line = <$m>) {
next if $line !~ /\S/;
@@ -101,13 +101,13 @@
print "Copying '$file' to '$dir/$file'\n" if $args{verbose};
copy("$from/$file", "$dir/$file") or die "Could not copy '$from/$file' $!\n";
#if ($file =~ /pl$/) {
- chmod 0755, "$dir/$file" or warn "Cannot chmod '$dir/$file' $!\n";
+ chmod oct(755), "$dir/$file" or warn "Cannot chmod '$dir/$file' $!\n";
#}
}
if (not -e "$dir/db") {
mkpath "$dir/db";
- chmod 0777, "$dir/db";
+ chmod oct(777), "$dir/db";
}
}
Modified: trunk/lib/CPAN/Forum/INC.pm
===================================================================
--- trunk/lib/CPAN/Forum/INC.pm 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/lib/CPAN/Forum/INC.pm 2006-08-29 12:15:48 UTC (rev 191)
@@ -1,4 +1,6 @@
package CPAN::Forum::INC;
+use strict;
+use warnings;
use CPAN::Forum;
use CPAN::Forum::Markup;
Modified: trunk/lib/CPAN/Forum/Markup.pm
===================================================================
--- trunk/lib/CPAN/Forum/Markup.pm 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/lib/CPAN/Forum/Markup.pm 2006-08-29 12:15:48 UTC (rev 191)
@@ -5,6 +5,12 @@
use CGI qw();
use Parse::RecDescent;
+=head2 new
+
+Create the markup grammar
+
+=cut
+
sub new {
my ($class) = @_;
my $self = bless {}, $class;
@@ -65,8 +71,14 @@
-# takes a string
-# makes sure every line is max N characters long
+=head2 split_rows
+
+Takes a string and a number N.
+
+Makes sure every line is max N characters long in it
+
+=cut
+
sub split_rows {
my ($text, $N) = @_;
$N ||= 100;
@@ -90,11 +102,24 @@
return join "\n", @new;
}
+=head2 parser
+
+Run the Parse::RecDescent parser
+
+=cut
+
sub parser {
my ($self) = @_;
return Parse::RecDescent->new($self->{grammar});
}
+=head2 posting_process
+
+The external interface, received a TEXT
+and returns the parsed text
+
+=cut
+
sub posting_process {
my ($self, $text) = @_;
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/lib/CPAN/Forum.pm 2006-08-29 12:15:48 UTC (rev 191)
@@ -403,6 +403,14 @@
=cut
+=head2 cgiapp_init
+
+ Connect to database
+ Setup logging
+ Setup session
+
+=cut
+
sub cgiapp_init {
my $self = shift;
@@ -465,7 +473,7 @@
sub _set_log_level {
my ($self) = @_;
- if (open my $fh, $self->param("ROOT") . "/db/log_level") {
+ if (open my $fh, '<', $self->param("ROOT") . "/db/log_level") {
chomp (my $str = <$fh>);
$str =~ s/^\s*|\s*$//g;
if (Log::Dispatch->level_is_valid($str)) {
@@ -477,7 +485,12 @@
return 'notice';
}
+=head2 config
+Given a filed name returns the configuration value from the database
+
+=cut
+
sub config {
my ($self, $field) = @_;
@@ -523,6 +536,12 @@
mypan selfconfig
search all rss);
+=head2 setup
+
+Standard CGI::Application method
+
+=cut
+
sub setup {
my $self = shift;
$self->start_mode("home");
@@ -664,10 +683,25 @@
return $pager->total_entries;
}
+
+=head2 all
+
+An alias of the C<home()> run-mode.
+=cut
+
sub all {
home(@_);
}
+
+=head2 build_listing
+
+Given a reference to an array of Post objects creates and returns
+a reference to an array that can be used with HTML::Template to
+display the given posts.
+
+=cut
+
sub build_listing {
my ($self, $it) = @_;
@@ -717,6 +751,13 @@
$t->output;
}
+=head2 stats
+
+The stats run-mode showing some statistics
+(actually the 50 busiest groups)
+
+=cut
+
sub stats {
my $self = shift;
my $t = $self->load_tmpl("stats.tmpl");
@@ -854,13 +895,14 @@
my $request = $session->param("request") || "home";
$self->log->debug("Request redirection: '$request'");
- no strict 'refs';
my $response;
eval {
if ($request eq 'new_post') {
my $request_group = $session->param("request_group") || '';
$self->param("path_parameters" => [$request_group]);
}
+ ## no critic (ProhibitNoStrict)
+ no strict 'refs';
$response = &$request($self);
};
if ($@) {
@@ -1492,7 +1534,7 @@
my ($self, $dist) = @_;
require Text::CSV_XS;
my $csv = Text::CSV_XS->new();
- open my $fh, "../../db/cpan_ratings.csv" or return;
+ open my $fh, '<', '../../db/cpan_ratings.csv' or return;
while (my $line = <$fh>) {
next if $line !~ /^"$dist"/;
last if not $csv->parse($line);
Added: trunk/t/other/critic.t
===================================================================
--- trunk/t/other/critic.t 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/t/other/critic.t 2006-08-29 12:15:48 UTC (rev 191)
@@ -0,0 +1,12 @@
+use strict;
+use warnings;
+
+use Test::More;
+eval {
+ require Test::Perl::Critic;
+ import Test::Perl::Critic (-severity => 5);
+};
+plan skip_all => 'Test::Perl::Critic required to criticise code' if $@;
+all_critic_ok('lib');
+#all_critic_ok('blib', 't');
+
Modified: trunk/t/other/pod-coverage.t
===================================================================
--- trunk/t/other/pod-coverage.t 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/t/other/pod-coverage.t 2006-08-29 12:15:48 UTC (rev 191)
@@ -1,5 +1,20 @@
-use Test::More tests => 1;
-#eval "use Test::Pod::Coverage 0.08";
-#plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
-#all_pod_coverage_ok();
-ok(1);
+use strict;
+use warnings;
+
+use Test::More;
+eval {
+ require Test::Pod::Coverage;
+ import Test::Pod::Coverage;
+};
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+plan tests => 6;
+pod_coverage_ok('CPAN::Forum::Markup');
+TODO: {
+ local $TODO = "Write more documentation";
+ pod_coverage_ok('CPAN::Forum');
+ pod_coverage_ok('CPAN::Forum::Posts');
+ pod_coverage_ok('CPAN::Forum::Groups');
+ pod_coverage_ok('CPAN::Forum::Users');
+ pod_coverage_ok('CPAN::Forum::Configure');
+}
+
Modified: trunk/t/other/pod.t
===================================================================
--- trunk/t/other/pod.t 2006-08-29 12:15:35 UTC (rev 190)
+++ trunk/t/other/pod.t 2006-08-29 12:15:48 UTC (rev 191)
@@ -1,4 +1,10 @@
+use strict;
+use warnings;
+
use Test::More;
-eval "use Test::Pod 1.00";
+eval {
+ require Test::Pod;
+ import Test::Pod;
+};
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
More information about the Cpan-forum-commit
mailing list