[Catalyst-commits] r6198 - in trunk/Catalyst-Model-TextLinkAds: . lib lib/Catalyst lib/Catalyst/Helper lib/Catalyst/Helper/Model lib/Catalyst/Model t t/lib t/lib/TestApp t/lib/TestApp/Model

davecardwell at dev.catalyst.perl.org davecardwell at dev.catalyst.perl.org
Sun Mar 25 19:52:25 GMT 2007


Author: davecardwell
Date: 2007-03-25 19:52:24 +0100 (Sun, 25 Mar 2007)
New Revision: 6198

Added:
   trunk/Catalyst-Model-TextLinkAds/Build.PL
   trunk/Catalyst-Model-TextLinkAds/Changes
   trunk/Catalyst-Model-TextLinkAds/INSTALL
   trunk/Catalyst-Model-TextLinkAds/MANIFEST
   trunk/Catalyst-Model-TextLinkAds/examples/
   trunk/Catalyst-Model-TextLinkAds/lib/
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/Model/
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/Model/TextLinkAds.pm
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Model/
   trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Model/TextLinkAds.pm
   trunk/Catalyst-Model-TextLinkAds/t/
   trunk/Catalyst-Model-TextLinkAds/t/00.load.t
   trunk/Catalyst-Model-TextLinkAds/t/01.functionality.t
   trunk/Catalyst-Model-TextLinkAds/t/02.perlcritic.t
   trunk/Catalyst-Model-TextLinkAds/t/03.pod.t
   trunk/Catalyst-Model-TextLinkAds/t/04.pod-coverage.t
   trunk/Catalyst-Model-TextLinkAds/t/lib/
   trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp.pm
   trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/
   trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/Model/
   trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/Model/TextLinkAds.pm
Log:
Creating v0.01.


Added: trunk/Catalyst-Model-TextLinkAds/Build.PL
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/Build.PL	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/Build.PL	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+use Module::Build;
+
+my $builder = Module::Build->new(
+    add_to_cleanup     => [ 'Catalyst-Model-TextLinkAds-*',
+                            'Catalyst-Helper-Model-TextLinkAds-*' ],
+    build_requires     => {
+        'Test::More' => 0,
+    },
+    create_makefile_pl => 'passthrough',
+    create_readme      => 1,
+    dist_version_from  => 'lib/Catalyst/Model/TextLinkAds.pm',
+    license            => 'perl',
+    module_name        => 'Catalyst::Model::TextLinkAds',
+    requires           => {
+        'Carp'            => '0',
+        'Catalyst::Model' => '0',
+        'Catalyst::Utils' => '0',
+        'Class::C3'       => '0',
+        'TextLinkAds'     => '0',
+    },
+);
+
+$builder->create_build_script();

Added: trunk/Catalyst-Model-TextLinkAds/Changes
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/Changes	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/Changes	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,4 @@
+Revision history for Catalyst::Model::TextLinkAds
+
+0.01	2007-03-25:
+		Initial release.

Added: trunk/Catalyst-Model-TextLinkAds/INSTALL
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/INSTALL	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/INSTALL	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,13 @@
+To install this module, run the following commands...
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+Alternatively, to install with Module::Build...
+
+	perl Build.PL
+	./Build
+	./Build test
+	./Build install

Added: trunk/Catalyst-Model-TextLinkAds/MANIFEST
===================================================================

