[Rt-commit] r5443 - in Test-Chimps: trunk trunk/lib/Test/Chimps
zev at bestpractical.com
zev at bestpractical.com
Fri Jun 23 17:35:15 EDT 2006
Author: zev
Date: Fri Jun 23 17:35:13 2006
New Revision: 5443
Modified:
Test-Chimps/ (props changed)
Test-Chimps/trunk/Makefile.PL
Test-Chimps/trunk/lib/Test/Chimps/Client.pm
Test-Chimps/trunk/lib/Test/Chimps/Report.pm
Test-Chimps/trunk/lib/Test/Chimps/Server.pm
Log:
r9687 at galvatron (orig r24): zev | 2006-06-23 17:31:59 -0400
r4257 at galvatron: zev | 2006-06-22 16:17:49 -0400
switch to Class::Accessor
Modified: Test-Chimps/trunk/Makefile.PL
==============================================================================
--- Test-Chimps/trunk/Makefile.PL (original)
+++ Test-Chimps/trunk/Makefile.PL Fri Jun 23 17:35:13 2006
@@ -6,6 +6,7 @@
# Specific dependencies
requires('Algorithm::TokenBucket');
+requires('Class::Accessor');
requires('Date::Parse');
requires('DateTime');
requires('HTML::Mason');
Modified: Test-Chimps/trunk/lib/Test/Chimps/Client.pm
==============================================================================
--- Test-Chimps/trunk/lib/Test/Chimps/Client.pm (original)
+++ Test-Chimps/trunk/lib/Test/Chimps/Client.pm Fri Jun 23 17:35:13 2006
@@ -75,6 +75,10 @@
=cut
+use base qw/Class::Accessor/;
+
+Test::Chimps::Client->mk_ro_accessors(qw/reports server compress/);
+
sub new {
my $class = shift;
my $obj = bless {}, $class;
@@ -102,39 +106,6 @@
$self->{compress} = $args{compress} || 0;
}
-=head2 reports
-
-Accessor for the reports to be submitted.
-
-=cut
-
-sub reports {
- my $self = shift;
- return $self->{reports};
-}
-
-=head2 server
-
-Accessor for the submission server.
-
-=cut
-
-sub server {
- my $self = shift;
- return $self->{server};
-}
-
-=head2 compress
-
-Accessor for whether compression is turned on.
-
-=cut
-
-sub compress {
- my $self = shift;
- return $self->{compress};
-}
-
=head2 send
Submit the specified reports to the server. This function's return
@@ -166,6 +137,10 @@
}
}
+=head1 ACCESSORS
+
+There are read-only accessors for compress, reports, and server.
+
=head1 AUTHOR
Zev Benjamin, C<< <zev at cpan.org> >>
Modified: Test-Chimps/trunk/lib/Test/Chimps/Report.pm
==============================================================================
--- Test-Chimps/trunk/lib/Test/Chimps/Report.pm (original)
+++ Test-Chimps/trunk/lib/Test/Chimps/Report.pm Fri Jun 23 17:35:13 2006
@@ -46,6 +46,7 @@
=over 4
=item * model
+
Mandatory and must be an instance of C<Test::Tap::Model>.
=item * report_text
@@ -65,6 +66,14 @@
=cut
+use base qw/Class::Accessor/;
+
+Test::Chimps::Report->mk_ro_accessors(
+ qw/model_structure
+ report_text report_variables/
+);
+
+
sub new {
my $class = shift;
my $obj = bless {}, $class;
@@ -105,38 +114,10 @@
}
}
-=head2 model_structure
-
-Accessor for the passed-in model's structure.
-
-=cut
-
-sub model_structure {
- my $self = shift;
- return $self->{model_structure};
-}
-
-=head2 report_text
-
-Accessor for the report text.
+=head1 ACCESSORS
-=cut
-
-sub report_text {
- my $self = shift;
- return $self->{report_text};
-}
-
-=head2 report_variables
-
-Accessor for any extra data passed in.
-
-=cut
-
-sub report_variables {
- my $self = shift;
- return $self->{report_variables};
-}
+There are read-only accessors for model_structure, report_text, and
+report_variables.
=head1 AUTHOR
Modified: Test-Chimps/trunk/lib/Test/Chimps/Server.pm
==============================================================================
--- Test-Chimps/trunk/lib/Test/Chimps/Server.pm (original)
+++ Test-Chimps/trunk/lib/Test/Chimps/Server.pm Fri Jun 23 17:35:13 2006
@@ -103,20 +103,13 @@
=cut
-{
- no strict 'refs';
- our @fields = qw/base_dir bucket_file max_rate max_size
- max_smokes_per_subcategory report_dir
- template_dir list_template variables_validation_spec/;
-
- foreach my $field (@fields) {
- *{$field} =
- sub {
- my $self = shift;
- return $self->{$field};
- };
- }
-}
+use base qw/Class::Accessor/;
+
+Test::Chimps::Server->mk_ro_accessors(
+ qw/base_dir bucket_file max_rate max_size
+ max_smokes_per_subcategory report_dir
+ template_dir list_template variables_validation_spec/
+);
sub new {
my $class = shift;
More information about the Rt-commit
mailing list