CGI-Application-Plugin-ActionDispatch-0.99/000755 000765 000024 00000000000 12041276230 021120 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/Changes000644 000765 000024 00000001011 12041276210 022402 0ustar00jaywhystaff000000 000000 Revision history for Perl extension CGI::Application::Plugin::ActionDispatch. 0.99 October 22, 2012 - Added patch by Danny Warren. The patch improves Attribute parsing. 0.98 June 2, 2010 - Added patch by Alex Bowley fixes a bug if there are no "action args" for a path. 0.97 Sep 29, 2008 - Attributes.pm was not included in the 0.96 distribution. - Updated the documentation. 0.01 Apr 4, 2006 - original version; created by h2xs 1.23 with options -X CGI::Application::Plugin::ActionDispatch CGI-Application-Plugin-ActionDispatch-0.99/examples/000755 000765 000024 00000000000 12041276210 022734 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/lib/000755 000765 000024 00000000000 12041276210 021664 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/Makefile.old000644 000765 000024 00000060407 12041276210 023342 0ustar00jaywhystaff000000 000000 # This Makefile is for the CGI::Application::Plugin::ActionDispatch extension to perl. # # It was generated automatically by MakeMaker version # 6.56 (Revision: 65600) 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: # BUILD_REQUIRES => { } # INSTALLDIRS => q[site] # NAME => q[CGI::Application::Plugin::ActionDispatch] # PL_FILES => { } # PREREQ_PM => { CGI::Application=>q[4.0], Attribute::Handlers=>q[0], Class::Inspector=>q[0] } # VERSION_FROM => q[lib/CGI/Application/Plugin/ActionDispatch.pm] # --- MakeMaker post_initialize section: # --- MakeMaker const_config section: # These definitions are from config.sh (via /System/Library/Perl/5.12/darwin-thread-multi-2level/Config.pm). # They may have been overridden via Makefile.PL or on the command line. AR = ar CC = clang CCCDLFLAGS = CCDLFLAGS = DLEXT = bundle DLSRC = dl_dlopen.xs EXE_EXT = FULL_AR = /usr/bin/ar LD = clang -mmacosx-version-min=10.8 LDDLFLAGS = -arch i386 -arch x86_64 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector LDFLAGS = -arch i386 -arch x86_64 -fstack-protector -L/usr/local/lib LIBC = LIB_EXT = .a OBJ_EXT = .o OSNAME = darwin OSVERS = 12.0 RANLIB = /usr/bin/ar s SITELIBEXP = /Library/Perl/5.12 SITEARCHEXP = /Library/Perl/5.12/darwin-thread-multi-2level SO = dylib VENDORARCHEXP = /Network/Library/Perl/5.12/darwin-thread-multi-2level VENDORLIBEXP = /Network/Library/Perl/5.12 # --- MakeMaker constants section: AR_STATIC_ARGS = cr DIRFILESEP = / DFSEP = $(DIRFILESEP) NAME = CGI::Application::Plugin::ActionDispatch NAME_SYM = CGI_Application_Plugin_ActionDispatch VERSION = 0.98 VERSION_MACRO = VERSION VERSION_SYM = 0_98 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" XS_VERSION = 0.98 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 = /Library/Perl/Updates/5.12.4 DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) INSTALLSITELIB = /Library/Perl/5.12 DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) INSTALLVENDORLIB = /Network/Library/Perl/5.12 DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) INSTALLARCHLIB = /Library/Perl/Updates/5.12.4/darwin-thread-multi-2level DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) INSTALLSITEARCH = /Library/Perl/5.12/darwin-thread-multi-2level DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) INSTALLVENDORARCH = /Network/Library/Perl/5.12/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/share/man/man1 DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) INSTALLVENDORMAN1DIR = /usr/local/share/man/man1 DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR) INSTALLMAN3DIR = /usr/share/man/man3 DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR) INSTALLSITEMAN3DIR = /usr/local/share/man/man3 DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR) INSTALLVENDORMAN3DIR = /usr/local/share/man/man3 DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) PERL_LIB = /System/Library/Perl/5.12 PERL_ARCHLIB = /System/Library/Perl/5.12/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.12/darwin-thread-multi-2level/CORE PERL = /usr/bin/perl FULLPERL = /usr/bin/perl ABSPERL = $(PERL) PERLRUN = $(PERL) FULLPERLRUN = $(FULLPERL) ABSPERLRUN = $(ABSPERL) PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" PERL_CORE = 0 PERM_DIR = 755 PERM_RW = 644 PERM_RWX = 755 MAKEMAKER = /System/Library/Perl/5.12/ExtUtils/MakeMaker.pm MM_VERSION = 6.56 MM_REVISION = 65600 # 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 = CGI/Application/Plugin/ActionDispatch BASEEXT = ActionDispatch PARENT_NAME = CGI::Application::Plugin DLBASE = $(BASEEXT) VERSION_FROM = lib/CGI/Application/Plugin/ActionDispatch.pm OBJECT = LDFROM = $(OBJECT) LINKTYPE = dynamic BOOTDEP = # Handy lists of source code files: XS_FILES = C_FILES = O_FILES = H_FILES = MAN1PODS = MAN3PODS = lib/CGI/Application/Plugin/ActionDispatch.pm \ lib/CGI/Application/Plugin/ActionDispatch/Attributes.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)/CGI/Application/Plugin INST_ARCHLIBDIR = $(INST_ARCHLIB)/CGI/Application/Plugin 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/CGI/Application/Plugin/ActionDispatch.pm \ lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm PM_TO_BLIB = lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm \ blib/lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm \ lib/CGI/Application/Plugin/ActionDispatch.pm \ blib/lib/CGI/Application/Plugin/ActionDispatch.pm # --- MakeMaker platform_constants section: MM_Unix_VERSION = 6.56 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 = $(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' -- FALSE = false TRUE = true ECHO = echo ECHO_N = echo -n UNINST = 0 VERBINST = 0 MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install([ from_to => {@ARGV}, verbose => '\''$(VERBINST)'\'', uninstall_shadows => '\''$(UNINST)'\'', dir_mode => '\''$(PERM_DIR)'\'' ]);' -- 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 = $(ABSPERLRUN) -MExtUtils::MY -e 'MY->fixin(shift)' -- # --- MakeMaker makemakerdflt section: makemakerdflt : all $(NOECHO) $(NOOP) # --- MakeMaker dist section: TAR = COPY_EXTENDED_ATTRIBUTES_DISABLE=1 COPYFILE_DISABLE=1 tar TARFLAGS = cvf ZIP = zip ZIPFLAGS = -r COMPRESS = gzip --best SUFFIX = .gz SHAR = shar PREOP = $(NOECHO) $(NOOP) POSTOP = $(NOECHO) $(NOOP) TO_UNIX = $(NOECHO) $(NOOP) CI = ci -u RCS_LABEL = rcs -Nv$(VERSION_SYM): -q DIST_CP = best DIST_DEFAULT = tardist DISTNAME = CGI-Application-Plugin-ActionDispatch DISTVNAME = CGI-Application-Plugin-ActionDispatch-0.98 # --- 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) $(PERM_DIR) $(INST_LIBDIR) $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHLIB) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHLIB) $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_AUTODIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_AUTODIR) $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHAUTODIR) $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_BIN) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_BIN) $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_SCRIPT) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_SCRIPT) $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN1DIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN1DIR) $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN3DIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(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/CGI/Application/Plugin/ActionDispatch/Attributes.pm \ lib/CGI/Application/Plugin/ActionDispatch.pm $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \ lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm $(INST_MAN3DIR)/CGI::Application::Plugin::ActionDispatch::Attributes.$(MAN3EXT) \ lib/CGI/Application/Plugin/ActionDispatch.pm $(INST_MAN3DIR)/CGI::Application::Plugin::ActionDispatch.$(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) \ 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 : create_distdir $(NOECHO) $(ECHO) Generating META.yml $(NOECHO) $(ECHO) '--- #YAML:1.0' > META_new.yml $(NOECHO) $(ECHO) 'name: CGI-Application-Plugin-ActionDispatch' >> META_new.yml $(NOECHO) $(ECHO) 'version: 0.98' >> META_new.yml $(NOECHO) $(ECHO) 'abstract: ~' >> META_new.yml $(NOECHO) $(ECHO) 'author: []' >> META_new.yml $(NOECHO) $(ECHO) 'license: unknown' >> META_new.yml $(NOECHO) $(ECHO) 'distribution_type: module' >> META_new.yml $(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml $(NOECHO) $(ECHO) 'build_requires:' >> META_new.yml $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml $(NOECHO) $(ECHO) 'requires:' >> META_new.yml $(NOECHO) $(ECHO) ' Attribute::Handlers: 0' >> META_new.yml $(NOECHO) $(ECHO) ' CGI::Application: 4.0' >> META_new.yml $(NOECHO) $(ECHO) ' Class::Inspector: 0' >> META_new.yml $(NOECHO) $(ECHO) 'no_index:' >> META_new.yml $(NOECHO) $(ECHO) ' directory:' >> META_new.yml $(NOECHO) $(ECHO) ' - t' >> META_new.yml $(NOECHO) $(ECHO) ' - inc' >> META_new.yml $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.56' >> META_new.yml $(NOECHO) $(ECHO) 'meta-spec:' >> META_new.yml $(NOECHO) $(ECHO) ' url: http://module-build.sourceforge.net/META-spec-v1.4.html' >> META_new.yml $(NOECHO) $(ECHO) ' version: 1.4' >> META_new.yml -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml # --- 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 distmeta $(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 :: pure_install doc_install $(NOECHO) $(NOOP) install_perl :: pure_perl_install doc_perl_install $(NOECHO) $(NOOP) install_site :: pure_site_install doc_site_install $(NOECHO) $(NOOP) install_vendor :: 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 :: all $(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 :: all $(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 :: all $(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 :: all $(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 :: all $(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 :: all $(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), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) testdb_dynamic :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-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) '' > $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) '' >> $(DISTNAME).ppd # --- MakeMaker pm_to_blib section: pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM) $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \ lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm blib/lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm \ lib/CGI/Application/Plugin/ActionDispatch.pm blib/lib/CGI/Application/Plugin/ActionDispatch.pm $(NOECHO) $(TOUCH) pm_to_blib # --- MakeMaker selfdocument section: # --- MakeMaker postamble section: # End. CGI-Application-Plugin-ActionDispatch-0.99/Makefile.PL000644 000765 000024 00000000567 12041276210 023100 0ustar00jaywhystaff000000 000000 use ExtUtils::MakeMaker; WriteMakefile( NAME => 'CGI::Application::Plugin::ActionDispatch', VERSION_FROM => 'lib/CGI/Application/Plugin/ActionDispatch.pm', PREREQ_PM => { 'CGI::Application' => '4.0', 'Class::Inspector' => '0', 'Attribute::Handlers' => '0', }, INSTALLDIRS => 'site', PL_FILES => {} ); CGI-Application-Plugin-ActionDispatch-0.99/MANIFEST000644 000765 000024 00000000451 12041276210 022247 0ustar00jaywhystaff000000 000000 Changes Makefile.PL MANIFEST README t/01_regex.t t/02_path.t t/03_default.t t/04_runmode.t t/05_match.t t/TestAppDefault.pm t/TestAppMatch.pm t/TestAppPath.pm t/TestAppRegex.pm t/TestAppRunmode.pm lib/CGI/Application/Plugin/ActionDispatch.pm lib/CGI/Application/Plugin/ActionDispatch/Attributes.pmCGI-Application-Plugin-ActionDispatch-0.99/README000644 000765 000024 00000012617 12041276210 022005 0ustar00jaywhystaff000000 000000 NAME CGI::Application::Plugin::ActionDispatch - Perl extension SYNOPSIS # In "WebApp.pm"... package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; sub do_stuff : Path('do/stuff') { ... } sub do_more_stuff : Regex('^/do/more/stuff\/?$') { ... } sub do_something_else : Regex('do/something/else/(\w+)/(\d+)$') { ... } DESCRIPTION CGI::Application::Plugin::ActionDispatch adds attribute based support for parsing the PATH_INFO of the incoming request. For those who are familiar with Catalyst. The interface works very similar. This plugin is plug and play and shouldn't interrupt the default behavior of CGI::Application. CAVEATS Be aware though, this plugin will not likely work with other modules that use attributes. This module should work with mod_perl. It however has not be thoroughly tested as such. If you have used it with mod_perl please e-mail me with your experience. METHODS action_args() If using capturing parentheses in a Regex action. The captured values are accessible using this method. sub addElement : Regex('add/(\d+)/(\d+)') { my $self = shift; my($column, $row) = $self->action_args(); ... } The Path action will store everything after the matched path into the action args. # http://example.com/state/pa/philadelphia sub find_state_and_city : Path('state/') { my $self = shift; my($state, $city) = $self->action_args(); # $state == pa, $city == philadelphia ... } ACTIONS Regex Regex action is used for regular expression matching against PATH_INFO. If capturing parentheses are used; the matched parameters are accesssible using the action_args() method. Regex('^blah/foo'); The Regex action either matches or it doesn't. There are no secrets to it. It is important to note Regex action takes priority. It is assumed if a Path and Regex action both match. The Regex action will take priority, which may not always be the outcome of least suprise, for instance: # http://example.com/music/the_clash sub clash : Path('/music/the_clash') {} # This is an exact match, BUT. sub the_class : Regex('/music/the_clash') {} # This takes priority. Beware. Path The Path action is basically a shortcut for a commonly used Regex action. # http://example.com/products/movies/2 sub show_product : Path('products/') { my $self = shift; my($category, $id) = $self->action_args(); .... } Is basically the same thing as. sub show_product : Regex('^/products/(\w+)/(\d+)') { my $self = shift; my($category, $id) = $self->action_args(); ... } For those that care, the Path('products/') will be converted to the regular expression "^/products\/?(\/.*)$"; then split('/') is run on the captured value and stored in action_args(). Runmode This action will take the method name and run a match on that. # http://example.com/foobar sub foobar : Runmode {} Default The default run mode if no match is found. Essentially the equivalent of the start_mode() method. sub default_mode : Default {} EXAMPLE In CGI::Application module: package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; use strict; sub setup { my $self = shift; self->mode_param('test_rm'); $self->run_modes( basic_runmode => 'basic_runmode' ); } # Regular runmodes should work. sub basic_runmode { my $self = shift } The product() runmode will match anything starting with "/products" in the PATH_INFO. # http://example.com/myapp.cgi/products/this/is/optional/and/stored/in/action_args/ sub product : Path('products/') { my $self = shift; my($category, $product) = $self->action_args(); } The music() runmode will match anything starting with "/products/music" in the PATH_INFO. The product() runmode also matches "/products/music". However since this runmode matches closer it takes priority over product(). # http://example.com/myapp.cgi/products/music/product/ sub music : Path('products/music/') { my $self = shift; my $product = $self->action_args(); ... } This beatles() runmode will match ONLY "/product/music/beatles" or "/product/music/beatles/". Regex takes priority over Path so the previous runmodes which match this PATH_INFO are not run. # http://example.com/myapp.cgi/products/music/beatles/ sub beatles : Regex('^/products/music/beatles\/?') { my $self = shift; ... } SEE ALSO CGI::Application, CGI::Application::Dispatch AUTHOR Jason Yates, COPYRIGHT AND LICENSE Copyright (C) 2006-2008 by Jason Yates This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. CGI-Application-Plugin-ActionDispatch-0.99/t/000755 000765 000024 00000000000 12041276210 021361 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/t/01_regex.t000644 000765 000024 00000000742 12041276210 023163 0ustar00jaywhystaff000000 000000 use Test::More tests => 6; use strict; use lib 't/'; BEGIN { use_ok('CGI::Application'); }; use TestAppRegex; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { local $ENV{PATH_INFO} = '/products/books/war_and_peace/ch/3/'; my $app = TestAppRegex->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: product/); like($output, qr/Category: books/); like($output, qr/Product: war_and_peace/); like($output, qr/Args: ch 3/); } CGI-Application-Plugin-ActionDispatch-0.99/t/02_path.t000644 000765 000024 00000002306 12041276210 023004 0ustar00jaywhystaff000000 000000 use Test::More tests => 13; use strict; use lib 't/'; BEGIN { use_ok('CGI::Application'); }; use TestAppPath; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { local $ENV{PATH_INFO} = '/products/music/rolling_stones/this/is/really/long/'; my $app = TestAppPath->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: test_rm/); like($output, qr/Args: this is really long/); } { local $ENV{PATH_INFO} = '/products/music/beatles/this/is/really/long/'; my $app = TestAppPath->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: test_rm_partial/); like($output, qr/Args: this is really long/); } { local $ENV{PATH_INFO} = '/products/music/miles_davis'; my $app = TestAppPath->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: test_rm_exact/); like($output, qr/Args: no args/); } { local $ENV{PATH_INFO} = '/products/music/miles_davis/'; my $app = TestAppPath->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: test_rm_exact/); like($output, qr/Args: no args/); } CGI-Application-Plugin-ActionDispatch-0.99/t/03_default.t000644 000765 000024 00000000416 12041276210 023475 0ustar00jaywhystaff000000 000000 use Test::More tests => 2; use strict; use lib 't/'; # 1 BEGIN { use_ok('CGI::Application'); }; use TestAppDefault; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { my $app = TestAppDefault->new(); my $output = $app->run(); like($output, qr/Runmode: default_rm/); } CGI-Application-Plugin-ActionDispatch-0.99/t/04_runmode.t000644 000765 000024 00000000544 12041276210 023525 0ustar00jaywhystaff000000 000000 use Test::More tests => 3; use strict; use lib 't/'; # 1 BEGIN { use_ok('CGI::Application'); }; use TestAppRunmode; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { local $ENV{PATH_INFO} = '/runmode_rm'; my $app = TestAppRunmode->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: runmode_rm/); } CGI-Application-Plugin-ActionDispatch-0.99/t/05_match.t000644 000765 000024 00000003127 12041276210 023151 0ustar00jaywhystaff000000 000000 use Test::More tests => 17; use strict; use lib 't/'; # 1 BEGIN { use_ok('CGI::Application'); }; use TestAppMatch; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { my $app = TestAppMatch->new(); $app->query(CGI->new({'test_rm' => 'basic_runmode'})); my $output = $app->run(); like($output, qr/Runmode: basic_runmode/); } { local $ENV{PATH_INFO} = ''; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: starter_rm/); } { local $ENV{PATH_INFO} = '/products'; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: products/); } { local $ENV{PATH_INFO} = '/products/'; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: products/); } { local $ENV{PATH_INFO} = '/products/books/war_and_peace'; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: product/); like($output, qr/Category: books/); like($output, qr/Product: war_and_peace/); } { local $ENV{PATH_INFO} = '/products/music/rolling_stones'; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: music/); like($output, qr/Product: rolling_stones/); } { local $ENV{PATH_INFO} = '/products/music/beatles'; my $app = TestAppMatch->new(); my $output = $app->run(); like($output, qr{^Content-Type: text/html}); like($output, qr/Runmode: beatles/); } CGI-Application-Plugin-ActionDispatch-0.99/t/06_errormode.t000644 000765 000024 00000000425 12041276210 024052 0ustar00jaywhystaff000000 000000 use Test::More tests => 2; use strict; use lib 't/'; # 1 BEGIN { use_ok('CGI::Application'); }; use TestAppErrorRunmode; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; { my $app = TestAppErrorRunmode->new(); my $output = $app->run(); like($output, qr/Runmode: error_rm/); } CGI-Application-Plugin-ActionDispatch-0.99/t/07_attribute_parsing.t000644 000765 000024 00000001066 12041276210 025605 0ustar00jaywhystaff000000 000000 use Test::More tests => 7; use strict; use lib 't/'; BEGIN { use_ok('CGI::Application'); }; use TestAppAttributeParsing; use CGI; $ENV{CGI_APP_RETURN_ONLY} = 1; my @runmodes = qw| single_quotes_space double_quotes_space single_quotes_tab double_quotes_tab single_quotes_tab_space double_quotes_tab_space |; foreach my $runmode ( @runmodes ) { local $ENV{PATH_INFO} = '/' . $runmode; my $app = TestAppAttributeParsing->new(); my $output = $app->run(); my $expected_output = 'Runmode: ' . $runmode; like($output, qr/$expected_output/); } CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppAttributeParsing.pm000644 000765 000024 00000002014 12041276210 026504 0ustar00jaywhystaff000000 000000 package TestAppAttributeParsing; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestApp::ISA = qw(CGI::Application); sub single_quotes_space : Path( '/single_quotes_space' ) { my $self = shift; return "Runmode: single_quotes_space\n"; } sub double_quotes_space : Path( "/double_quotes_space" ) { my $self = shift; return "Runmode: double_quotes_space\n"; } sub single_quotes_tab : Path( '/single_quotes_tab' ) { my $self = shift; return "Runmode: single_quotes_tab\n"; } sub double_quotes_tab : Path( "/double_quotes_tab" ) { my $self = shift; return "Runmode: double_quotes_tab\n"; } sub single_quotes_tab_space : Path( '/single_quotes_tab_space' ) { my $self = shift; return "Runmode: single_quotes_tab_space\n"; } sub double_quotes_tab_space : Path( "/double_quotes_tab_space" ) { my $self = shift; return "Runmode: double_quotes_tab_space\n"; } sub failed : Default { my $self = shift; return "Failed: fell back to default runmode\n"; } CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppDefault.pm000644 000765 000024 00000000532 12041276210 024604 0ustar00jaywhystaff000000 000000 package TestAppDefault; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestAppDefault::ISA = qw(CGI::Application); sub setup { my $self = shift; $self->run_modes({ home => 'home' }); } sub home { return "Runmode: home\n"; } sub default_rm : Default { my $self = shift; return "Runmode: default_rm\n"; } 1; CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppErrorRunmode.pm000644 000765 000024 00000000612 12041276210 025642 0ustar00jaywhystaff000000 000000 package TestAppErrorRunmode; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestAppErrorRunmode::ISA = qw(CGI::Application); sub setup { my $self = shift; $self->run_modes({ home => 'home' }); } sub home : Default { die "Call error runmode"; return "Runmode: home\n"; } sub error_rm : ErrorRunmode { my $self = shift; return "Runmode: error_rm\n"; } 1; CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppMatch.pm000644 000765 000024 00000001612 12041276210 024254 0ustar00jaywhystaff000000 000000 package TestAppMatch; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestApp::ISA = qw(CGI::Application); sub setup { my $self = shift; $self->mode_param('test_rm'); $self->run_modes( basic_runmode => 'basic_runmode' ); } sub basic_runmode { my $self = shift; return "Runmode: basic_runmode\n"; } sub starter_rm : Default { return "Runmode: starter_rm\n"; } sub products : Runmode { my $self = shift; return "Runmode: products\n"; } sub product : Path('products/') { my $self = shift; my($category, $product) = $self->action_args(); return "Runmode: product\nCategory: $category\nProduct: $product\n"; } sub music : Path('products/music/') { my $self = shift; my $product = $self->action_args(); return "Runmode: music\nProduct: $product\n"; } sub beatles : Regex('^/products/music/beatles\/?') { my $self = shift; return "Runmode: beatles\n"; } CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppPath.pm000644 000765 000024 00000001307 12041276210 024115 0ustar00jaywhystaff000000 000000 package TestAppPath; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestApp::ISA = qw(CGI::Application); sub test_rm : Path('/products/music/rolling_stones/') { my $self = shift; my( @args ) = $self->action_args(); return "Runmode: test_rm\nArgs: " . join(" ", @args); } sub test_rm_exact : Path('products/music/miles_davis') { my $self = shift; my @args = $self->action_args(); my $return = join(" ", @args) if @args; return "Runmode: test_rm_exact\nArgs: " . $return . "no args"; } sub test_rm_partial : Path('products/music/beatles') { my $self = shift; my( @args ) = $self->action_args(); return "Runmode: test_rm_partial\nArgs: " . join(" ", @args); } CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppRegex.pm000644 000765 000024 00000000543 12041276210 024274 0ustar00jaywhystaff000000 000000 package TestAppRegex; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestApp::ISA = qw(CGI::Application); sub product : Regex('^/products/books/war_and_peace/(\w+)/(\d+)/') { my $self = shift; my($ch, $num) = $self->action_args(); return "Runmode: product\nCategory: books\nProduct: war_and_peace\nArgs: $ch $num\n"; } CGI-Application-Plugin-ActionDispatch-0.99/t/TestAppRunmode.pm000644 000765 000024 00000000350 12041276210 024627 0ustar00jaywhystaff000000 000000 package TestAppRunmode; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; @TestAppRunmode::ISA = qw(CGI::Application); sub runmode_rm : Runmode { my $self = shift; return "Runmode: runmode_rm\n"; } 1; CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/000755 000765 000024 00000000000 12041276210 022266 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/Application/000755 000765 000024 00000000000 12041276210 024531 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/Application/Plugin/000755 000765 000024 00000000000 12041276210 025767 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/Application/Plugin/ActionDispatch/000755 000765 000024 00000000000 12041276210 030664 5ustar00jaywhystaff000000 000000 CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/Application/Plugin/ActionDispatch.pm000644 000765 000024 00000021625 12041276210 031230 0ustar00jaywhystaff000000 000000 package CGI::Application::Plugin::ActionDispatch; use strict; use Data::Dumper; use Class::Inspector; use CGI::Application::Plugin::ActionDispatch::Attributes; require Exporter; our $VERSION = '0.99'; our @ISA = qw(Exporter); our @EXPORT = qw(action_args); our %_attr_cache; my %methods; sub CGI::Application::Path :ATTR { my ($class, $referent, $attr, $data) = @_; $data ||=''; $data =~ s/\/$//; unless( $data =~ /^\// ) { $data = "/" . $data; } my $regex = qr/^$data\/?(\/.*)?$/; push(@{ $_attr_cache{$class}{$attr} }, [ $referent, $regex ]); } sub CGI::Application::Regex :ATTR { my ($package, $referent, $attr, $data) = @_; my $regex = qr/$data/; push(@{ $_attr_cache{$package}{$attr} }, [$referent, $regex ]); } sub CGI::Application::Runmode :ATTR { my ($package, $referent, $attr, $data) = @_; $data = $methods{$referent}; my $regex = qr/^\/$data\/?$/; push(@{ $_attr_cache{$package}{$attr} }, [ $referent, $regex ]); } sub CGI::Application::Default :ATTR { my ($package, $referent, $attr, $data) = @_; $_attr_cache{$package}{$attr} = $referent; } sub CGI::Application::ErrorRunmode :ATTR { my ($package, $referent, $attr, $data) = @_; $_attr_cache{$package}{$attr} = $referent; } sub import { my $caller = caller; $caller->add_callback('init', \&_ad_init); $caller->add_callback('prerun', \&_ad_prerun); goto &Exporter::import; } sub _ad_init { my $self = shift; my $class = ref $self || $self; # Setup a hash table of all the methods in the class. $methods{$self->can($_)} = $_ foreach @{ Class::Inspector->methods($class) || [] }; #NOTE: This will search through ISA also. CGI::Application::Plugin::ActionDispatch::Attributes::init(); if(defined $_attr_cache{$class}{'Default'}) { my $runmode = $methods{$_attr_cache{$class}{'Default'}}; $self->start_mode($runmode); $self->run_modes($runmode => $runmode); } if(defined $_attr_cache{$class}{'ErrorRunmode'}) { $self->error_mode($methods{$_attr_cache{$class}{'ErrorRunmode'}}); } } sub _ad_prerun { my $self = shift; my $class = ref $self || $self; return unless defined $ENV{PATH_INFO}; my $start_mode = $self->start_mode(); ATTR: foreach my $type (qw( Runmode Regex Path )) { my($code, @args) = _match_type($class, $type, $ENV{PATH_INFO}); if($code) { # Make sure the runmode isn't set already and prerun_mode isn't set. if(! $self->prerun_mode()) { # Sorta of a hack here to actually get the runmode to run. my $runmode = $methods{$code}; $self->run_modes($runmode => $runmode); $self->prerun_mode($runmode); # Set the action_args array. $self->action_args(@args); } last ATTR; } } } sub _match_type { my($class, $type, $path_info) = @_; my $min; my(@path_args, $code); foreach my $attr (@{ $_attr_cache{$class}{$type} }) { if(my @args = ($path_info =~ $attr->[1])) { # We want to match the most accurate Path(). This is # done by counting the args, and finding the Path with # the fewest amount of args left over. if($type eq 'Path') { if(defined($args[0])) { $args[0] =~ s/^\///; @path_args = split('/', $args[0]); } # Set min if not defined. $min = scalar(@path_args) if( not defined $min ); # If complete match return. if( scalar(@path_args) == 0 ) { return ($attr->[0], undef); } elsif(scalar(@path_args) <= $min) { # Has fewest @path_args so far. $min = scalar(@path_args); $code = $attr->[0]; } } else { return ($attr->[0], @args); } } } return @path_args ? ($code, @path_args) : 0; } sub action_args { my($self, @args) = @_; # If args are passed set them. if(@args) { $self->{__CAP_ACTION_ARGS} = [ @args ]; return; } return undef unless defined $self->{__CAP_ACTION_ARGS}; return wantarray ? @{$self->{__CAP_ACTION_ARGS}} : shift @{$self->{__CAP_ACTION_ARGS}}; } 1; __END__ =head1 NAME CGI::Application::Plugin::ActionDispatch - Perl extension =head1 SYNOPSIS # In "WebApp.pm"... package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; sub do_stuff : Path('do/stuff') { ... } sub do_more_stuff : Regex('^/do/more/stuff\/?$') { ... } sub do_something_else : Regex('do/something/else/(\w+)/(\d+)$') { ... } =head1 DESCRIPTION CGI::Application::Plugin::ActionDispatch adds attribute based support for parsing the PATH_INFO of the incoming request. For those who are familiar with Catalyst. The interface works very similar. This plugin is plug and play and shouldn't interrupt the default behavior of CGI::Application. =head1 CAVEATS Be aware though, this plugin will not likely work with other modules that use attributes. This module should work with mod_perl. It however has not be thoroughly tested as such. If you have used it with mod_perl please e-mail me with your experience. =head1 METHODS =over 4 =item action_args() If using capturing parentheses in a Regex action. The captured values are accessible using this method. sub addElement : Regex('add/(\d+)/(\d+)') { my $self = shift; my($column, $row) = $self->action_args(); ... } The Path action will store everything after the matched path into the action args. # http://example.com/state/pa/philadelphia sub find_state_and_city : Path('state/') { my $self = shift; my($state, $city) = $self->action_args(); # $state == pa, $city == philadelphia ... } =back =head1 ACTIONS =over 4 =item Regex Regex action is used for regular expression matching against PATH_INFO. If capturing parentheses are used; the matched parameters are accesssible using the action_args() method. Regex('^blah/foo'); The Regex action either matches or it doesn't. There are no secrets to it. It is important to note Regex action takes priority. It is assumed if a Path and Regex action both match. The Regex action will take priority, which may not always be the outcome of least suprise, for instance: # http://example.com/music/the_clash sub clash : Path('/music/the_clash') {} # This is an exact match, BUT. sub the_class : Regex('/music/the_clash') {} # This takes priority. Beware. =item Path The Path action is basically a shortcut for a commonly used Regex action. # http://example.com/products/movies/2 sub show_product : Path('products/') { my $self = shift; my($category, $id) = $self->action_args(); .... } Is basically the same thing as. sub show_product : Regex('^/products/(\w+)/(\d+)') { my $self = shift; my($category, $id) = $self->action_args(); ... } For those that care, the Path('products/') will be converted to the regular expression "^/products\/?(\/.*)$"; then split('/') is run on the captured value and stored in action_args(). =item Runmode This action will take the method name and run a match on that. # http://example.com/foobar sub foobar : Runmode {} =item Default The default run mode if no match is found. Essentially the equivalent of the start_mode() method. sub default_mode : Default {} =back =head1 EXAMPLE In CGI::Application module: package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; use strict; sub setup { my $self = shift; self->mode_param('test_rm'); $self->run_modes( basic_runmode => 'basic_runmode' ); } # Regular runmodes should work. sub basic_runmode { my $self = shift } The product() runmode will match anything starting with "/products" in the PATH_INFO. # http://example.com/myapp.cgi/products/this/is/optional/and/stored/in/action_args/ sub product : Path('products/') { my $self = shift; my($category, $product) = $self->action_args(); } The music() runmode will match anything starting with "/products/music" in the PATH_INFO. The product() runmode also matches "/products/music". However since this runmode matches closer it takes priority over product(). # http://example.com/myapp.cgi/products/music/product/ sub music : Path('products/music/') { my $self = shift; my $product = $self->action_args(); ... } This beatles() runmode will match ONLY "/product/music/beatles" or "/product/music/beatles/". Regex takes priority over Path so the previous runmodes which match this PATH_INFO are not run. # http://example.com/myapp.cgi/products/music/beatles/ sub beatles : Regex('^/products/music/beatles\/?') { my $self = shift; ... } =head1 SEE ALSO L, L http://github.com/jaywhy/cgi-application-plugin-actiondispatch =head1 AUTHOR Jason Yates, Ejaywhy@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2006-2008 by Jason Yates This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. =cut CGI-Application-Plugin-ActionDispatch-0.99/lib/CGI/Application/Plugin/ActionDispatch/Attributes.pm000644 000765 000024 00000004420 12041276210 033350 0ustar00jaywhystaff000000 000000 package CGI::Application::Plugin::ActionDispatch::Attributes; use attributes; use strict; use Data::Dumper; our $VERSION = '0.1'; my @attributes; my %attr_handlers; my %inited; # Allow multiple CGI::Applications to be inited separately in mod_perl enivironment # MODIFY_CODE_ATTRIBUTES needs to be in the inheritance tree. push @CGI::Application::ISA, 'CGI::Application::Plugin::ActionDispatch::Attributes' unless grep /^CGI::Application::Plugin::ActionDispatch::Attributes$/, @CGI::Application::ISA; sub MODIFY_CODE_ATTRIBUTES { my($class, $code, @attrs) = @_; foreach (@attrs) { # Parse the attribute string ex: Regex('^/foo/bar/(\d+)/'). my($method, $params) = /^(.*?)(?:\(\s*(.+?)\s*\))?$/; if (defined $params) { ($params =~ s/^'(.*)'$/$1/) || ($params =~ s/^"(.*)"/$1/) } # Attribute definition. if($method eq 'ATTR') { $attr_handlers{$code} = $params } # Is a custom attribute. else { my $handler = $class->can($method); next unless $handler; push(@attributes, [ $class, $method, $code, $params ] ); } } return (); } sub init { my $class; foreach my $attr (@attributes) { $class = $attr->[0]; next if( exists $inited{$class}); my $method = $attr->[1]; # calls: class->method( code, method, params ); $class->$method( $attr->[2], $attr->[1], $attr->[3]); } $inited{$class}++; # Mark our caller class inited now, so that it can be skipped on next run } 1; __END__ =head1 NAME CGI::Application::Plugin::ActionDispatch::Attributes - Hidden attribute support for CGI::Application =head1 SYNOPSIS use CGI::Application::Plugin::ActionDispatch::Attributes; sub CGI::Application::Protected : ATTR { my( $package, $referent, $attr, $data ) = @_; ... } CGI::Application::Plugin::ActionDispatch::Attributes::init(); sub my_method Protected { ... } =head1 DESCRIPTION This module will add attribute support into CGI::Application. It will also not break mod_perl. T =head1 SEE ALSO =head1 AUTHOR Jason Yates, Ejaywhy@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2006-2008 by Jason Yates This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. =cut CGI-Application-Plugin-ActionDispatch-0.99/examples/testapp.cgi000644 000765 000024 00000000161 12041276210 025076 0ustar00jaywhystaff000000 000000 #!/usr/bin/perl use lib './'; use TestApp; $ENV{PATH_INFO} = $ARGV[0]; my $app = TestApp->new(); $app->run(); CGI-Application-Plugin-ActionDispatch-0.99/examples/TestApp.pm000644 000765 000024 00000001120 12041276210 024644 0ustar00jaywhystaff000000 000000 package TestApp; use base 'CGI::Application'; use lib '../lib'; use CGI::Application::Plugin::ActionDispatch; sub product : Regex('^/products/books/war_and_peace/(\d+)/') { my $self = shift; my $page_num = $self->action_args(); return "Runmode: product\nCategory: books\nProduct: war_and_peace\nArgs: $page_num\n"; } sub home : Default { return "Runmode: home\n"; } sub test : Runmode { my @args = $self->action_args(); return "Runmode: test\n"; } sub fail : Path('fail') { die "Call error mode"; } sub error_page : ErrorRunmode { return "Runmode: error_page\n"; } 1;