Added: trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/Model/TextLinkAds.pm
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/Model/TextLinkAds.pm	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Helper/Model/TextLinkAds.pm	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,170 @@
+package Catalyst::Helper::Model::TextLinkAds;
+
+use strict;
+use warnings;
+
+use Carp qw( croak );
+
+our $VERSION = '0.01';
+
+
+=head1 NAME
+
+Catalyst::Helper::Model::TextLinkAds - Helper for TextLinkAds Catalyst Models
+
+
+=head1 SYNOPSIS
+
+    script/myapp_create.pl model ModelName TextLinkAds [ tmpdir=/path/to/tmp ] [ nocache ]
+
+
+=head1 DESCRIPTION
+
+Use this module to set up a new L<Catalyst::Model::TextLinkAds> model for your
+Catalyst application.
+
+=head2 Arguments
+
+    ModelName is the short name for the Model class being generated (eg.
+    "TextLinkAds")
+    
+    tmpdir is the path to a directory where temporary files should be stored.
+    
+    nocache disables caching and is definitely not recommended.
+
+
+=head1 METHODS
+
+=head2 mk_compclass
+
+This method takes the given arguments and generates a
+L<Catalyst::Model::TextLinkAds> model for your application.
+
+=cut
+
+sub mk_compclass {
+    my ( $self, $helper, @options ) = @_;
+    
+    # Extract the arguments...
+    foreach (@options) {
+        if ( /^tmpdir=(.+)$/ ) {
+            $helper->{tmpdir} = $1;
+        }
+        elsif ( /^nocache$/ ) {
+            $helper->{cache} = 0;
+        }
+    }
+    
+    $helper->{config_encountered} = (
+        exists $helper->{tmpdir}
+    );
+    
+    $helper->render_file( 'tlaclass', $helper->{file} );
+}
+
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Catalyst::Helper>, L<Catalyst::Model::TextLinkAds>
+
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-catalyst-model-textlinkads at rt.cpan.org>, or through the web interface
+at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-TextLinkAds>.
+
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc Catalyst::Helper::Model::TextLinkAds
+
+You may also look for information at:
+
+=over 4
+
+=item * Catalyst::Model::TextLinkAds
+
+L<http://perlprogrammer.co.uk/module/Catalyst::Model::TextLinkAds/>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Catalyst-Model-TextLinkAds/>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-TextLinkAds>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Catalyst-Model-TextLinkAds/>
+
+=back
+
+
+=head1 AUTHOR
+
+Dave Cardwell <dcardwell at cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2007 Dave Cardwell. All rights reserved.
+
+This module is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself. See L<perlartistic>.
+
+=cut
+
+
+1;
+__DATA__
+=begin pod_to_ignore
+
+__tlaclass__
+package [% class %];
+
+use strict;
+use warnings;
+
+use base qw/ Catalyst::Model::TextLinkAds /;
+
+[%- IF config_encountered %]
+__PACKAGE__->config(
+    [% "tmpdir => '" _ tmpdir _ "',\n" IF tmpdir -%]
+    [% "cache  => 0" _          ",\n"  IF cache  -%]
+);
+[%- END %]
+
+
+=head1 NAME
+
+[% class %] - Text Link Ads Model Class
+
+
+=head1 SYNOPSIS
+
+See L<[% app %]>.
+
+
+=head1 DESCRIPTION
+
+Text Link Ads Model Class.
+
+
+=head1 AUTHOR
+
+[% author %]
+
+
+=head1 LICENSE
+
+This module is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself. See L<perlartistic>.
+
+=cut
+
+
+1;

Added: trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Model/TextLinkAds.pm
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Model/TextLinkAds.pm	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/lib/Catalyst/Model/TextLinkAds.pm	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,184 @@
+package Catalyst::Model::TextLinkAds;
+
+use strict;
+use warnings;
+
+use base qw/ Catalyst::Model /;
+
+use Carp qw( croak );
+use Catalyst::Utils ();
+use Class::C3 ();
+use TextLinkAds ();
+
+our $VERSION = '1.01';
+
+
+=head1 NAME
+
+Catalyst::Model::TextLinkAds - Catalyst model for Text Link Ads
+
+
+=head1 SYNOPSIS
+
+    # Use the helper to add a TextLinkAds model to your application...
+    script/myapp_create.pl create model TextLinkAds TextLinkAds
+    
+    
+    # lib/MyApp/Model/TextLinkAds.pm
+    
+    package MyApp::Model::TextLinkAds;
+    
+    use base qw/ Catalyst::Model::TextLinkAds /;
+    
+    __PACKAGE__->config(
+        cache  => 0,      # optional: see CACHING for default behaviour
+        tmpdir => '/tmp', # optional: default File::Spec->tmpdir
+    );
+    
+    
+    1;
+
+
+=head1 DESCRIPTION
+
+This is a L<Catalyst> model class that fetches advertiser information for a
+given Text Link Ads publisher account.
+
+See L<http://www.text-link-ads.com/publisher_program.php?ref=23206>.
+
+
+=head1 METHODS
+
+=head2 ->new()
+
+Instantiate a new L<TextLinkAds> model. See
+L<TextLinkAds's new method|TextLinkAds/new> for the options available.
+
+=cut
+
+
+sub new {
+    my $self  = shift->next::method(@_);
+    my $class = ref($self);
+    
+    my ( $c, $args ) = @_;
+    
+    # Instantiate a new C<TextLinkAds> object...
+    $self->{'.tla'} = TextLinkAds->new(
+        Catalyst::Utils::merge_hashes( $args, $self->config )
+    );
+    
+    return $self;
+}
+
+
+=head2 ACCEPT_CONTEXT
+
+Return the C<TextLinkAds> object. Called automatically via
+C<$c-E<gt>model('TextLinkAds');>
+
+=cut
+
+
+sub ACCEPT_CONTEXT {
+    return shift->{'.tla'};
+}
+
+
+1;  # End of the module code; everything from here is documentation...
+__END__
+
+=head1 CACHING
+
+If a cache for C<Catalyst::Model::TextLinkAds> is not explicitly set in the
+Catalyst configuration, this module will attempt to use
+C<$c-E<gt>cache('textlinkads')>, and failing that will fall back to using
+L<Cache::FileCache>.
+
+See L<"Cache Profiles" in Catalyst::Plugin::Cache|
+Catalyst::Plugin::Cache/Cache_Profiles> and L<"cache" in TextLinkAds|
+TextLinkAds/cache> for more information.
+
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Catalyst::Helper::Model::TextLinkAds>, L<TextLinkAds>
+
+
+=head1 DEPENDENCIES
+
+=over
+
+=item
+
+L<Carp>
+
+=item
+
+L<Catalyst::Model>
+
+=item
+
+L<Catalyst::Utils>
+
+=item
+
+L<Class::C3>
+
+=item
+
+L<TextLinkAds>
+
+=back
+
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-catalyst-model-textlinkads at rt.cpan.org>, or through the web interface
+at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-TextLinkAds>.
+
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc Catalyst::Model::TextLinkAds
+
+You may also look for information at:
+
+=over 4
+
+=item * Catalyst::Model::TextLinkAds
+
+L<http://perlprogrammer.co.uk/modules/Catalyst::Model::TextLinkAds/>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Catalyst-Model-TextLinkAds/>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-TextLinkAds>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Catalyst-Model-TextLinkAds/>
+
+=back
+
+
+=head1 AUTHOR
+
+Dave Cardwell <dcardwell at cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2007 Dave Cardwell. All rights reserved.
+
+This module is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself. See L<perlartistic>.
+
+
+=cut

