Add new module
t0m [Thu, 11 Dec 2008 16:14:45 +0000 (16:14 +0000)]
20 files changed:
.shipit [new file with mode: 0644]
Changes [new file with mode: 0644]
MANIFEST.SKIP [new file with mode: 0644]
Makefile [new file with mode: 0644]
Makefile.PL [new file with mode: 0644]
README [new file with mode: 0644]
lib/Catalyst/View/TT/XHTML.pm [new file with mode: 0644]
t/00-load.t [new file with mode: 0644]
t/lib/Makefile.PL [new file with mode: 0644]
t/lib/TestApp.pm [new file with mode: 0644]
t/lib/TestApp/Controller/Root.pm [new file with mode: 0644]
t/lib/TestApp/View/XHTML.pm [new file with mode: 0644]
t/lib/TestApp/root/main [new file with mode: 0644]
t/lib/TestApp/root/nothtml [new file with mode: 0644]
t/lib/script/testapp_server.pl [new file with mode: 0644]
t/lib/script/testapp_test.pl [new file with mode: 0644]
t/live-test.t [new file with mode: 0644]
t/pod-coverage.t [new file with mode: 0644]
t/pod.t [new file with mode: 0644]
t/podspelling.t [new file with mode: 0644]

diff --git a/.shipit b/.shipit
new file mode 100644 (file)
index 0000000..ceec94a
--- /dev/null
+++ b/.shipit
@@ -0,0 +1,9 @@
+# auto-generated shipit config file.
+steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist
+
+svk.tagpattern =  //mirror/Catalyst-View-TT-XHTML/tags/%v
+
+# svn.tagpattern = MyProj-%v
+# svn.tagpattern = http://code.example.com/svn/tags/MyProj-%v
+
+CheckChangeLog.files = Changes
diff --git a/Changes b/Changes
new file mode 100644 (file)
index 0000000..6690e74
--- /dev/null
+++ b/Changes
@@ -0,0 +1,4 @@
+0.001000
+  - First working version of the module extracted from the quick hack
+    I have in every Catalyst application I've ever written.
+    
\ No newline at end of file
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644 (file)
index 0000000..8fb2024
--- /dev/null
@@ -0,0 +1,8 @@
+.git/
+blib
+pm_to_blib
+MANIFEST.bak
+MANIFEST.SKIP~
+cover_db
+Makefile$
+Makefile.old$
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..1ec3cdf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,818 @@
+# This Makefile is for the Catalyst::View::TT::XHTML extension to perl.
+#
+# It was generated automatically by MakeMaker version
+# 6.42 (Revision: 41145) from the contents of
+# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
+#
+#       ANY CHANGES MADE HERE WILL BE LOST!
+#
+#   MakeMaker ARGV: ()
+#
+#   MakeMaker Parameters:
+
+#     ABSTRACT => q[A sub-class of the standard TT view which]
+#     AUTHOR => q[Tomas Doran C<< <bobtfish@bobtfish.net> >>]
+#     DIR => []
+#     DISTNAME => q[Catalyst-View-TT-XHTML]
+#     NAME => q[Catalyst::View::TT::XHTML]
+#     NO_META => q[1]
+#     PL_FILES => {  }
+#     PREREQ_PM => { Catalyst::View::TT=>q[0], ok=>q[0], Test::More=>q[0], ExtUtils::MakeMaker=>q[6.42], Catalyst::Runtime=>q[0], Test::WWW::Mechanize::Catalyst=>q[0], Catalyst::Action::RenderView=>q[0] }
+#     VERSION => q[0.001000]
+#     clean => { FILES=>q[META.yml] }
+#     dist => { PREOP=>q[$(PERL) -I. "-MModule::Install::Admin" -e "dist_preop(q($(DISTVNAME)))"] }
+
+# --- MakeMaker post_initialize section:
+
+
+# --- MakeMaker const_config section:
+
+# These definitions are from config.sh (via /System/Library/Perl/5.8.6/darwin-thread-multi-2level/Config.pm)
+
+# They may have been overridden via Makefile.PL or on the command line
+AR = ar
+CC = cc
+CCCDLFLAGS =  
+CCDLFLAGS =  
+DLEXT = bundle
+DLSRC = dl_dlopen.xs
+EXE_EXT = 
+FULL_AR = /usr/bin/ar
+LD = env MACOSX_DEPLOYMENT_TARGET=10.3 cc
+LDDLFLAGS = -bundle -undefined dynamic_lookup -L/usr/local/lib
+LDFLAGS = -L/usr/local/lib
+LIBC = /usr/lib/libc.dylib
+LIB_EXT = .a
+OBJ_EXT = .o
+OSNAME = darwin
+OSVERS = 8.0
+RANLIB = /usr/bin/ar ts
+SITELIBEXP = /Library/Perl/5.8.6
+SITEARCHEXP = /Library/Perl/5.8.6/darwin-thread-multi-2level
+SO = dylib
+VENDORARCHEXP = /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
+VENDORLIBEXP = /Network/Library/Perl/5.8.6
+
+
+# --- MakeMaker constants section:
+AR_STATIC_ARGS = cr
+DIRFILESEP = /
+DFSEP = $(DIRFILESEP)
+NAME = Catalyst::View::TT::XHTML
+NAME_SYM = Catalyst_View_TT_XHTML
+VERSION = 0.001000
+VERSION_MACRO = VERSION
+VERSION_SYM = 0_001000
+DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
+XS_VERSION = 0.001000
+XS_VERSION_MACRO = XS_VERSION
+XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
+INST_ARCHLIB = blib/arch
+INST_SCRIPT = blib/script
+INST_BIN = blib/bin
+INST_LIB = blib/lib
+INST_MAN1DIR = blib/man1
+INST_MAN3DIR = blib/man3
+MAN1EXT = 1
+MAN3EXT = 3pm
+INSTALLDIRS = site
+DESTDIR = 
+PREFIX = $(SITEPREFIX)
+PERLPREFIX = /
+SITEPREFIX = /usr/local
+VENDORPREFIX = /usr/local
+INSTALLPRIVLIB = /System/Library/Perl/5.8.6
+DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
+INSTALLSITELIB = /Library/Perl/5.8.6
+DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
+INSTALLVENDORLIB = /Network/Library/Perl/5.8.6
+DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
+INSTALLARCHLIB = /System/Library/Perl/5.8.6/darwin-thread-multi-2level
+DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
+INSTALLSITEARCH = /Library/Perl/5.8.6/darwin-thread-multi-2level
+DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
+INSTALLVENDORARCH = /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
+DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
+INSTALLBIN = /usr/bin
+DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
+INSTALLSITEBIN = /usr/local/bin
+DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
+INSTALLVENDORBIN = /usr/local/bin
+DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
+INSTALLSCRIPT = /usr/bin
+DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
+INSTALLSITESCRIPT = /usr/local/bin
+DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT)
+INSTALLVENDORSCRIPT = /usr/local/bin
+DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT)
+INSTALLMAN1DIR = /usr/share/man/man1
+DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
+INSTALLSITEMAN1DIR = /usr/local/man/man1
+DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
+INSTALLVENDORMAN1DIR = /usr/local/man/man1
+DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
+INSTALLMAN3DIR = /usr/share/man/man3
+DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
+INSTALLSITEMAN3DIR = /usr/local/man/man3
+DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
+INSTALLVENDORMAN3DIR = /usr/local/man/man3
+DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
+PERL_LIB =
+PERL_ARCHLIB = /System/Library/Perl/5.8.6/darwin-thread-multi-2level
+LIBPERL_A = libperl.a
+FIRST_MAKEFILE = Makefile
+MAKEFILE_OLD = Makefile.old
+MAKE_APERL_FILE = Makefile.aperl
+PERLMAINCC = $(CC)
+PERL_INC = /System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE
+PERL = /usr/bin/perl "-Iinc"
+FULLPERL = /usr/bin/perl "-Iinc"
+ABSPERL = $(PERL)
+PERLRUN = $(PERL)
+FULLPERLRUN = $(FULLPERL)
+ABSPERLRUN = $(ABSPERL)
+PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
+FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
+ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
+PERL_CORE = 0
+PERM_RW = 644
+PERM_RWX = 755
+
+MAKEMAKER   = /System/Library/Perl/5.8.6/ExtUtils/MakeMaker.pm
+MM_VERSION  = 6.42
+MM_REVISION = 41145
+
+# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
+# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
+# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
+# DLBASE  = Basename part of dynamic library. May be just equal BASEEXT.
+MAKE = make
+FULLEXT = Catalyst/View/TT/XHTML
+BASEEXT = XHTML
+PARENT_NAME = Catalyst::View::TT
+DLBASE = $(BASEEXT)
+VERSION_FROM = 
+OBJECT = 
+LDFROM = $(OBJECT)
+LINKTYPE = dynamic
+BOOTDEP = 
+
+# Handy lists of source code files:
+XS_FILES = 
+C_FILES  = 
+O_FILES  = 
+H_FILES  = 
+MAN1PODS = 
+MAN3PODS = lib/Catalyst/View/TT/XHTML.pm
+
+# Where is the Config information that we are using/depend on
+CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
+
+# Where to build things
+INST_LIBDIR      = $(INST_LIB)/Catalyst/View/TT
+INST_ARCHLIBDIR  = $(INST_ARCHLIB)/Catalyst/View/TT
+
+INST_AUTODIR     = $(INST_LIB)/auto/$(FULLEXT)
+INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
+
+INST_STATIC      = 
+INST_DYNAMIC     = 
+INST_BOOT        = 
+
+# Extra linker info
+EXPORT_LIST        = 
+PERL_ARCHIVE       = 
+PERL_ARCHIVE_AFTER = 
+
+
+TO_INST_PM = lib/Catalyst/View/TT/XHTML.pm
+
+PM_TO_BLIB = lib/Catalyst/View/TT/XHTML.pm \
+       blib/lib/Catalyst/View/TT/XHTML.pm
+
+
+# --- MakeMaker platform_constants section:
+MM_Unix_VERSION = 6.42
+PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
+
+
+# --- MakeMaker tool_autosplit section:
+# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
+AUTOSPLITFILE = $(ABSPERLRUN)  -e 'use AutoSplit;  autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)' --
+
+
+
+# --- MakeMaker tool_xsubpp section:
+
+
+# --- MakeMaker tools_other section:
+SHELL = /bin/sh
+CHMOD = chmod
+CP = cp
+MV = mv
+NOOP = $(SHELL) -c true
+NOECHO = @
+RM_F = rm -f
+RM_RF = rm -rf
+TEST_F = test -f
+TOUCH = touch
+UMASK_NULL = umask 0
+DEV_NULL = > /dev/null 2>&1
+MKPATH = $(ABSPERLRUN) "-MExtUtils::Command" -e mkpath
+EQUALIZE_TIMESTAMP = $(ABSPERLRUN) "-MExtUtils::Command" -e eqtime
+ECHO = echo
+ECHO_N = echo -n
+UNINST = 0
+VERBINST = 0
+MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');' --
+DOC_INSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install
+UNINSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall
+WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist
+MACROSTART = 
+MACROEND = 
+USEMAKEFILE = -f
+FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"
+
+
+# --- MakeMaker makemakerdflt section:
+makemakerdflt : all
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dist section:
+TAR = tar
+TARFLAGS = cvf
+ZIP = zip
+ZIPFLAGS = -r
+COMPRESS = gzip --best
+SUFFIX = .gz
+SHAR = shar
+PREOP = $(PERL) -I. "-MModule::Install::Admin" -e "dist_preop(q($(DISTVNAME)))"
+POSTOP = $(NOECHO) $(NOOP)
+TO_UNIX = $(NOECHO) $(NOOP)
+CI = ci -u
+RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
+DIST_CP = best
+DIST_DEFAULT = tardist
+DISTNAME = Catalyst-View-TT-XHTML
+DISTVNAME = Catalyst-View-TT-XHTML-0.001000
+
+
+# --- MakeMaker macro section:
+
+
+# --- MakeMaker depend section:
+
+
+# --- MakeMaker cflags section:
+
+
+# --- MakeMaker const_loadlibs section:
+
+
+# --- MakeMaker const_cccmd section:
+
+
+# --- MakeMaker post_constants section:
+
+
+# --- MakeMaker pasthru section:
+
+PASTHRU = LIBPERL_A="$(LIBPERL_A)"\
+       LINKTYPE="$(LINKTYPE)"\
+       PREFIX="$(PREFIX)"
+
+
+# --- MakeMaker special_targets section:
+.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
+
+.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
+
+
+
+# --- MakeMaker c_o section:
+
+
+# --- MakeMaker xs_c section:
+
+
+# --- MakeMaker xs_o section:
+
+
+# --- MakeMaker top_targets section:
+all :: pure_all manifypods
+       $(NOECHO) $(NOOP)
+
+
+pure_all :: config pm_to_blib subdirs linkext
+       $(NOECHO) $(NOOP)
+
+subdirs :: $(MYEXTLIB)
+       $(NOECHO) $(NOOP)
+
+config :: $(FIRST_MAKEFILE) blibdirs
+       $(NOECHO) $(NOOP)
+
+help :
+       perldoc ExtUtils::MakeMaker
+
+
+# --- MakeMaker blibdirs section:
+blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists
+       $(NOECHO) $(NOOP)
+
+# Backwards compat with 6.18 through 6.25
+blibdirs.ts : blibdirs
+       $(NOECHO) $(NOOP)
+
+$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_LIBDIR)
+       $(NOECHO) $(CHMOD) 755 $(INST_LIBDIR)
+       $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists
+
+$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_ARCHLIB)
+       $(NOECHO) $(CHMOD) 755 $(INST_ARCHLIB)
+       $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists
+
+$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_AUTODIR)
+       $(NOECHO) $(CHMOD) 755 $(INST_AUTODIR)
+       $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists
+
+$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
+       $(NOECHO) $(CHMOD) 755 $(INST_ARCHAUTODIR)
+       $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists
+
+$(INST_BIN)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_BIN)
+       $(NOECHO) $(CHMOD) 755 $(INST_BIN)
+       $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists
+
+$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_SCRIPT)
+       $(NOECHO) $(CHMOD) 755 $(INST_SCRIPT)
+       $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists
+
+$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_MAN1DIR)
+       $(NOECHO) $(CHMOD) 755 $(INST_MAN1DIR)
+       $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists
+
+$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL
+       $(NOECHO) $(MKPATH) $(INST_MAN3DIR)
+       $(NOECHO) $(CHMOD) 755 $(INST_MAN3DIR)
+       $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists
+
+
+
+# --- MakeMaker linkext section:
+
+linkext :: $(LINKTYPE)
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dlsyms section:
+
+
+# --- MakeMaker dynamic section:
+
+dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dynamic_bs section:
+
+BOOTSTRAP =
+
+
+# --- MakeMaker dynamic_lib section:
+
+
+# --- MakeMaker static section:
+
+## $(INST_PM) has been moved to the all: target.
+## It remains here for awhile to allow for old usage: "make static"
+static :: $(FIRST_MAKEFILE) $(INST_STATIC)
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker static_lib section:
+
+
+# --- MakeMaker manifypods section:
+
+POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
+POD2MAN = $(POD2MAN_EXE)
+
+
+manifypods : pure_all  \
+       lib/Catalyst/View/TT/XHTML.pm
+       $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \
+         lib/Catalyst/View/TT/XHTML.pm $(INST_MAN3DIR)/Catalyst::View::TT::XHTML.$(MAN3EXT) 
+
+
+
+
+# --- MakeMaker processPL section:
+
+
+# --- MakeMaker installbin section:
+
+
+# --- MakeMaker subdirs section:
+
+# none
+
+# --- MakeMaker clean_subdirs section:
+clean_subdirs :
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker clean section:
+
+# Delete temporary files but do not touch installed files. We don't delete
+# the Makefile here so a later make realclean still has a makefile to use.
+
+clean :: clean_subdirs
+       - $(RM_F) \
+         *$(LIB_EXT) core \
+         core.[0-9] $(INST_ARCHAUTODIR)/extralibs.all \
+         core.[0-9][0-9] $(BASEEXT).bso \
+         pm_to_blib.ts core.[0-9][0-9][0-9][0-9] \
+         $(BASEEXT).x $(BOOTSTRAP) \
+         perl$(EXE_EXT) tmon.out \
+         *$(OBJ_EXT) pm_to_blib \
+         $(INST_ARCHAUTODIR)/extralibs.ld blibdirs.ts \
+         core.[0-9][0-9][0-9][0-9][0-9] *perl.core \
+         core.*perl.*.? $(MAKE_APERL_FILE) \
+         perl $(BASEEXT).def \
+         core.[0-9][0-9][0-9] mon.out \
+         lib$(BASEEXT).def perlmain.c \
+         perl.exe so_locations \
+         $(BASEEXT).exp 
+       - $(RM_RF) \
+         META.yml blib 
+       - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
+
+
+# --- MakeMaker realclean_subdirs section:
+realclean_subdirs :
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker realclean section:
+# Delete temporary files (via clean) and also delete dist files
+realclean purge ::  clean realclean_subdirs
+       - $(RM_F) \
+         $(MAKEFILE_OLD) $(FIRST_MAKEFILE) 
+       - $(RM_RF) \
+         $(DISTVNAME) 
+
+
+# --- MakeMaker metafile section:
+metafile :
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker signature section:
+signature :
+       cpansign -s
+
+
+# --- MakeMaker dist_basics section:
+distclean :: realclean distcheck
+       $(NOECHO) $(NOOP)
+
+distcheck :
+       $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
+
+skipcheck :
+       $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
+
+manifest :
+       $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
+
+veryclean : realclean
+       $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old 
+
+
+
+# --- MakeMaker dist_core section:
+
+dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
+       $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
+         -e '    if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' --
+
+tardist : $(DISTVNAME).tar$(SUFFIX)
+       $(NOECHO) $(NOOP)
+
+uutardist : $(DISTVNAME).tar$(SUFFIX)
+       uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
+
+$(DISTVNAME).tar$(SUFFIX) : distdir
+       $(PREOP)
+       $(TO_UNIX)
+       $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
+       $(RM_RF) $(DISTVNAME)
+       $(COMPRESS) $(DISTVNAME).tar
+       $(POSTOP)
+
+zipdist : $(DISTVNAME).zip
+       $(NOECHO) $(NOOP)
+
+$(DISTVNAME).zip : distdir
+       $(PREOP)
+       $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
+       $(RM_RF) $(DISTVNAME)
+       $(POSTOP)
+
+shdist : distdir
+       $(PREOP)
+       $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
+       $(RM_RF) $(DISTVNAME)
+       $(POSTOP)
+
+
+# --- MakeMaker distdir section:
+create_distdir :
+       $(RM_RF) $(DISTVNAME)
+       $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
+               -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
+
+distdir : create_distdir  
+       $(NOECHO) $(NOOP)
+
+
+
+# --- MakeMaker dist_test section:
+disttest : distdir
+       cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL 
+       cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
+       cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
+
+
+
+# --- MakeMaker dist_ci section:
+
+ci :
+       $(PERLRUN) "-MExtUtils::Manifest=maniread" \
+         -e "@all = keys %{ maniread() };" \
+         -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
+         -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
+
+
+# --- MakeMaker distmeta section:
+distmeta : create_distdir metafile
+       $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \
+         -e '    or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"' --
+
+
+
+# --- MakeMaker distsignature section:
+distsignature : create_distdir
+       $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \
+         -e '    or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"' --
+       $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE
+       cd $(DISTVNAME) && cpansign -s
+
+
+
+# --- MakeMaker install section:
+
+install :: all pure_install doc_install
+       $(NOECHO) $(NOOP)
+
+install_perl :: all pure_perl_install doc_perl_install
+       $(NOECHO) $(NOOP)
+
+install_site :: all pure_site_install doc_site_install
+       $(NOECHO) $(NOOP)
+
+install_vendor :: all pure_vendor_install doc_vendor_install
+       $(NOECHO) $(NOOP)
+
+pure_install :: pure_$(INSTALLDIRS)_install
+       $(NOECHO) $(NOOP)
+
+doc_install :: doc_$(INSTALLDIRS)_install
+       $(NOECHO) $(NOOP)
+
+pure__install : pure_site_install
+       $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+doc__install : doc_site_install
+       $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+pure_perl_install ::
+       $(NOECHO) $(MOD_INSTALL) \
+               read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
+               write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \
+               $(INST_LIB) $(DESTINSTALLPRIVLIB) \
+               $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
+               $(INST_BIN) $(DESTINSTALLBIN) \
+               $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+               $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
+               $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
+       $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+               $(SITEARCHEXP)/auto/$(FULLEXT)
+
+
+pure_site_install ::
+       $(NOECHO) $(MOD_INSTALL) \
+               read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
+               write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
+               $(INST_LIB) $(DESTINSTALLSITELIB) \
+               $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
+               $(INST_BIN) $(DESTINSTALLSITEBIN) \
+               $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \
+               $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
+               $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
+       $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+               $(PERL_ARCHLIB)/auto/$(FULLEXT)
+
+pure_vendor_install ::
+       $(NOECHO) $(MOD_INSTALL) \
+               read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \
+               write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \
+               $(INST_LIB) $(DESTINSTALLVENDORLIB) \
+               $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
+               $(INST_BIN) $(DESTINSTALLVENDORBIN) \
+               $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \
+               $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
+               $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
+
+doc_perl_install ::
+       $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+       -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+       -$(NOECHO) $(DOC_INSTALL) \
+               "Module" "$(NAME)" \
+               "installed into" "$(INSTALLPRIVLIB)" \
+               LINKTYPE "$(LINKTYPE)" \
+               VERSION "$(VERSION)" \
+               EXE_FILES "$(EXE_FILES)" \
+               >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_site_install ::
+       $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+       -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+       -$(NOECHO) $(DOC_INSTALL) \
+               "Module" "$(NAME)" \
+               "installed into" "$(INSTALLSITELIB)" \
+               LINKTYPE "$(LINKTYPE)" \
+               VERSION "$(VERSION)" \
+               EXE_FILES "$(EXE_FILES)" \
+               >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_vendor_install ::
+       $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+       -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+       -$(NOECHO) $(DOC_INSTALL) \
+               "Module" "$(NAME)" \
+               "installed into" "$(INSTALLVENDORLIB)" \
+               LINKTYPE "$(LINKTYPE)" \
+               VERSION "$(VERSION)" \
+               EXE_FILES "$(EXE_FILES)" \
+               >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+
+uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+       $(NOECHO) $(NOOP)
+
+uninstall_from_perldirs ::
+       $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_sitedirs ::
+       $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_vendordirs ::
+       $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist
+
+
+# --- MakeMaker force section:
+# Phony target to force checking subdirectories.
+FORCE :
+       $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker perldepend section:
+
+
+# --- MakeMaker makefile section:
+# We take a very conservative approach here, but it's worth it.
+# We move Makefile to Makefile.old here to avoid gnu make looping.
+$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
+       $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
+       $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
+       -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
+       -$(NOECHO) $(MV)   $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+       - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
+       $(PERLRUN) Makefile.PL 
+       $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
+       $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command.  <=="
+       false
+
+
+
+# --- MakeMaker staticmake section:
+
+# --- MakeMaker makeaperl section ---
+MAP_TARGET    = perl
+FULLPERL      = /usr/bin/perl
+
+$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
+       $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
+
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
+       $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
+       $(NOECHO) $(PERLRUNINST) \
+               Makefile.PL DIR= \
+               MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
+               MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=
+
+
+# --- MakeMaker test section:
+
+TEST_VERBOSE=0
+TEST_TYPE=test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = t/*.t
+TESTDB_SW = -d
+
+testdb :: testdb_$(LINKTYPE)
+
+test :: $(TEST_TYPE) subdirs-test
+
+subdirs-test ::
+       $(NOECHO) $(NOOP)
+
+
+test_dynamic :: pure_all
+       PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
+
+testdb_dynamic :: pure_all
+       PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-Iinc" "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
+
+test_ : test_dynamic
+
+test_static :: test_dynamic
+testdb_static :: testdb_dynamic
+
+
+# --- MakeMaker ppd section:
+# Creates a PPD (Perl Package Description) for a binary distribution.
+ppd :
+       $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,001000,0,0">' > $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '    <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '    <ABSTRACT>A sub-class of the standard TT view which</ABSTRACT>' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '    <AUTHOR>Tomas Doran C&lt;&lt; &lt;bobtfish@bobtfish.net&gt; &gt;&gt;</AUTHOR>' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '    <IMPLEMENTATION>' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Catalyst-Action-RenderView" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Catalyst-Runtime" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Catalyst-View-TT" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="ExtUtils-MakeMaker" VERSION="6,42,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Test-More" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Test-WWW-Mechanize-Catalyst" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="ok" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <OS NAME="$(OSNAME)" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <ARCHITECTURE NAME="darwin-thread-multi-2level-5.8" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '        <CODEBASE HREF="" />' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '    </IMPLEMENTATION>' >> $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
+
+
+# --- MakeMaker pm_to_blib section:
+
+pm_to_blib : $(TO_INST_PM)
+       $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' -- \
+         lib/Catalyst/View/TT/XHTML.pm blib/lib/Catalyst/View/TT/XHTML.pm 
+       $(NOECHO) $(TOUCH) pm_to_blib
+
+
+# --- MakeMaker selfdocument section:
+
+
+# --- MakeMaker postamble section:
+
+
+# End.
+# Postamble by Module::Install 0.77
+# --- Module::Install::Admin::Makefile section:
+
+realclean purge ::
+       $(RM_F) $(DISTVNAME).tar$(SUFFIX)
+       $(RM_RF) inc MANIFEST.bak _build
+       $(PERL) -I. "-MModule::Install::Admin" -e "remove_meta()"
+
+reset :: purge
+
+upload :: test dist
+       cpan-upload -verbose $(DISTVNAME).tar$(SUFFIX)
+
+grok ::
+       perldoc Module::Install
+
+distsign ::
+       cpansign -s
+
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644 (file)
index 0000000..bd1d10c
--- /dev/null
@@ -0,0 +1,16 @@
+use inc::Module::Install;
+
+name 'Catalyst-View-TT-XHTML';
+all_from 'lib/Catalyst/View/TT/XHTML.pm';
+
+requires 'Catalyst::Runtime';
+requires 'Catalyst::View::TT';
+
+build_requires 'Catalyst::Action::RenderView';
+build_requires 'Test::WWW::Mechanize::Catalyst';
+build_requires 'Test::More';
+build_requires 'ok';
+
+resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-View-TT-XHTML';
+
+WriteAll();
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..6616949
--- /dev/null
+++ b/README
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Catalyst::View::TT::XHTML - A sub-class of the standard TT view which
+serves application/xhtml+xml content if the browser accepts it.</title>
+<link rev="made" href="mailto:root@b45.apple.com" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#methods">METHODS</a></li>
+       <ul>
+
+               <li><a href="#process">process</a></li>
+       </ul>
+
+       <li><a href="#bugs">BUGS</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+       <li><a href="#copyright">COPYRIGHT</a></li>
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Catalyst::View::TT::XHTML - A sub-class of the standard TT view which
+serves application/xhtml+xml content if the browser accepts it.</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<pre>
+    package MyApp::View::XHTML;
+    use strict;
+    use warnings;
+    use base qw/Catalyst::View::TT::XHTML MyApp::View::TT/;
+    
+    1;
+    
+=head1 DESCRIPTION</pre>
+<p>This is a very simple sub-class of <a href="/Catalyst/View/TT.html">the Catalyst::View::TT manpage</a>, which sets
+the response <code>Content-Type</code> to be <code>application/xhtml+xml</code> if the
+user's browser sends an <code>Accept</code> header indicating that it is willing
+to process that MIME type.</p>
+<p>Changing the <code>Content-Type</code> causes browsers to interpret the page as
+strict XHTML, meaning that the markup must be well formed.</p>
+<p>This is useful when you're developing your application, as you know that
+all pages you view are rendered strictly, so any markup errors will show
+up at once.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<p>
+</p>
+<h2><a name="process">process</a></h2>
+<p>Overrides the standard process method, delegating to <a href="/Catalyst/View/TT.html">the Catalyst::View::TT manpage</a>
+to render the template, and then changing the response <code>Content-Type</code> if
+appropriate (from the requests <code>Accept</code> header).</p>
+<p>
+</p>
+<hr />
+<h1><a name="bugs">BUGS</a></h1>
+<p>There should be a more elegant way to inherit the config of your normal 
+TT view.</p>
+<p>Configuration (as loaded by <a href="/Catalyst/Plugin/ConfigLoader.html">the Catalyst::Plugin::ConfigLoader manpage</a>) for the TT 
+view is not used.</p>
+<p>No helper to generate the view file needed (just copy the code in the 
+SYNOPSIS).</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tomas Doran <code>&lt;bobtfish@bobtfish.net&gt;</code></p>
+<p>
+</p>
+<hr />
+<h1><a name="copyright">COPYRIGHT</a></h1>
+<p>This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself.</p>
+
+</body>
+
+</html>
diff --git a/lib/Catalyst/View/TT/XHTML.pm b/lib/Catalyst/View/TT/XHTML.pm
new file mode 100644 (file)
index 0000000..1a93782
--- /dev/null
@@ -0,0 +1,78 @@
+package Catalyst::View::TT::XHTML;
+use strict;
+use warnings;
+use base qw/Catalyst::View::TT/;
+
+our $VERSION = '0.001000';
+
+sub process {
+    my $self = shift;
+    my ($c) = @_;
+    $self->next::method(@_);
+    my $accept = $c->request->header('Accept');
+    if ( $accept && $accept =~ m|application/xhtml\+xml|) {
+      $c->response->headers->{'content-type'} =~ s|text/html|application/xhtml+xml|;
+    }
+    return 1;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::View::TT::XHTML - A sub-class of the standard TT view which
+serves application/xhtml+xml content if the browser accepts it.
+
+=head1 SYNOPSIS
+
+    package MyApp::View::XHTML;
+    use strict;
+    use warnings;
+    use base qw/Catalyst::View::TT::XHTML MyApp::View::TT/;
+    
+    1;
+    
+=head1 DESCRIPTION
+
+This is a very simple sub-class of L<Catalyst::View::TT>, which sets
+the response C<Content-Type> to be C<application/xhtml+xml> if the
+user's browser sends an C<Accept> header indicating that it is willing
+to process that MIME type.
+
+Changing the C<Content-Type> causes browsers to interpret the page as
+strict XHTML, meaning that the markup must be well formed.
+
+This is useful when you're developing your application, as you know that
+all pages you view are rendered strictly, so any markup errors will show
+up at once.
+
+=head1 METHODS
+
+=head2 process
+
+Overrides the standard process method, delegating to L<Catalyst::View::TT>
+to render the template, and then changing the response C<Content-Type> if
+appropriate (from the requests C<Accept> header).
+
+=head1 BUGS
+
+There should be a more elegant way to inherit the config of your normal 
+TT view.
+
+Configuration (as loaded by L<Catalyst::Plugin::ConfigLoader>) for the TT 
+view is not used.
+
+No helper to generate the view file needed (just copy the code in the 
+SYNOPSIS).
+
+=head1 AUTHOR
+
+Tomas Doran C<< <bobtfish@bobtfish.net> >>
+
+=head1 COPYRIGHT
+
+This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself.
+
+=cut
diff --git a/t/00-load.t b/t/00-load.t
new file mode 100644 (file)
index 0000000..7c87264
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 1;
+use ok 'Catalyst::View::TT::XHTML';
diff --git a/t/lib/Makefile.PL b/t/lib/Makefile.PL
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm
new file mode 100644 (file)
index 0000000..b981c45
--- /dev/null
@@ -0,0 +1,9 @@
+package TestApp;
+use strict;
+use warnings;
+
+use Catalyst;
+
+__PACKAGE__->setup;
+
+1;
diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm
new file mode 100644 (file)
index 0000000..6292aee
--- /dev/null
@@ -0,0 +1,18 @@
+package TestApp::Controller::Root;
+use strict;
+use warnings;
+
+__PACKAGE__->config(namespace => q{});
+
+use base 'Catalyst::Controller';
+
+sub main :Path { }
+
+sub nothtml :Local {
+  my ($self, $c) = @_;
+  $c->res->content_type('application/json');
+}
+
+sub end : ActionClass('RenderView') {}
+
+1;
diff --git a/t/lib/TestApp/View/XHTML.pm b/t/lib/TestApp/View/XHTML.pm
new file mode 100644 (file)
index 0000000..cdfa182
--- /dev/null
@@ -0,0 +1,6 @@
+package TestApp::View::XHTML;
+use strict;
+use warnings;
+use base qw/Catalyst::View::TT::XHTML/;
+
+1;
diff --git a/t/lib/TestApp/root/main b/t/lib/TestApp/root/main
new file mode 100644 (file)
index 0000000..85c8829
--- /dev/null
@@ -0,0 +1 @@
+it works
\ No newline at end of file
diff --git a/t/lib/TestApp/root/nothtml b/t/lib/TestApp/root/nothtml
new file mode 100644 (file)
index 0000000..b466ad4
--- /dev/null
@@ -0,0 +1 @@
+not html
\ No newline at end of file
diff --git a/t/lib/script/testapp_server.pl b/t/lib/script/testapp_server.pl
new file mode 100644 (file)
index 0000000..701d39f
--- /dev/null
@@ -0,0 +1,121 @@
+#!/usr/bin/env perl
+
+BEGIN { 
+    $ENV{CATALYST_ENGINE} ||= 'HTTP';
+    $ENV{CATALYST_SCRIPT_GEN} = 31;
+    require Catalyst::Engine::HTTP;
+}  
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/..";
+
+my $debug             = 0;
+my $fork              = 0;
+my $help              = 0;
+my $host              = undef;
+my $port              = 3000;
+my $keepalive         = 0;
+my $restart           = 0;
+my $restart_delay     = 1;
+my $restart_regex     = '\.yml$|\.yaml$|\.pm$';
+my $restart_directory = undef;
+my $background        = 0;
+my $pidfile           = "/tmp/testapp.pid";
+
+my @argv = @ARGV;
+
+GetOptions(
+    'debug|d'             => \$debug,
+    'fork'                => \$fork,
+    'help|?'              => \$help,
+    'host=s'              => \$host,
+    'port=s'              => \$port,
+    'keepalive|k'         => \$keepalive,
+    'restart|r'           => \$restart,
+    'restartdelay|rd=s'   => \$restart_delay,
+    'restartregex|rr=s'   => \$restart_regex,
+    'restartdirectory=s'  => \$restart_directory,
+    'daemon'              => \$background,
+    'pidfile=s'           => \$pidfile,          
+);
+
+pod2usage(1) if $help;
+
+if ( $restart ) {
+    $ENV{CATALYST_ENGINE} = 'HTTP::Restarter';
+}
+if ( $debug ) {
+    $ENV{CATALYST_DEBUG} = 1;
+}
+
+# This is require instead of use so that the above environment
+# variables can be set at runtime.
+require TestApp;
+
+TestApp->run( $port, $host, {
+    argv              => \@argv,
+    'fork'            => $fork,
+    keepalive         => $keepalive,
+    restart           => $restart,
+    restart_delay     => $restart_delay,
+    restart_regex     => qr/$restart_regex/,
+    restart_directory => $restart_directory,
+    background        => $background,
+    pidfile           => $pidfile,                             
+} );
+
+1;
+
+=head1 NAME
+
+testapp_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+testapp_server.pl [options]
+
+ Options:
+   -d -debug          force debug mode
+   -f -fork           handle each request in a new process
+                      (defaults to false)
+   -? -help           display this help and exits
+      -host           host (defaults to all)
+   -p -port           port (defaults to 3000)
+   -k -keepalive      enable keep-alive connections
+   -r -restart        restart when files get modified
+                      (defaults to false)
+   -rd -restartdelay  delay between file checks
+   -rr -restartregex  regex match files that trigger
+                      a restart when modified
+                      (defaults to '\.yml$|\.yaml$|\.pm$')
+   -restartdirectory  the directory to search for
+                      modified files
+                      (defaults to '../')
+
+   -daemon            background the server
+   -pidfile=filename  store the pid if the server in filename, if
+                      daemonizing
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/t/lib/script/testapp_test.pl b/t/lib/script/testapp_test.pl
new file mode 100644 (file)
index 0000000..1cc8d04
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/..";
+use Catalyst::Test 'TestApp';
+
+print request($ARGV[0])->content . "\n";
+
+1;
diff --git a/t/live-test.t b/t/live-test.t
new file mode 100644 (file)
index 0000000..2de6e93
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 13;
+
+# setup library path
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+# 1 make sure testapp works
+use ok 'TestApp';
+
+# a live test against TestApp, the test application
+use Test::WWW::Mechanize::Catalyst 'TestApp';
+my $mech = Test::WWW::Mechanize::Catalyst->new;
+
+# 2-4
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'text/html; charset=utf-8',
+  'No Accept header = text/html';
+  
+$mech->add_header( Accept => 'text/html' );
+
+# 5-7
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'text/html; charset=utf-8',
+  'Accept header of text/html = text/html';
+
+$mech->add_header( Accept => 'application/xhtml+xml' );
+
+# 8-10
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'application/xhtml+xml; charset=utf-8',
+  'Accept xhtml gives content type application/xhtml+xml';
+
+# 11-13
+$mech->get_ok('http://localhost/nothtml', 'get nothtml page');
+$mech->content_like(qr/not html/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'application/json',
+  'application/json is unmolested';
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
new file mode 100644 (file)
index 0000000..703f91d
--- /dev/null
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
diff --git a/t/pod.t b/t/pod.t
new file mode 100644 (file)
index 0000000..976d7cd
--- /dev/null
+++ b/t/pod.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
diff --git a/t/podspelling.t b/t/podspelling.t
new file mode 100644 (file)
index 0000000..59e1fca
--- /dev/null
@@ -0,0 +1,19 @@
+#!perl -w
+use strict;
+use warnings;
+use Test::More;
+
+eval 'use Test::Spelling 0.11';
+plan skip_all => 'Test::Spelling 0.11 not installed' if $@;
+plan skip_all => 'set TEST_SPELLING to enable this test' unless $ENV{TEST_SPELLING};
+
+set_spell_cmd('aspell list');
+
+add_stopwords( grep { defined $_ && length $_ } <DATA>);
+
+all_pod_files_spelling_ok();
+
+__DATA__
+XHTML
+TT
+Doran