From feefb416b3c1aafdea07aa47378d007ee760e9f9 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Thu, 8 Jan 2004 17:22:15 +0000 Subject: [PATCH] Some fixes and the bare beginnings of a test suite. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@4 48953598-375a-da11-a14b-00016c27c3ee --- Makefile.PL | 4 ++-- lib/Apache/MVC.pm | 11 ++++++++--- t/1.t | 30 ++++++++++++++++++------------ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 668a722..6211f16 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,9 +4,9 @@ use ExtUtils::MakeMaker; # the contents of the Makefile that is written. WriteMakefile( NAME => 'Apache::MVC', - VERSION_FROM => 'MVC.pm', # finds $VERSION + VERSION_FROM => 'lib/Apache/MVC.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'MVC.pm', # retrieve abstract from module + (ABSTRACT_FROM => 'lib/Apache/MVC.pm', # retrieve abstract from module AUTHOR => 'Simon Cozens ') : ()), ); diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index a68f0ac..f567bad 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -4,8 +4,9 @@ use attributes (); use Class::DBI::Loader; use strict; use warnings; +our $VERSION = "1.0"; -__PACKAGE__->mk_classdata(qw( _config init_done view_object )); +__PACKAGE__->mk_classdata($_) for qw( _config init_done view_object ); __PACKAGE__->mk_accessors ( qw( config ar params objects model_class args )); __PACKAGE__->config({}); __PACKAGE__->init_done(0); @@ -92,11 +93,15 @@ sub is_applicable { return DECLINED() unless $cv; # Is it exported? - my $attribs = join " ", attributes::get($cv); - return DECLINED() unless $attribs =~ /\b(Exported|Class|Single|Multiple)\b/i; + $self->{method_attribs} = join " ", attributes::get($cv); + return DECLINED() + unless $self->{method_attribs} =~ /\b(Exported|Class|Single|Multiple)\b/i; return OK(); } +sub find_objects { + # First, how many arguments are we? +} sub authenticate { return 200 } diff --git a/t/1.t b/t/1.t index bb56b7a..ff8ae73 100644 --- a/t/1.t +++ b/t/1.t @@ -1,17 +1,23 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' +# vim:ft=perl +use Test::More 'no_plan'; -######################### +package Fake::Loader; -# change 'tests => 1' to 'tests => last_test_to_print'; +package Fake::MVC; +use base 'Apache::MVC'; -use Test; -BEGIN { plan tests => 1 }; -use Apache::MVC; -ok(1); # If we made it this far, we're ok. +sub set_database { + my $self = shift; + $self->config->{loader} = bless {}, Fake::Loader; +} -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. +sub get_request {} +sub parse_location { + my $self = shift; + my @pi = @Fake::MVC::url; + shift @pi while @pi and !$pi[0]; + $self->{table} = shift @pi; + $self->{action} = shift @pi; + $self->{args} = \@pi; +} -- 2.39.2