Added: trunk/Catalyst-Model-TextLinkAds/t/00.load.t
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/00.load.t	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/00.load.t	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,10 @@
+#!perl -wT
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use_ok( 'Catalyst::Model::TextLinkAds' );
+
+diag( "Testing TextLinkAds $TextLinkAds::VERSION" );

Added: trunk/Catalyst-Model-TextLinkAds/t/01.functionality.t
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/01.functionality.t	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/01.functionality.t	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -wT
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+use lib qw( t/lib );
+
+
+# Make sure the Catalyst app loads ok...
+use_ok('TestApp');
+
+
+# Check that the TextLinkAds model returns a valid TextLinkAds object...
+my $tla = TestApp->model('TextLinkAds');
+isa_ok( $tla, 'TextLinkAds' );
+can_ok( $tla, 'fetch' );
+
+
+# If you've already tested and installed TextLinkAds, there is no reason to
+# run tests against text-link-ads.com again.
+
+
+1;

Added: trunk/Catalyst-Model-TextLinkAds/t/02.perlcritic.t
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/02.perlcritic.t	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/02.perlcritic.t	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,15 @@
+#!perl -wT
+
+use strict;
+use warnings;
+
+use Test::More;
+
+
+eval 'use Test::Perl::Critic';
+if ( $@ ) {
+    plan skip_all => 'Test::Perl::Critic required to test for best-practices';
+}
+else {
+    Test::Perl::Critic::all_critic_ok();
+}

Added: trunk/Catalyst-Model-TextLinkAds/t/03.pod.t
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/03.pod.t	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/03.pod.t	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,15 @@
+#!perl -wT
+
+use strict;
+use warnings;
+
+use Test::More;
+
+
+eval 'use Test::Pod 1.14';
+if ( $@ ) {
+    plan skip_all => 'Test::Pod 1.14 required for testing POD';
+}
+else {
+    Test::Pod::all_pod_files_ok();
+}

Added: trunk/Catalyst-Model-TextLinkAds/t/04.pod-coverage.t
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/04.pod-coverage.t	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/04.pod-coverage.t	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,15 @@
+#!perl -wT
+
+use strict;
+use warnings;
+
+use Test::More;
+
+
+eval 'use Test::Pod::Coverage 1.04';
+if ( $@ ) {
+    plan skip_all => 'Test::Pod::Coverage 1.04 required for testing POD coverage';
+}
+else {
+    Test::Pod::Coverage::all_pod_coverage_ok();
+}

Added: trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/Model/TextLinkAds.pm
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/Model/TextLinkAds.pm	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp/Model/TextLinkAds.pm	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,6 @@
+package TestApp::Model::TextLinkAds;
+
+use base qw/ Catalyst::Model::TextLinkAds /;
+
+
+1;

Added: trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp.pm	                        (rev 0)
+++ trunk/Catalyst-Model-TextLinkAds/t/lib/TestApp.pm	2007-03-25 18:52:24 UTC (rev 6198)
@@ -0,0 +1,19 @@
+package TestApp;
+
+use strict;
+use warnings;
+
+use Catalyst;
+
+__PACKAGE__->config(
+    name                 => 'TestApp',
+    'Model::TextLinkAds' => {
+        cache  => 0, # disable caching
+        tmpdir => 'foobar',
+    }
+);
+
+__PACKAGE__->setup;
+
+
+1;




More information about the Catalyst-commits mailing list