?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/Template-Toolkit-Simple-0.31-0.zip
???????
PK ��[ pm_to_blibnu �[��� PK ��[\.� Changesnu �[��� 0.31 Tue Dec 9 08:39:08 PST 2014 - Remove "use lib 'lib';". GitHub Issue 0.30 Sat Aug 16 16:47:08 PDT 2014 - Change testdir to t 0.29 Sat Aug 16 14:24:12 PDT 2014 - Remove =travis section 0.28 Sat Aug 16 12:29:34 PDT 2014 - Meta 0.0.2 0.27 Sat Aug 16 04:08:54 PDT 2014 - Eliminate spurious trailing whitespace 0.26 Fri Aug 15 21:31:26 PDT 2014 - Remove t/use_ok.t 0.25 Fri Aug 15 20:48:08 PDT 2014 - Add t/000-compile-modules.t 0.24 Fri Aug 8 19:03:02 PDT 2014 - Fix bug of using a bad TestMLIncluder. 0.23 Fri Aug 8 12:58:46 PDT 2014 - Switch hashbang to '#!/usr/bin/env perl' 0.22 Tue Aug 5 11:23:13 PDT 2014 - Change IRC channel to irc.freenode.net#pkg 0.21 Tue Aug 5 10:14:59 PDT 2014 - Add badges to doc 0.20 Mon Aug 4 00:35:28 PDT 2014 - Remove (c) from Copyright - Move doc to swim - Fix Meta and add Contributing 0.19 Wed Jun 18 11:23:29 PDT 2014 - Tests using TestML needed 'inc' 0.18 Mon Jun 16 15:46:07 PDT 2014 - Switch to manual versioning 0.17 Sun Jun 15 12:04:29 PDT 2014 - Move to Zilla::Dist 0.16 Mon Nov 7 18:49:56 PST 2011 - Anthony Cornehl++ implemented JSON and XML support. \o/ 0.15 Sat Nov 5 01:09:40 PDT 2011 - Use fixed TestML 0.14 Fri Oct 21 18:31:56 PDT 2011 - Use Module::Package - Add strict support 0.13 Sun May 15 17:08:56 EST 2011 - Use Stardoc - use Package 0.12 Sun May 15 12:46:44 EST 2011 - Forgot to 'use Encode'. doh! 0.11 Sun May 15 12:11:50 EST 2011 - Finally works with utf8 templates and yaml. \o/ 0.10 Mon Nov 29 09:58:35 EST 2010 - Skip tests if YAML::XS not installed. 0.08 Wed Sep 15 00:08:41 PDT 2010 - Remove old Test::Base subclass - Update copyright dates 0.07 Tue Sep 14 23:06:07 PDT 2010 - Switched testing from Test::Base to TestML - 0.04 - 0.06 never made it to CPAN :\ - Added new toys to Makefile.PL 0.06 Mon Apr 27 16:57:55 PDT 2009 - Encode stuff was a mistake. Reverting. 0.05 Sun Apr 26 19:06:13 PDT 2009 - Add usage text for command line help. - Fixed utf8 encoding. Hopefully. 0.04 Fri Nov 7 14:44:23 PST 2008 - Support start_tag and end_tag. 0.03 Mon Oct 27 17:02:25 PDT 2008 - Make api tt->(template, data, output); 0.02 Sat Oct 25 17:47:04 PDT 2008 - Make all TT options work. - Support path//template shorcut syntax. 0.01 Fri Sep 26 01:40:13 PDT 2008 - First Release PK ��[�bB�{t {t Makefilenu �[��� # This Makefile is for the Template::Toolkit::Simple extension to perl. # # It was generated automatically by MakeMaker version # 7.60 (Revision: 76000) 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 Simple Interface to Template Toolkit] # AUTHOR => [q[Ingy döt net <ingy@cpan.org>]] # BUILD_REQUIRES => { } # CONFIGURE_REQUIRES => { ExtUtils::MakeMaker=>q[6.30] } # DISTNAME => q[Template-Toolkit-Simple] # EXE_FILES => [q[bin/tt-render]] # LICENSE => q[perl] # NAME => q[Template::Toolkit::Simple] # PREREQ_PM => { Template=>q[2.22], YAML::XS=>q[0.37] } # TEST_REQUIRES => { } # VERSION => q[0.31] # test => { TESTS=>q[t/*.t] } # --- MakeMaker post_initialize section: # --- MakeMaker const_config section: # These definitions are from config.sh (via /usr/lib64/perl5/Config.pm). # They may have been overridden via Makefile.PL or on the command line. AR = ar CC = gcc CCCDLFLAGS = -fPIC CCDLFLAGS = -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 DLEXT = so DLSRC = dl_dlopen.xs EXE_EXT = FULL_AR = /usr/bin/ar LD = gcc LDDLFLAGS = -lpthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -L/usr/local/lib -fstack-protector-strong LDFLAGS = -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fstack-protector-strong -L/usr/local/lib LIBC = /lib/../lib64/libc.so.6 LIB_EXT = .a OBJ_EXT = .o OSNAME = linux OSVERS = 4.18.0-513.18.1.el8_9.x86_64 RANLIB = : SITELIBEXP = /usr/local/share/perl5/5.32 SITEARCHEXP = /usr/local/lib64/perl5/5.32 SO = so VENDORARCHEXP = /usr/lib64/perl5/vendor_perl VENDORLIBEXP = /usr/share/perl5/vendor_perl # --- MakeMaker constants section: AR_STATIC_ARGS = cr DIRFILESEP = / DFSEP = $(DIRFILESEP) NAME = Template::Toolkit::Simple NAME_SYM = Template_Toolkit_Simple VERSION = 0.31 VERSION_MACRO = VERSION VERSION_SYM = 0_31 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" XS_VERSION = 0.31 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 MAN1SECTION = 1 MAN3SECTION = 3 INSTALLDIRS = site DESTDIR = PREFIX = $(SITEPREFIX) PERLPREFIX = /usr SITEPREFIX = /usr/local VENDORPREFIX = /usr INSTALLPRIVLIB = /usr/share/perl5 DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) INSTALLSITELIB = /usr/local/share/perl5/5.32 DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) INSTALLVENDORLIB = /usr/share/perl5/vendor_perl DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) INSTALLARCHLIB = /usr/lib64/perl5 DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) INSTALLSITEARCH = /usr/local/lib64/perl5/5.32 DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) INSTALLVENDORARCH = /usr/lib64/perl5/vendor_perl DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH) INSTALLBIN = /usr/bin DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN) INSTALLSITEBIN = /usr/local/bin DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN) INSTALLVENDORBIN = /usr/bin DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN) INSTALLSCRIPT = /usr/bin DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT) INSTALLSITESCRIPT = /usr/local/bin DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT) INSTALLVENDORSCRIPT = /usr/bin DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT) INSTALLMAN1DIR = /usr/share/man/man1 DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR) INSTALLSITEMAN1DIR = /usr/local/share/man/man1 DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) INSTALLVENDORMAN1DIR = /usr/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/share/man/man3 DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) PERL_LIB = /usr/share/perl5 PERL_ARCHLIB = /usr/lib64/perl5 PERL_ARCHLIBDEP = /usr/lib64/perl5 LIBPERL_A = libperl.a FIRST_MAKEFILE = Makefile MAKEFILE_OLD = Makefile.old MAKE_APERL_FILE = Makefile.aperl PERLMAINCC = $(CC) PERL_INC = /usr/lib64/perl5/CORE PERL_INCDEP = /usr/lib64/perl5/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 = /usr/share/perl5/vendor_perl/ExtUtils/MakeMaker.pm MM_VERSION = 7.60 MM_REVISION = 76000 # 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 = Template/Toolkit/Simple BASEEXT = Simple PARENT_NAME = Template::Toolkit 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/Template/Toolkit/Simple.pod # Where is the Config information that we are using/depend on CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h # Where to build things INST_LIBDIR = $(INST_LIB)/Template/Toolkit INST_ARCHLIBDIR = $(INST_ARCHLIB)/Template/Toolkit 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_ARCHIVEDEP = PERL_ARCHIVE_AFTER = TO_INST_PM = lib/Template/Toolkit/Simple.pm \ lib/Template/Toolkit/Simple.pod # --- MakeMaker platform_constants section: MM_Unix_VERSION = 7.60 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)' -- CP_NONEMPTY = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'cp_nonempty' -- # --- 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 = $(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 = Template-Toolkit-Simple DISTVNAME = Template-Toolkit-Simple-0.31 # --- 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)"\ PASTHRU_DEFINE='$(DEFINE) $(PASTHRU_DEFINE)'\ PASTHRU_INC='$(INC) $(PASTHRU_INC)' # --- 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 pure_all subdirs clean_subdirs makemakerdflt manifypods realclean_subdirs subdirs_dynamic subdirs_pure_nolink subdirs_static subdirs-test_dynamic subdirs-test_static test_dynamic test_static # --- 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 :: dynamic $(NOECHO) $(NOOP) # --- MakeMaker dlsyms section: # --- MakeMaker dynamic_bs section: BOOTSTRAP = # --- MakeMaker dynamic section: dynamic :: $(FIRST_MAKEFILE) config $(INST_BOOT) $(INST_DYNAMIC) $(NOECHO) $(NOOP) # --- 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 config \ lib/Template/Toolkit/Simple.pod $(NOECHO) $(POD2MAN) --section=$(MAN3SECTION) --perm_rw=$(PERM_RW) -u \ lib/Template/Toolkit/Simple.pod $(INST_MAN3DIR)/Template::Toolkit::Simple.$(MAN3EXT) # --- MakeMaker processPL section: # --- MakeMaker installbin section: EXE_FILES = bin/tt-render pure_all :: $(INST_SCRIPT)/tt-render $(NOECHO) $(NOOP) realclean :: $(RM_F) \ $(INST_SCRIPT)/tt-render $(INST_SCRIPT)/tt-render : bin/tt-render $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(NOECHO) $(RM_F) $(INST_SCRIPT)/tt-render $(CP) bin/tt-render $(INST_SCRIPT)/tt-render $(FIXIN) $(INST_SCRIPT)/tt-render -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/tt-render # --- 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) \ $(BASEEXT).bso $(BASEEXT).def \ $(BASEEXT).exp $(BASEEXT).x \ $(BOOTSTRAP) $(INST_ARCHAUTODIR)/extralibs.all \ $(INST_ARCHAUTODIR)/extralibs.ld $(MAKE_APERL_FILE) \ *$(LIB_EXT) *$(OBJ_EXT) \ *perl.core MYMETA.json \ MYMETA.yml blibdirs.ts \ core core.*perl.*.? \ core.[0-9] core.[0-9][0-9] \ core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] \ core.[0-9][0-9][0-9][0-9][0-9] lib$(BASEEXT).def \ mon.out perl \ perl$(EXE_EXT) perl.exe \ perlmain.c pm_to_blib \ pm_to_blib.ts so_locations \ tmon.out - $(RM_RF) \ blib $(NOECHO) $(RM_F) $(MAKEFILE_OLD) - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) # --- MakeMaker realclean_subdirs section: # so clean is forced to complete before realclean_subdirs runs realclean_subdirs : clean $(NOECHO) $(NOOP) # --- MakeMaker realclean section: # Delete temporary files (via clean) and also delete dist files realclean purge :: realclean_subdirs - $(RM_F) \ $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - $(RM_RF) \ $(DISTVNAME) # --- MakeMaker metafile section: metafile : create_distdir $(NOECHO) $(ECHO) Generating META.yml $(NOECHO) $(ECHO) '---' > META_new.yml $(NOECHO) $(ECHO) 'abstract: '\''A Simple Interface to Template Toolkit'\''' >> META_new.yml $(NOECHO) $(ECHO) 'author:' >> META_new.yml $(NOECHO) $(ECHO) ' - '\''Ingy döt net <ingy@cpan.org>'\''' >> META_new.yml $(NOECHO) $(ECHO) 'build_requires:' >> META_new.yml $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: '\''0'\''' >> META_new.yml $(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: '\''6.30'\''' >> META_new.yml $(NOECHO) $(ECHO) 'dynamic_config: 1' >> META_new.yml $(NOECHO) $(ECHO) 'generated_by: '\''ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010'\''' >> META_new.yml $(NOECHO) $(ECHO) 'license: perl' >> 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) $(ECHO) 'name: Template-Toolkit-Simple' >> 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) 'requires:' >> META_new.yml $(NOECHO) $(ECHO) ' Template: '\''2.22'\''' >> META_new.yml $(NOECHO) $(ECHO) ' YAML::XS: '\''0.37'\''' >> META_new.yml $(NOECHO) $(ECHO) 'version: '\''0.31'\''' >> META_new.yml $(NOECHO) $(ECHO) 'x_serialization_backend: '\''CPAN::Meta::YAML version 0.018'\''' >> META_new.yml -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml $(NOECHO) $(ECHO) Generating META.json $(NOECHO) $(ECHO) '{' > META_new.json $(NOECHO) $(ECHO) ' "abstract" : "A Simple Interface to Template Toolkit",' >> META_new.json $(NOECHO) $(ECHO) ' "author" : [' >> META_new.json $(NOECHO) $(ECHO) ' "Ingy döt net <ingy@cpan.org>"' >> META_new.json $(NOECHO) $(ECHO) ' ],' >> META_new.json $(NOECHO) $(ECHO) ' "dynamic_config" : 1,' >> META_new.json $(NOECHO) $(ECHO) ' "generated_by" : "ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010",' >> META_new.json $(NOECHO) $(ECHO) ' "license" : [' >> META_new.json $(NOECHO) $(ECHO) ' "perl_5"' >> META_new.json $(NOECHO) $(ECHO) ' ],' >> META_new.json $(NOECHO) $(ECHO) ' "meta-spec" : {' >> META_new.json $(NOECHO) $(ECHO) ' "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",' >> META_new.json $(NOECHO) $(ECHO) ' "version" : 2' >> META_new.json $(NOECHO) $(ECHO) ' },' >> META_new.json $(NOECHO) $(ECHO) ' "name" : "Template-Toolkit-Simple",' >> META_new.json $(NOECHO) $(ECHO) ' "no_index" : {' >> META_new.json $(NOECHO) $(ECHO) ' "directory" : [' >> META_new.json $(NOECHO) $(ECHO) ' "t",' >> META_new.json $(NOECHO) $(ECHO) ' "inc"' >> META_new.json $(NOECHO) $(ECHO) ' ]' >> META_new.json $(NOECHO) $(ECHO) ' },' >> META_new.json $(NOECHO) $(ECHO) ' "prereqs" : {' >> META_new.json $(NOECHO) $(ECHO) ' "build" : {' >> META_new.json $(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json $(NOECHO) $(ECHO) ' "ExtUtils::MakeMaker" : "0"' >> META_new.json $(NOECHO) $(ECHO) ' }' >> META_new.json $(NOECHO) $(ECHO) ' },' >> META_new.json $(NOECHO) $(ECHO) ' "configure" : {' >> META_new.json $(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json $(NOECHO) $(ECHO) ' "ExtUtils::MakeMaker" : "6.30"' >> META_new.json $(NOECHO) $(ECHO) ' }' >> META_new.json $(NOECHO) $(ECHO) ' },' >> META_new.json $(NOECHO) $(ECHO) ' "runtime" : {' >> META_new.json $(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json $(NOECHO) $(ECHO) ' "Template" : "2.22",' >> META_new.json $(NOECHO) $(ECHO) ' "YAML::XS" : "0.37"' >> META_new.json $(NOECHO) $(ECHO) ' }' >> META_new.json $(NOECHO) $(ECHO) ' }' >> META_new.json $(NOECHO) $(ECHO) ' },' >> META_new.json $(NOECHO) $(ECHO) ' "release_status" : "stable",' >> META_new.json $(NOECHO) $(ECHO) ' "version" : "0.31",' >> META_new.json $(NOECHO) $(ECHO) ' "x_serialization_backend" : "JSON::PP version 4.06"' >> META_new.json $(NOECHO) $(ECHO) '}' >> META_new.json -$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json # --- 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 $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu' $(DISTVNAME).tar$(SUFFIX) : distdir $(PREOP) $(TO_UNIX) $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(COMPRESS) $(DISTVNAME).tar $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)' $(POSTOP) zipdist : $(DISTVNAME).zip $(NOECHO) $(NOOP) $(DISTVNAME).zip : distdir $(PREOP) $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip' $(POSTOP) shdist : distdir $(PREOP) $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar $(RM_RF) $(DISTVNAME) $(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar' $(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 : $(ABSPERLRUN) -MExtUtils::Manifest=maniread -e '@all = sort keys %{ maniread() };' \ -e 'print(qq{Executing $(CI) @all\n});' \ -e 'system(qq{$(CI) @all}) == 0 or die $$!;' \ -e 'print(qq{Executing $(RCS_LABEL) ...\n});' \ -e 'system(qq{$(RCS_LABEL) @all}) == 0 or die $$!;' -- # --- MakeMaker distmeta section: distmeta : create_distdir metafile $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -e q{META.yml};' \ -e 'eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) }' \ -e ' or die "Could not add META.yml to MANIFEST: $${'\''@'\''}"' -- $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -f q{META.json};' \ -e 'eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) }' \ -e ' or die "Could not add META.json to MANIFEST: $${'\''@'\''}"' -- # --- MakeMaker distsignature section: distsignature : distmeta $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }' \ -e ' or die "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}"' -- $(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_PERLINC = "-Iblib/arch" "-Iblib/lib" "-I/usr/lib64/perl5" "-I/usr/share/perl5" $(MAP_TARGET) :: $(MAKE_APERL_FILE) $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ $(MAKE_APERL_FILE) : static $(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) $(NOECHO) $(NOOP) test :: $(TEST_TYPE) $(NOECHO) $(NOOP) # Occasionally we may face this degenerate target: test_ : test_dynamic $(NOECHO) $(NOOP) subdirs-test_dynamic :: dynamic pure_all test_dynamic :: subdirs-test_dynamic PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) testdb_dynamic :: dynamic pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) subdirs-test_static :: static pure_all test_static :: subdirs-test_static PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) testdb_static :: static pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) # --- MakeMaker ppd section: # Creates a PPD (Perl Package Description) for a binary distribution. ppd : $(NOECHO) $(ECHO) '<SOFTPKG NAME="Template-Toolkit-Simple" VERSION="0.31">' > Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <ABSTRACT>A Simple Interface to Template Toolkit</ABSTRACT>' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <AUTHOR>Ingy döt net <ingy@cpan.org></AUTHOR>' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <REQUIRE NAME="Template::" VERSION="2.22" />' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <REQUIRE NAME="YAML::XS" VERSION="0.37" />' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="x86_64-linux-thread-multi-5.32" />' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' <CODEBASE HREF="" />' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) ' </IMPLEMENTATION>' >> Template-Toolkit-Simple.ppd $(NOECHO) $(ECHO) '</SOFTPKG>' >> Template-Toolkit-Simple.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/Template/Toolkit/Simple.pm' 'blib/lib/Template/Toolkit/Simple.pm' \ 'lib/Template/Toolkit/Simple.pod' 'blib/lib/Template/Toolkit/Simple.pod' $(NOECHO) $(TOUCH) pm_to_blib # --- MakeMaker selfdocument section: # here so even if top_targets is overridden, these will still be defined # gmake will silently still work if any are .PHONY-ed but nmake won't static :: $(NOECHO) $(NOOP) dynamic :: $(NOECHO) $(NOOP) config :: $(NOECHO) $(NOOP) # --- MakeMaker postamble section: # End. PK ��[�RT�� � META.jsonnu �[��� { "abstract" : "A Simple Interface to Template Toolkit", "author" : [ "Ingy döt net <ingy@cpan.org>" ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Template-Toolkit-Simple", "no_index" : { "directory" : [ "inc", "t", "xt", "example" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "recommends" : { "JSON::XS" : "0", "XML::Simple" : "0" }, "requires" : { "Template" : "2.22", "YAML::XS" : "0.37", "perl" : "v5.8.1" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/ingydotnet/template-toolkit-simple-pm/issues" }, "homepage" : "https://github.com/ingydotnet/template-toolkit-simple-pm", "repository" : { "type" : "git", "url" : "https://github.com/ingydotnet/template-toolkit-simple-pm.git", "web" : "https://github.com/ingydotnet/template-toolkit-simple-pm" } }, "version" : "0.31" } PK ��[Ԯs�G �G LICENSEnu �[��� This software is copyright (c) 2014 by Ingy döt net. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Ingy döt net. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) 19yy <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Ingy döt net. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End PK ��[��\� � t/render_xml.tnu �[��� use lib 'inc'; { use Test::More; eval "use XML::Simple; 1" or plan skip_all => 'XML::Simple required'; } use TestML; TestML->new( testml => do { local $/; <DATA> }, bridge => 'main', )->run; { package main; use base 'TestML::Bridge'; use TestML::Util; use Template::Toolkit::Simple; sub render_template { my ($self, $context) = @_; my $t = -d 't' ? 't' : 'test'; return str tt ->post_chomp ->path("$t/template") ->data("$t/render.xml") ->render($context->value); } } __DATA__ %TestML 0.1.0 Plan = 1; *template.render_template == *result; === Simple Render --- template: letter.tt --- result Hi Löver, Have a nice day. Smööches, Ingy PK ��[X�� t/render.yamlnu �[��� name: Löver PK ��[�!<S t/render.jsonnu �[��� { "name" : "Löver" } PK ��[�D�'. . t/release-pod-syntax.tnu �[��� #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); PK ��[ϵ�� � t/000-compile-modules.tnu �[��� # This test does a basic `use` check on all the code. use Test::More; use File::Find; sub test { s{^lib/(.*)\.pm$}{$1} or return; s{/}{::}g; use_ok $_; } find { wanted => \&test, no_chdir => 1, }, 'lib'; done_testing; PK ��[�@�s t/template/signature.ttnu �[��� Smööches, Ingy PK ��[5��%= = t/template/letter.ttnu �[��� Hi [% name %], Have a nice day. [% PROCESS signature.tt %] PK ��[]-<� � t/render_json.tnu �[��� use lib 'inc'; { use Test::More; eval "use JSON::XS; 1" or plan skip_all => 'JSON::XS required'; } use TestML; TestML->new( testml => do { local $/; <DATA> }, bridge => 'main', )->run; { package main; use base 'TestML::Bridge'; use TestML::Util; use Template::Toolkit::Simple; sub render_template { my ($self, $context) = @_; my $t = -d 't' ? 't' : 'test'; return str tt ->post_chomp ->path("$t/template") ->data("$t/render.json") ->render($context->value); } } __DATA__ %TestML 0.1.0 Plan = 1; *template.render_template == *result; === Simple Render --- template: letter.tt --- result Hi Löver, Have a nice day. Smööches, Ingy PK ��[p�[�� � t/render_yaml.tnu �[��� use lib 'inc'; use TestML; TestML->new( testml => do { local $/; <DATA> }, bridge => 'main', )->run; { package main; use base 'TestML::Bridge'; use TestML::Util; use Template::Toolkit::Simple; sub render_template { my ($self, $context) = @_; my $t = -d 't' ? 't' : 'test'; return str tt ->post_chomp ->path("$t/template") ->data("$t/render.yaml") ->render($context->value); } } __DATA__ %TestML 0.1.0 Plan = 1; *template.render_template == *result; === Simple Render --- template: letter.tt --- result Hi Löver, Have a nice day. Smööches, Ingy PK ��[V�# # t/render.xmlnu �[��� <xml> <name>Löver</name> </xml> PK ��[a�sB t/cli.tnu �[��� use lib 'inc'; use TestML; TestML->new( testml => do { local $/; <DATA> }, bridge => 'main', )->run; { package main; use base 'TestML::Bridge'; use TestML::Util; sub run_command { my ($self, $command) = @_; $command = $command->value; if (-d 'test') { $command =~ s/\bt\b/test/g; } open my $execution, "$^X bin/$command |" or die "Couldn't open subprocess: $!\n"; local $/; my $output = <$execution>; close $execution; return str $output; } sub expected { return str <<'...'; Hi Löver, Have a nice day. Smööches, Ingy ... } } __DATA__ %TestML 0.1.0 Plan = 3; *command.Chomp.run_command == expected(); === Render --- command tt-render --post-chomp --data=t/render.yaml --path=t/template/ letter.tt === Render with path//template --- command tt-render --post-chomp --data=t/render.yaml t/template//letter.tt === Options abbreviated --- command tt-render --post-c --d=t/render.yaml -I t/template/ letter.tt PK ��[Cy�Y Y CONTRIBUTINGnu �[��� Contributing ============ The "Template-Toolkit-Simple" Project needs your help! Please consider being a contributor. This file contains instructions that will help you be an effective contributor to the Project. GitHub ------ The code for this Project is hosted at GitHub. The URL is: https://github.com/ingydotnet/template-toolkit-simple-pm You can get the code with this command: git clone https://github.com/ingydotnet/template-toolkit-simple-pm If you've found a bug or a missing feature that you would like the author to know about, report it here: https://github.com/ingydotnet/template-toolkit-simple-pm/issues or fix it and submit a pull request here: https://github.com/ingydotnet/template-toolkit-simple-pm/pulls See these links for help on interacting with GitHub: * https://help.github.com/ * https://help.github.com/articles/creating-a-pull-request Zilla::Dist ----------- This Project uses Zilla::Dist to prepare it for publishing to CPAN. Read: https://metacpan.org/pod/Zilla::Dist::Contributing for up-to-date instructions on what contributors like yourself need to know to use it. IRC --- Template-Toolkit-Simple has an IRC channel where you can find real people to help you: irc.freenode.net#pkg Join the channel. Join the team! Thanks in advance, Ingy döt net # This file generated by Zilla-Dist-0.0.174 PK ��[�:�k: : META.ymlnu �[��� --- abstract: 'A Simple Interface to Template Toolkit' author: - 'Ingy döt net <ingy@cpan.org>' build_requires: {} configure_requires: ExtUtils::MakeMaker: '6.30' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Template-Toolkit-Simple no_index: directory: - inc - t - xt - example recommends: JSON::XS: '0' XML::Simple: '0' requires: Template: '2.22' YAML::XS: '0.37' perl: v5.8.1 resources: bugtracker: https://github.com/ingydotnet/template-toolkit-simple-pm/issues homepage: https://github.com/ingydotnet/template-toolkit-simple-pm repository: https://github.com/ingydotnet/template-toolkit-simple-pm.git version: '0.31' PK ��[�\�� � inc/Pegex.pmnu �[��� use strict; use warnings; package Pegex; our $VERSION = '0.57'; use Pegex::Parser; use Exporter 'import'; our @EXPORT = 'pegex'; sub pegex { my ($grammar, $receiver) = @_; die "Argument 'grammar' required in function 'pegex'" unless $grammar; if (not ref $grammar or $grammar->isa('Pegex::Input')) { require Pegex::Grammar; $grammar = Pegex::Grammar->new(text => $grammar), } if (not defined $receiver) { require Pegex::Tree::Wrap; $receiver = Pegex::Tree::Wrap->new; } elsif (not ref $receiver) { eval "require $receiver; 1"; $receiver = $receiver->new; } return Pegex::Parser->new( grammar => $grammar, receiver => $receiver, ); } 1; PK ��[����7 7 inc/Pegex/Tree.pmnu �[��� package Pegex::Tree; use Pegex::Base; extends 'Pegex::Receiver'; sub gotrule { my $self = shift; @_ || return (); return {$self->{parser}{rule} => $_[0]} if $self->{parser}{parent}{-wrap}; return $_[0]; } sub final { my $self = shift; return(shift) if @_; return []; } 1; PK ��[��؈� � inc/Pegex/Parser.pmnu �[��� package Pegex::Parser; use Pegex::Base; use Pegex::Input; use Pegex::Optimizer; use Scalar::Util; has grammar => (required => 1); has receiver => (); has input => (); has debug => ( exists($ENV{PERL_PEGEX_DEBUG}) ? $ENV{PERL_PEGEX_DEBUG} : defined($Pegex::Parser::Debug) ? $Pegex::Parser::Debug : 0 ); sub BUILD { my ($self) = @_; $self->{throw_on_error} ||= 1; # $self->{rule} = undef; # $self->{parent} = undef; # $self->{error} = undef; # $self->{position} = undef; # $self->{farthest} = undef; } # XXX Add an optional $position argument. Default to 0. This is the position # to start parsing. Set position and farthest below to this value. Allows for # sub-parsing. Need to somehow return the finishing position of a subparse. # Maybe this all goes in a subparse() method. sub parse { my ($self, $input, $start) = @_; $start =~ s/-/_/g if $start; $self->{position} = 0; $self->{farthest} = 0; $self->{input} = (not ref $input) ? Pegex::Input->new(string => $input) : $input; $self->{input}->open unless $self->{input}{_is_open}; $self->{buffer} = $self->{input}->read; die "No 'grammar'. Can't parse" unless $self->{grammar}; $self->{grammar}{tree} ||= $self->{grammar}->make_tree; my $start_rule_ref = $start || $self->{grammar}{tree}{'+toprule'} || $self->{grammar}{tree}{'TOP'} & 'TOP' or die "No starting rule for Pegex::Parser::parse"; die "No 'receiver'. Can't parse" unless $self->{receiver}; my $optimizer = Pegex::Optimizer->new( parser => $self, grammar => $self->{grammar}, receiver => $self->{receiver}, ); $optimizer->optimize_grammar($start_rule_ref); # Add circular ref and weaken it. $self->{receiver}{parser} = $self; Scalar::Util::weaken($self->{receiver}{parser}); if ($self->{receiver}->can("initial")) { $self->{rule} = $start_rule_ref; $self->{parent} = {}; $self->{receiver}->initial(); } my $match = $self->debug ? do { my $method = $optimizer->make_trace_wrapper(\&match_ref); $self->$method($start_rule_ref, {'+asr' => 0}); } : $self->match_ref($start_rule_ref, {}); $self->{input}->close; if (not $match or $self->{position} < length ${$self->{buffer}}) { $self->throw_error("Parse document failed for some reason"); return; # In case $self->throw_on_error is off } if ($self->{receiver}->can("final")) { $self->{rule} = $start_rule_ref; $self->{parent} = {}; $match = [ $self->{receiver}->final(@$match) ]; } $match->[0]; } sub match_next { my ($self, $next) = @_; my ($rule, $method, $kind, $min, $max, $assertion) = @{$next}{'rule', 'method', 'kind', '+min', '+max', '+asr'}; my ($position, $match, $count) = ($self->{position}, [], 0); while (my $return = $method->($self, $rule, $next)) { $position = $self->{position} unless $assertion; $count++; push @$match, @$return; last if $max == 1; } if (not $count and $min == 0 and $kind eq 'all') { $match = [[]]; } if ($max != 1) { if ($next->{-flat}) { $match = [ map { (ref($_) eq 'ARRAY') ? (@$_) : ($_) } @$match ]; } else { $match = [$match] } $self->{farthest} = $position if ($self->{position} = $position) > $self->{farthest}; } my $result = ($count >= $min and (not $max or $count <= $max)) ^ ($assertion == -1); if (not($result) or $assertion) { $self->{farthest} = $position if ($self->{position} = $position) > $self->{farthest}; } ($result ? $next->{'-skip'} ? [] : $match : 0); } sub match_rule { my ($self, $position, $match) = (@_, []); $self->{position} = $position; $self->{farthest} = $position if $position > $self->{farthest}; $match = [ $match ] if @$match > 1; my ($ref, $parent) = @{$self}{'rule', 'parent'}; my $rule = $self->{grammar}{tree}{$ref} or die "No rule defined for '$ref'"; [ $rule->{action}->($self->{receiver}, @$match) ]; } sub match_ref { my ($self, $ref, $parent) = @_; my $rule = $self->{grammar}{tree}{$ref} or die "No rule defined for '$ref'"; my $match = $self->match_next($rule) or return; return $Pegex::Constant::Dummy unless $rule->{action}; @{$self}{'rule', 'parent'} = ($ref, $parent); # XXX Possible API mismatch. # Not sure if we should "splat" the $match. [ $rule->{action}->($self->{receiver}, @$match) ]; } sub match_rgx { my ($self, $regexp) = @_; my $buffer = $self->{buffer}; pos($$buffer) = $self->{position}; $$buffer =~ /$regexp/g or return; $self->{position} = pos($$buffer); $self->{farthest} = $self->{position} if $self->{position} > $self->{farthest}; no strict 'refs'; my $captures = [ map $$_, 1..$#+ ]; $captures = [ $captures ] if $#+ > 1; return $captures; } sub match_all { my ($self, $list) = @_; my $position = $self->{position}; my $set = []; my $len = 0; for my $elem (@$list) { if (my $match = $self->match_next($elem)) { if (not ($elem->{'+asr'} or $elem->{'-skip'})) { push @$set, @$match; $len++; } } else { $self->{farthest} = $position if ($self->{position} = $position) > $self->{farthest}; return; } } $set = [ $set ] if $len > 1; return $set; } sub match_any { my ($self, $list) = @_; for my $elem (@$list) { if (my $match = $self->match_next($elem)) { return $match; } } return; } sub match_err { my ($self, $error) = @_; $self->throw_error($error); } sub trace { my ($self, $action) = @_; my $indent = ($action =~ /^try_/) ? 1 : 0; $self->{indent} ||= 0; $self->{indent}-- unless $indent; print STDERR ' ' x $self->{indent}; $self->{indent}++ if $indent; my $snippet = substr(${$self->{buffer}}, $self->{position}); $snippet = substr($snippet, 0, 30) . "..." if length $snippet > 30; $snippet =~ s/\n/\\n/g; print STDERR sprintf("%-30s", $action) . ($indent ? " >$snippet<\n" : "\n"); } sub throw_error { my ($self, $msg) = @_; $@ = $self->{error} = $self->format_error($msg); return undef unless $self->{throw_on_error}; require Carp; Carp::croak($self->{error}); } sub format_error { my ($self, $msg) = @_; my $buffer = $self->{buffer}; my $position = $self->{farthest}; my $real_pos = $self->{position}; my $line = @{[substr($$buffer, 0, $position) =~ /(\n)/g]} + 1; my $column = $position - rindex($$buffer, "\n", $position); my $pretext = substr( $$buffer, $position < 50 ? 0 : $position - 50, $position < 50 ? $position : 50 ); my $context = substr($$buffer, $position, 50); $pretext =~ s/.*\n//gs; $context =~ s/\n/\\n/g; return <<"..."; Error parsing Pegex document: msg: $msg line: $line column: $column context: $pretext$context ${\ (' ' x (length($pretext) + 10) . '^')} position: $position ($real_pos pre-lookahead) ... } # TODO Move this to a Parser helper role/subclass sub line_column { my ($self, $position) = @_; $position ||= $self->{position}; my $buffer = $self->{buffer}; my $line = @{[substr($$buffer, 0, $position) =~ /(\n)/g]} + 1; my $column = $position - rindex($$buffer, "\n", $position); return [$line, $position]; } # XXX Need to figure out what uses this. (sample.t) { package Pegex::Constant; our $Null = []; our $Dummy = []; } 1; PK ��[{ۣ��6 �6 inc/Pegex/Bootstrap.pmnu �[��� package Pegex::Bootstrap; use Pegex::Base; extends 'Pegex::Compiler'; use Pegex::Grammar::Atoms; use Pegex::Pegex::AST; use Carp qw(carp confess croak); #------------------------------------------------------------------------------ # The grammar. A DSL data structure. Things with '=' are tokens. #------------------------------------------------------------------------------ has pointer => 0; has groups => []; has tokens => []; has ast => {}; has stack => []; has tree => {}; has grammar => { 'grammar' => [ '=pegex-start', 'meta-section', 'rule-section', '=pegex-end', ], 'meta-section' => 'meta-directive*', 'meta-directive' => [ '=directive-start', '=directive-value', '=directive-end', ], 'rule-section' => 'rule-definition*', 'rule-definition' => [ '=rule-start', '=rule-sep', 'rule-group', '=rule-end', ], 'rule-group' => 'any-group', 'any-group' => [ '=list-alt?', 'all-group', [ '=list-alt', 'all-group', '*', ], ], 'all-group' => 'rule-part+', 'rule-part' => [ 'rule-item', [ '=list-sep', 'rule-item', '?', ], ], 'rule-item' => [ '|', '=rule-reference', '=quoted-regex', 'regular-expression', 'bracketed-group', 'whitespace-token', '=error-message', ], 'regular-expression' => [ '=regex-start', '=!regex-end*', '=regex-end', ], 'bracketed-group' => [ '=group-start', 'rule-group', '=group-end', ], 'whitespace-token' => [ '|', '=whitespace-maybe', '=whitespace-must', ], }; #------------------------------------------------------------------------------ # Parser logic: #------------------------------------------------------------------------------ sub parse { my ($self, $grammar_text) = @_; $self->lex($grammar_text); # YYY $self->{tokens}; $self->{pointer} = 0; $self->{farthest} = 0; $self->{tree} = {}; $self->match_ref('grammar') || do { my $far = $self->{farthest}; my $tokens = $self->{tokens}; $far -= 4 if $far >= 4; WWW splice @$tokens, $far, 9; die "Bootstrap parse failed"; }; # XXX $self->{tree}; return $self; } sub match_next { my ($self, $next) = @_; my $method; if (ref $next) { $next = [@$next]; if ($next->[0] eq '|') { shift @$next; $method = 'match_any'; } else { $method = 'match_all'; } if ($next->[-1] =~ /^[\?\*\+]$/) { my $quant = pop @$next; return $self->match_times($quant, $method => $next); } else { return $self->$method($next); } } else { $method = ($next =~ s/^=//) ? 'match_token' : 'match_ref'; if ($next =~ s/([\?\*\+])$//) { return $self->match_times($1, $method => $next); } else { return $self->$method($next); } } } sub match_times { my ($self, $quantity, $method, @args) = @_; my ($min, $max) = $quantity eq '' ? (1, 1) : $quantity eq '?' ? (0, 1) : $quantity eq '*' ? (0, 0) : $quantity eq '+' ? (1, 0) : die "Bad quantity '$quantity'"; my $stop = $max || 9999; my $count = 0; my $pointer = $self->{pointer}; while ($stop-- and $self->$method(@args)) { $count++; } return 1 if $count >= $min and (not $max or $count <= $max); $self->{pointer} = $pointer; $self->{farthest} = $pointer if $pointer > $self->{farthest}; return; } sub match_any { my ($self, $any) = @_; my $pointer = $self->{pointer}; for (@$any) { if ($self->match_next($_)) { return 1; } } $self->{pointer} = $pointer; $self->{farthest} = $pointer if $pointer > $self->{farthest}; return; } sub match_all { my ($self, $all) = @_; my $pointer = $self->{pointer}; for (@$all) { if (not $self->match_next($_)) { $self->{pointer} = $pointer; $self->{farthest} = $pointer if $pointer > $self->{farthest}; return; } } return 1; } sub match_ref { my ($self, $ref) = @_; my $rule = $self->{grammar}->{$ref} or Carp::confess "Not a rule reference: '$ref'"; $self->match_next($rule); } sub match_token { my ($self, $token_want) = @_; my $not = ($token_want =~ s/^\!//) ? 1 : 0; return if $self->{pointer} >= @{$self->{tokens}}; my $token = $self->{tokens}[$self->{pointer}]; my $token_got = $token->[0]; if (($token_want eq $token_got) xor $not) { $token_got =~ s/-/_/g; my $method = "got_$token_got"; if ($self->can($method)) { # print "$method\n"; $self->$method($token); } $self->{pointer}++; return 1; } return; } #------------------------------------------------------------------------------ # Receiver/ast-generator methods: #------------------------------------------------------------------------------ sub got_directive_start { my ($self, $token) = @_; $self->{directive_name} = $token->[1]; } sub got_directive_value { my ($self, $token) = @_; my $value = $token->[1]; $value =~ s/\s+$//; my $name = $self->{directive_name}; if (my $old_value = $self->{tree}{"+$name"}) { if (not ref($old_value)) { $old_value = $self->{tree}{"+$name"} = [$old_value]; } push @$old_value, $value; } else { $self->{tree}{"+$name"} = $value; } } sub got_rule_start { my ($self, $token) = @_; $self->{stack} = []; my $rule_name = $token->[1]; $rule_name =~ s/-/_/g; $self->{rule_name} = $rule_name; $self->{tree}{'+toprule'} ||= $rule_name; $self->{groups} = [[0, ':']]; } sub got_rule_end { my ($self) = @_; $self->{tree}{$self->{rule_name}} = $self->group_ast; } sub got_group_start { my ($self, $token) = @_; push @{$self->{groups}}, [scalar(@{$self->{stack}}), $token->[1]]; } sub got_group_end { my ($self, $token) = @_; my $rule = $self->group_ast; Pegex::Pegex::AST::set_quantity($rule, $token->[1]); push @{$self->{stack}}, $rule; } sub got_list_alt { my ($self) = @_; push @{$self->{stack}}, '|'; } sub got_list_sep { my ($self, $token) = @_; push @{$self->{stack}}, $token->[1]; } sub got_rule_reference { my ($self, $token) = @_; my $name = $token->[2]; $name =~ s/-/_/g; $name =~ s/^<(.*)>$/$1/; my $rule = { '.ref' => $name }; Pegex::Pegex::AST::set_modifier($rule, $token->[1]); Pegex::Pegex::AST::set_quantity($rule, $token->[3]); push @{$self->{stack}}, $rule; } sub got_error_message { my ($self, $token) = @_; push @{$self->{stack}}, { '.err' => $token->[1] }; } sub got_whitespace_maybe { my ($self) = @_; $self->got_rule_reference(['whitespace-maybe', undef, '_', undef]); } sub got_whitespace_must { my ($self) = @_; $self->got_rule_reference(['whitespace-maybe', undef, '__', undef]); } sub got_quoted_regex { my ($self, $token) = @_; my $regex = $token->[1]; $regex =~ s/([^\w\`\%\:\<\/\,\=\;])/\\$1/g; push @{$self->{stack}}, { '.rgx' => $regex }; } sub got_regex_start { my ($self) = @_; push @{$self->{groups}}, [scalar(@{$self->{stack}}), '/']; } sub got_regex_end { my ($self) = @_; my $regex = join '', map { if (ref($_)) { my $part; if (defined($part = $_->{'.rgx'})) { $part; } elsif (defined($part = $_->{'.ref'})) { "<$part>"; } else { XXX $_; } } else { $_; } } splice(@{$self->{stack}}, (pop @{$self->{groups}})->[0]); $regex =~ s!\(([ism]?\:|\=|\!)!(?$1!g; push @{$self->{stack}}, {'.rgx' => $regex}; } sub got_regex_raw { my ($self, $token) = @_; push @{$self->{stack}}, $token->[1]; } #------------------------------------------------------------------------------ # Receiver helper methods: #------------------------------------------------------------------------------ sub group_ast { my ($self) = @_; my ($offset, $gmod) = @{pop @{$self->{groups}}}; $gmod ||= ''; my $rule = [splice(@{$self->{stack}}, $offset)]; for (my $i = 0; $i < @$rule-1; $i++) { if ($rule->[$i + 1] =~ /^%%?$/) { $rule->[$i] = Pegex::Pegex::AST::set_separator( $rule->[$i], splice @$rule, $i+1, 2 ); } } my $started = 0; for ( my $i = (@$rule and $rule->[0] eq '|') ? 1 : 0; $i < @$rule-1; $i++ ) { next if $rule->[$i] eq '|'; if ($rule->[$i+1] eq '|') { $i++; $started = 0; } else { $rule->[$i] = {'.all' => [$rule->[$i]]} unless $started++; push @{$rule->[$i]{'.all'}}, splice @$rule, $i+1, 1; $i-- } } if (grep {$_ eq '|'} @$rule) { $rule = [{'.any' => [ grep {$_ ne '|'} @$rule ]}]; } $rule = $rule->[0] if @$rule <= 1; Pegex::Pegex::AST::set_modifier($rule, $gmod) unless $gmod eq ':'; return $rule; } # DEBUG: wrap/trace parse methods: # for my $method (qw( # match_times match_next match_ref match_token match_any match_all # )) { # no strict 'refs'; # no warnings 'redefine'; # my $orig = \&$method; # *$method = sub { # my $self = shift; # my $args = join ', ', map { # ref($_) ? '[' . join(', ', @$_) . ']' : # length($_) ? $_ : "''" # } @_; # print "$method($args)\n"; # die if $main::x++ > 250; # $orig->($self, @_); # }; # } #------------------------------------------------------------------------------ # Lexer logic: #------------------------------------------------------------------------------ my $ALPHA = 'A-Za-z'; my $DIGIT = '0-9'; my $DASH = '\-'; my $SEMI = '\;'; my $UNDER = '\_'; my $HASH = '\#'; my $EOL = '\r?\n'; my $WORD = "$DASH$UNDER$ALPHA$DIGIT"; my $WS = "(?:[\ \t]|$HASH.*$EOL)"; my $MOD = '[\!\=\-\+\.]'; my $GMOD = '[\.\-]'; my $QUANT = '(?:[\?\*\+]|\d+(?:\+|\-\d+)?)'; my $NAME = "$UNDER?[$UNDER$ALPHA](?:[$WORD]*[$ALPHA$DIGIT])?"; # Repeated Rules: my $rem = [qr/\A(?:$WS+|$EOL+)/]; my $qr = [qr/\A\'((?:\\.|[^\'])*)\'/, 'quoted-regex']; # Lexer regex tree: has regexes => { pegex => [ [qr/\A%(grammar|version|extends|include)$WS+/, 'directive-start', 'directive'], [qr/\A($NAME)(?=$WS*\:)/, 'rule-start', 'rule'], $rem, [qr/\A\z/, 'pegex-end', 'end'], ], rule => [ [qr/\A(?:$SEMI$WS*$EOL?|\s*$EOL|)(?=$NAME$WS*\:|\z)/, 'rule-end', 'end'], [qr/\A\:/, 'rule-sep'], [qr/\A(?:\+|\~\~)(?=\s)/, 'whitespace-must'], [qr/\A(?:\-|\~)(?=\s)/, 'whitespace-maybe'], $qr, [qr/\A($MOD)?($NAME|<$NAME>)($QUANT)?(?!$WS*$NAME\:)/, 'rule-reference'], [qr/\A\//, 'regex-start', 'regex'], [qr/\A\`([^\`\n]*?)\`/, 'error-message'], [qr/\A($GMOD)?\(/, 'group-start'], [qr/\A\)($QUANT)?/, 'group-end'], [qr/\A\|/, 'list-alt'], [qr/\A(\%\%?)/, 'list-sep'], $rem, ], directive => [ [qr/\A(\S.*)/, 'directive-value'], [qr/\A$EOL/, 'directive-end', 'end'] ], regex => [ [qr/\A$WS+(?:\+|\~\~|\-\-)/, 'whitespace-must'], [qr/\A(?:\-|~)(?![-~])/, 'whitespace-maybe'], $qr, [qr/\A$WS+()($NAME|<$NAME>)/, 'rule-reference'], [qr/\A([^\s\'\/]+)/, 'regex-raw'], [qr/\A$WS+/], [qr/\A$EOL+/], [qr/\A\//, 'regex-end', 'end'], $rem, ], }; sub lex { my ($self, $grammar) = @_; my $tokens = $self->{tokens} = [['pegex-start']]; my $stack = ['pegex']; my $pos = 0; OUTER: while (1) { my $state = $stack->[-1]; my $set = $self->{regexes}->{$state} or die "Invalid state '$state'"; for my $entry (@$set) { my ($regex, $name, $scope) = @$entry; if (substr($grammar, $pos) =~ $regex) { $pos += length($&); if ($name) { no strict 'refs'; my @captures = map $$_, 1..$#+; pop @captures while @captures and not defined $captures[-1]; push @$tokens, [$name, @captures]; if ($scope) { if ($scope eq 'end') { pop @$stack; } else { push @$stack, $scope; # Hack to support /+ â¦/ if ($scope eq 'regex') { if (substr($grammar, $pos) =~ /\A\+(?=[\s\/])/) { $pos += length($&); push @$tokens, ['whitespace-must']; } } } } } last OUTER unless @$stack; next OUTER; } } my $text = substr($grammar, $pos, 50); $text =~ s/\n/\\n/g; WWW $tokens; die <<"..."; Failed to lex $state here-->$text ... } } 1; # vim: set lisp: PK ��[�ZT�� � inc/Pegex/Receiver.pmnu �[��� package Pegex::Receiver; use Pegex::Base; has parser => (); # The parser object. sub rule { $_[0]->{parser}{rule} } # Flatten a structure of nested arrays into a single array in place. sub flatten { my ($self, $array, $times) = @_; $times = -1 unless defined $times; while ($times-- and grep {ref($_) eq 'ARRAY'} @$array) { @$array = map { (ref($_) eq 'ARRAY') ? @$_ : $_ } @$array; } return $array; } 1; PK ��[��� � inc/Pegex/Compiler.pmnu �[��� package Pegex::Compiler; use Pegex::Base; use Pegex::Parser; use Pegex::Pegex::Grammar; use Pegex::Pegex::AST; use Pegex::Grammar::Atoms; has tree => (); sub compile { my ($self, $grammar, @rules) = @_; # Global request to use the Pegex bootstrap compiler if ($Pegex::Bootstrap) { require Pegex::Bootstrap; $self = Pegex::Bootstrap->new; } @rules = map { s/-/_/g; $_ } @rules; $self->parse($grammar); $self->combinate(@rules); $self->native; return $self; } sub parse { my ($self, $input) = @_; my $parser = Pegex::Parser->new( grammar => Pegex::Pegex::Grammar->new, receiver => Pegex::Pegex::AST->new, ); $self->{tree} = $parser->parse($input); return $self; } #-----------------------------------------------------------------------------# # Combination #-----------------------------------------------------------------------------# has _tree => (); sub combinate { my ($self, @rule) = @_; if (not @rule) { if (my $rule = $self->{tree}->{'+toprule'}) { @rule = ($rule); } else { return $self; } } $self->{_tree} = { map {($_, $self->{tree}->{$_})} grep { /^\+/ } keys %{$self->{tree}} }; for my $rule (@rule) { $self->combinate_rule($rule); } $self->{tree} = $self->{_tree}; delete $self->{_tree}; return $self; } sub combinate_rule { my ($self, $rule) = @_; return if exists $self->{_tree}->{$rule}; my $object = $self->{_tree}->{$rule} = $self->{tree}->{$rule}; $self->combinate_object($object); } sub combinate_object { my ($self, $object) = @_; if (exists $object->{'.rgx'}) { $self->combinate_re($object); } elsif (exists $object->{'.ref'}) { my $rule = $object->{'.ref'}; if (exists $self->{tree}{$rule}) { $self->combinate_rule($rule); } else { if (my $regex = (Pegex::Grammar::Atoms::atoms)->{$rule}) { $self->{tree}{$rule} = { '.rgx' => $regex }; $self->combinate_rule($rule); } } } elsif (exists $object->{'.any'}) { for my $elem (@{$object->{'.any'}}) { $self->combinate_object($elem); } } elsif (exists $object->{'.all' }) { for my $elem (@{$object->{'.all'}}) { $self->combinate_object($elem); } } elsif (exists $object->{'.err' }) { } else { require YAML::XS; die "Can't combinate:\n" . YAML::XS::Dump($object); } } sub combinate_re { my ($self, $regexp) = @_; my $atoms = Pegex::Grammar::Atoms->atoms; my $re = $regexp->{'.rgx'}; while (1) { $re =~ s[(?<!\\)(~+)]['<ws' . length($1) . '>']ge; $re =~ s[<([\w\-]+)>][ (my $key = $1) =~ s/-/_/g; $self->{tree}->{$key} and ( $self->{tree}->{$key}{'.rgx'} or die "'$key' not defined as a single RE" ) or $atoms->{$key} or die "'$key' not defined in the grammar" ]e; last if $re eq $regexp->{'.rgx'}; $regexp->{'.rgx'} = $re; } } #-----------------------------------------------------------------------------# # Compile to native Perl regexes #-----------------------------------------------------------------------------# sub native { my ($self) = @_; $self->perl_regexes($self->{tree}); return $self; } sub perl_regexes { my ($self, $node) = @_; if (ref($node) eq 'HASH') { if (exists $node->{'.rgx'}) { my $re = $node->{'.rgx'}; $node->{'.rgx'} = qr/\G$re/; } else { for (keys %$node) { $self->perl_regexes($node->{$_}); } } } elsif (ref($node) eq 'ARRAY') { $self->perl_regexes($_) for @$node; } } #-----------------------------------------------------------------------------# # Serialization formatter methods #-----------------------------------------------------------------------------# sub to_yaml { require YAML::XS; my $self = shift; return YAML::XS::Dump($self->tree); } sub to_json { require JSON::XS; my $self = shift; return JSON::XS->new->utf8->canonical->pretty->encode($self->tree); } sub to_perl { my $self = shift; require Data::Dumper; no warnings 'once'; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; my $perl = Data::Dumper::Dumper($self->tree); $perl =~ s/\?\^:/?-xism:/g; $perl =~ s!(\.rgx.*?qr/)\(\?-xism:(.*)\)(?=/)!$1$2!g; die "to_perl failed with non compatible regex in:\n$perl" if $perl =~ /\?\^/; return $perl; } 1; PK ��[�lyF: : inc/Pegex/Optimizer.pmnu �[��� package Pegex::Optimizer; use Pegex::Base; has parser => (required => 1); has grammar => (required => 1); has receiver => (required => 1); sub optimize_grammar { my ($self, $start) = @_; my $tree = $self->grammar->{tree}; return if $tree->{'+optimized'}; $self->set_max_parse if $self->parser->{maxparse}; $self->{extra} = {}; while (my ($name, $node) = each %$tree) { next unless ref($node); $self->optimize_node($node); } $self->optimize_node({'.ref' => $start}); my $extra = delete $self->{extra}; for my $key (%$extra) { $tree->{$key} = $extra->{$key}; } $tree->{'+optimized'} = 1; } sub optimize_node { my ($self, $node) = @_; my ($min, $max) = @{$node}{'+min', '+max'}; $node->{'+min'} = defined($max) ? 0 : 1 unless defined $node->{'+min'}; $node->{'+max'} = defined($min) ? 0 : 1 unless defined $node->{'+max'}; $node->{'+asr'} = 0 unless defined $node->{'+asr'}; for my $kind (qw(ref rgx all any err code xxx)) { return if $kind eq 'xxx'; if ($node->{rule} = $node->{".$kind"}) { delete $node->{".$kind"}; $node->{kind} = $kind; if ($kind eq 'ref') { my $rule = $node->{rule} or die; if (my $method = $self->grammar->can("rule_$rule")) { $node->{method} = $self->make_method_wrapper($method); } elsif (not $self->grammar->{tree}{$rule}) { if (my $method = $self->grammar->can("$rule")) { warn <<"..."; Warning: You have a method called '$rule' in your grammar. It should probably be called 'rule_$rule'. ... } die "No rule '$rule' defined in grammar"; } } $node->{method} ||= $self->parser->can("match_$kind") or die; last; } } if ($node->{kind} =~ /^(?:all|any)$/) { $self->optimize_node($_) for @{$node->{rule}}; } elsif ($node->{kind} eq 'ref') { my $ref = $node->{rule}; my $rule = $self->grammar->{tree}{$ref}; $rule ||= $self->{extra}{$ref} = {}; if (my $action = $self->receiver->can("got_$ref")) { $rule->{action} = $action; } elsif (my $gotrule = $self->receiver->can("gotrule")) { $rule->{action} = $gotrule; } if ($self->parser->{debug}) { $node->{method} = $self->make_trace_wrapper($node->{method}); } } elsif ($node->{kind} eq 'rgx') { # XXX $node; } } sub make_method_wrapper { my ($self, $method) = @_; return sub { my ($parser, $ref, $parent) = @_; @{$parser}{'rule', 'parent'} = ($ref, $parent); $method->( $parser->{grammar}, $parser, $parser->{buffer}, $parser->{position}, ); } } sub make_trace_wrapper { my ($self, $method) = @_; return sub { my ($self, $ref, $parent) = @_; my $asr = $parent->{'+asr'}; my $note = $asr == -1 ? '(!)' : $asr == 1 ? '(=)' : ''; $self->trace("try_$ref$note"); my $result; if ($result = $self->$method($ref, $parent)) { $self->trace("got_$ref$note"); } else { $self->trace("not_$ref$note"); } return $result; } } sub set_max_parse { require Pegex::Parser; my ($self) = @_; my $maxparse = $self->parser->{maxparse}; no warnings 'redefine'; my $method = \&Pegex::Parser::match_ref; my $counter = 0; *Pegex::Parser::match_ref = sub { die "Maximum parsing rules reached ($maxparse)\n" if $counter++ >= $maxparse; my $self = shift; $self->$method(@_); }; } 1; PK ��[D��# # inc/Pegex/Input.pmnu �[��� package Pegex::Input; use Pegex::Base; has string => (); has stringref => (); has file => (); has handle => (); has _buffer => (); has _is_eof => 0; has _is_open => 0; has _is_close => 0; # NOTE: Current implementation reads entire input into _buffer on open(). sub read { my ($self) = @_; die "Attempted Pegex::Input::read before open" if not $self->{_is_open}; die "Attempted Pegex::Input::read after EOF" if $self->{_is_eof}; my $buffer = $self->{_buffer}; $self->{_buffer} = undef; $self->{_is_eof} = 1; return $buffer; } sub open { my ($self) = @_; die "Attempted to reopen Pegex::Input object" if $self->{_is_open} or $self->{_is_close}; if (my $ref = $self->{stringref}) { $self->{_buffer} = $ref; } elsif (my $handle = $self->{handle}) { $self->{_buffer} = \ do { local $/; <$handle> }; } elsif (my $path = $self->{file}) { open my $handle, $path or die "Pegex::Input can't open $path for input:\n$!"; $self->{_buffer} = \ do { local $/; <$handle> }; } elsif (exists $self->{string}) { $self->{_buffer} = \$self->{string}; } else { die "Pegex::Input::open failed. No source to open"; } $self->{_is_open} = 1; return $self; } sub close { my ($self) = @_; die "Attempted to close an unopen Pegex::Input object" if $self->{_is_close}; close $self->{handle} if $self->{handle}; $self->{_is_open} = 0; $self->{_is_close} = 1; $self->{_buffer} = undef; return $self; } 1; PK ��[�υ inc/Pegex/Base.pmnu �[��� package Pegex::Base; # use Mo qw'build default builder xxx import nonlazy required'; # The following line of code was produced from the previous line by # Mo::Inline version 0.39 no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{my$c=shift;my$s=bless{@_},$c;my%n=%{$c.'::'.':E'};map{$s->{$_}=$n{$_}->()if!exists$s->{$_}}keys%n;$s};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};@_=(default,@_)if!($#_%2);$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'build::e'}=sub{my($P,$e)=@_;$e->{new}=sub{$c=shift;my$s=&{$M.Object::new}($c,@_);my@B;do{@B=($c.::BUILD,@B)}while($c)=@{$c.::ISA};exists&$_&&&$_($s)for@B;$s}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;exists$a{default}or return$m;my($d,$r)=$a{default};my$g='HASH'eq($r=ref$d)?sub{+{%$d}}:'ARRAY'eq$r?sub{[@$d]}:'CODE'eq$r?$d:sub{$d};my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=$g and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$g->(@_):$m->(@_)}}};*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_;my$b=$a{builder}or return$m;my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=\&{$P.$b}and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$_[0]->$b:$m->(@_)}}};use constant XXX_skip=>1;my$dm='YAML::XS';*{$M.'xxx::e'}=sub{my($P,$e)=@_;$e->{WWW}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::WWW(@_)};$e->{XXX}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::XXX(@_)};$e->{YYY}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::YYY(@_)};$e->{ZZZ}=sub{require XXX;local$XXX::DumpModule=$dm}};my$i=\&import;*{$M.import}=sub{(@_==2 and not$_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};*{$M.'nonlazy::e'}=sub{${shift().':N'}=1};*{$M.'required::e'}=sub{my($P,$e,$o)=@_;$o->{required}=sub{my($m,$n,%a)=@_;if($a{required}){my$C=*{$P."new"}{CODE}||*{$M.Object::new}{CODE};no warnings 'redefine';*{$P."new"}=sub{my$s=$C->(@_);my%a=@_[1..$#_];die$n." required"if!exists$a{$n};$s}}$m}};@f=qw[build default builder xxx import nonlazy required];use strict;use warnings; our $DumpModule = 'YAML'; 1; PK ��[�Z�� inc/Pegex/Grammar.pmnu �[��� package Pegex::Grammar; use Pegex::Base; # Grammar can be in text or tree form. Tree will be compiled from text. # Grammar can also be stored in a file. has file => (); has text => ( builder => 'make_text', lazy => 1, ); has tree => ( builder => 'make_tree', lazy => 1, ); has start_rules => []; sub make_text { my ($self) = @_; my $filename = $self->file or return ''; open TEXT, $filename or die "Can't open '$filename' for input\n:$!"; return do {local $/; <TEXT>} } sub make_tree { my ($self) = @_; my $text = $self->text or die "Can't create a '" . ref($self) . "' grammar. No tree or text or file."; require Pegex::Compiler; return Pegex::Compiler->new->compile( $text, @{$self->start_rules || []} )->tree; } # This import is to support: perl -MPegex::Grammar::Module=compile sub import { my ($package) = @_; if (((caller))[1] =~ /^-e?$/ and @_ == 2 and $_[1] eq 'compile') { $package->compile_into_module(); exit; } if (my $env = $ENV{PERL_PEGEX_AUTO_COMPILE}) { my %modules = map {($_, 1)} split ',', $env; if ($modules{$package}) { if (my $grammar_file = $package->file) { if (-f $grammar_file) { my $module = $package; $module =~ s!::!/!g; $module .= '.pm'; my $module_file = $INC{$module}; if (-M $grammar_file < -M $module_file) { $package->compile_into_module(); local $SIG{__WARN__}; delete $INC{$module}; require $module; } } } } } } sub compile_into_module { my ($package) = @_; my $grammar_file = $package->file; open GRAMMAR, $grammar_file or die "Can't open $grammar_file for input"; my $grammar_text = do {local $/; <GRAMMAR>}; close GRAMMAR; my $module = $package; $module =~ s!::!/!g; $module = "$module.pm"; my $file = $INC{$module} or return; my $perl; my @rules; if ($package->can('start_rules')) { @rules = @{$package->start_rules || []}; } if ($module eq 'Pegex/Pegex/Grammar.pm') { require Pegex::Bootstrap; $perl = Pegex::Bootstrap->new->compile($grammar_text, @rules)->to_perl; } else { require Pegex::Compiler; $perl = Pegex::Compiler->new->compile($grammar_text, @rules)->to_perl; } open IN, $file or die $!; my $module_text = do {local $/; <IN>}; require Pegex; my $msg = " # Generated/Inlined by Pegex::Grammar ($Pegex::VERSION)"; close IN; $perl =~ s/^/ /gm; $module_text =~ s/^(sub\s+make_tree\s*\{).*?(^\})/$1$msg\n$perl$2/ms; $module_text =~ s/^(sub\s+tree\s*\{).*?(^\})/$1$msg\n$perl$2/ms; chomp $grammar_text; $grammar_text = "<<'...';\n$grammar_text\n...\n"; $module_text =~ s/^(sub\s+text\s*\{).*?(^\})/$1$msg\n$grammar_text$2/ms; $grammar_text =~ s/^/# /gm; $module_text =~ s/^(# sub\s+text\s*\{).*?(^# \})/$1$msg\n$grammar_text$2/ms; open OUT, '>', $file or die $!; print OUT $module_text; close OUT; print "Compiled '$grammar_file' into '$file'.\n"; } 1; PK ��[uA� inc/TestML/Library/Debug.pmnu �[��� package TestML::Library::Debug; use TestML::Base; extends 'TestML::Library'; no warnings 'redefine'; sub WWW { require XXX; local $XXX::DumpModule = $TestML::DumpModule; XXX::WWW(shift->value); } sub XXX { require XXX; local $XXX::DumpModule = $TestML::DumpModule; XXX::XXX(shift->value); } sub YYY { require XXX; local $XXX::DumpModule = $TestML::DumpModule; XXX::YYY(shift->value); } sub ZZZ { require XXX; local $XXX::DumpModule = $TestML::DumpModule; XXX::ZZZ(shift->value); } 1; PK ��[�� inc/TestML/Library/Standard.pmnu �[��� package TestML::Library::Standard; use TestML::Base; extends 'TestML::Library'; use TestML::Util; sub Get { my ($self, $key) = @_; return $self->runtime->function->getvar($key->str->value); } # sub Set { # my ($self, $key, $value) = @_; # return $self->runtime->function->setvar($key, $value); # } sub GetLabel { my ($self) = @_; return str($self->runtime->get_label); } sub Type { my ($self, $var) = @_; return str($var->type); } sub Catch { my ($self) = @_; my $error = $self->runtime->error or die "Catch called but no TestML error found"; $error =~ s/ at .* line \d+\.\n\z//; $self->runtime->{error} = undef; return str($error); } sub Throw { my ($self, $msg) = @_; die $msg->value; } sub Str { my ($self, $object) = @_; return str($object->str->value); } # sub Num { # my ($self, $object) = @_; # return num($object->num->value); # } # sub Bool { # my ($self, $object) = @_; # return bool($object->bool->value); # } sub List { my $self = shift; return list([@_]); } sub Join { my ($self, $list, $separator) = @_; $separator = $separator ? $separator->value : ''; my @strings = map $_->value, @{$list->list->value}; return str join $separator, @strings; } sub Not { my ($self, $bool) = @_; return bool($bool->bool->value ? 0: 1); } sub Text { my ($self, $lines) = @_; my $value = $lines->list->value; return str(join $/, map($_->value, @$value), ''); } sub Count { my ($self, $list) = @_; return num scalar @{$list->list->value}; } sub Lines { my ($self, $text) = @_; return list([ map str($_), split /\n/, $text->value ]); } sub Reverse { my ($self, $list) = @_; my $value = $list->list->value; return list([ reverse @$value ]); } sub Sort { my ($self, $list) = @_; my $value = $list->list->value; return list([ sort { $a->value cmp $b->value } @$value ]); } sub Strip { my ($self, $string, $part) = @_; $string = $string->str->value; $part = $part->str->value; if ((my $i = index($string, $part)) >= 0) { $string = substr($string, 0, $i) . substr($string, $i + length($part)); } return str $string; } sub Print { my ($self, $string) = @_; print STDOUT $string->value; return bool(1); } sub Chomp { my ($self, $string) = @_; my $value = $string->str->value; chomp($value); return str $value; } 1; # sub Has { # my ($self, $string, $part) = @_; # $string = $string->str->value; # $part = $part->str->value; # return bool(index($string, $part) >= 0); # } # sub RunCommand { # require Capture::Tiny; # my ($self, $command) = @_; # $command = $command->value; # chomp($command); # my $sub = sub { # system($command); # }; # my ($stdout, $stderr) = Capture::Tiny::capture($sub); # $self->runtime->function->setvar('_Stdout', $stdout); # $self->runtime->function->setvar('_Stderr', $stderr); # return str(''); # } # sub RmPath { # require File::Path; # my ($self, $path) = @_; # $path = $path->value; # File::Path::rmtree($path); # return str(''); # } # sub Stdout { # my ($self) = @_; # return $self->runtime->function->getvar('_Stdout'); # } # sub Stderr { # my ($self) = @_; # return $self->runtime->function->getvar('_Stderr'); # } # sub Chdir { # my ($self, $dir) = @_; # $dir = $dir->value; # chdir $dir; # return str(''); # } # sub Read { # my ($self, $file) = @_; # $file = $file->value; # use Cwd; # open FILE, $file or die "Can't open $file for input in " . Cwd::cwd; # my $text = do { local $/; <FILE> }; # close FILE; # return str($text); # } # sub Pass { # my ($self, @args) = @_; # return @args; # } # sub Raw { # my $self = shift; # my $point = $self->point # or die "Raw called but there is no point"; # return $self->runtime->block->points->{$point}; # } # sub Point { # my ($self, $name) = @_; # $name = $name->value; # $self->runtime->get_point($name); # } PK ��[`��{ { inc/TestML/Compiler/Lite.pmnu �[��� package TestML::Compiler::Lite; use TestML::Base; extends 'TestML::Compiler'; use TestML::Runtime; has input => (); has points => (); has tokens => (); has function => (); my $WS = qr!\s+!; my $ANY = qr!.!; my $STAR = qr!\*!; my $NUM = qr!-?[0-9]+!; my $WORD = qr!\w+!; my $HASH = qr!#!; my $EQ = qr!=!; my $TILDE = qr!~!; my $LP = qr!\(!; my $RP = qr!\)!; my $DOT = qr!\.!; my $COMMA = qr!,!; my $SEMI = qr!;!; my $SSTR = qr!'(?:[^']*)'!; my $DSTR = qr!"(?:[^"]*)"!; my $ENDING = qr!(?:$RP|$COMMA|$SEMI)!; my $POINT = qr!$STAR$WORD!; my $QSTR = qr!(?:$SSTR|$DSTR)!; my $COMP = qr!(?:$EQ$EQ|$TILDE$TILDE)!; my $OPER = qr!(?:$COMP|$EQ)!; my $PUNCT = qr!(?:$LP|$RP|$DOT|$COMMA|$SEMI)!; my $TOKENS = qr!(?:$POINT|$NUM|$WORD|$QSTR|$PUNCT|$OPER)!; sub compile_code { my ($self) = @_; $self->{function} = TestML::Function->new; while (length $self->{code}) { $self->{code} =~ s{^(.*)(\r\n|\n|)}{}; $self->{line} = $1; $self->tokenize; next if $self->done; $self->parse_assignment || $self->parse_assertion || $self->fail; } } sub tokenize { my ($self) = @_; $self->{tokens} = []; while (length $self->{line}) { next if $self->{line} =~ s/^$WS//; next if $self->{line} =~ s/^$HASH$ANY*//; if ($self->{line} =~ s/^($TOKENS)//) { push @{$self->{tokens}}, $1; } else { $self->fail("Failed to get token here: '$self->{line}'"); } } } sub parse_assignment { my ($self) = @_; return unless $self->peek(2) eq '='; my ($var, $op) = $self->pop(2); my $expr = $self->parse_expression; $self->pop if not $self->done and $self->peek eq ';'; $self->fail unless $self->done; push @{$self->function->statements}, TestML::Assignment->new(name => $var, expr => $expr); return 1; } sub parse_assertion { my ($self) = @_; return unless grep /^$COMP$/, @{$self->tokens}; $self->{points} = []; my $left = $self->parse_expression; my $token = $self->pop; my $op = $token eq '==' ? 'EQ' : $token eq '~~' ? 'HAS' : $self->fail; my $right = $self->parse_expression; $self->pop if not $self->done and $self->peek eq ';'; $self->fail unless $self->done; push @{$self->function->statements}, TestML::Statement->new( expr => $left, assert => TestML::Assertion->new( name => $op, expr => $right, ), @{$self->points} ? (points => $self->points) : (), ); return 1; } sub parse_expression { my ($self) = @_; my $calls = []; while (not $self->done and $self->peek !~ /^($ENDING|$COMP)$/) { my $token = $self->pop; if ($token =~ /^$NUM$/) { push @$calls, TestML::Num->new(value => $token + 0); } elsif ($token =~/^$QSTR$/) { my $str = substr($token, 1, length($token) - 2); push @$calls, TestML::Str->new(value => $str); } elsif ($token =~ /^$WORD$/) { my $call = TestML::Call->new(name => $token); if (not $self->done and $self->peek eq '(') { $call->{args} = $self->parse_args; } push @$calls, $call; } elsif ($token =~ /^$POINT$/) { $token =~ /($WORD)/ or die; push @{$self->{points}}, $1; push @$calls, TestML::Point->new(name => $1); } else { $self->fail("Unknown token '$token'"); } if (not $self->done and $self->peek eq '.') { $self->pop; } } return @$calls == 1 ? $calls->[0] : TestML::Expression->new(calls => $calls); } sub parse_args { my ($self) = @_; $self->pop eq '(' or die; my $args = []; while ($self->peek ne ')') { push @$args, $self->parse_expression; $self->pop if $self->peek eq ','; } $self->pop; return $args; } sub compile_data { my ($self) = @_; my $input = $self->data; $input =~ s/^#.*\n/\n/mg; $input =~ s/^\\//mg; my @blocks = grep $_, split /(^===.*?(?=^===|\z))/ms, $input; for my $block (@blocks) { $block =~ s/\n+\z/\n/; } my $data = []; for my $string_block (@blocks) { my $block = TestML::Block->new; $string_block =~ s/^===\ +(.*?)\ *\n//g or die "No block label! $string_block"; $block->{label} = $1; while (length $string_block) { next if $string_block =~ s/^\n+//; my ($key, $value); if ($string_block =~ s/\A---\ +(\w+):\ +(.*)\n//g or $string_block =~ s/\A---\ +(\w+)\n(.*?)(?=^---|\z)//msg ) { ($key, $value) = ($1, $2); } else { die "Failed to parse TestML string:\n$string_block"; } $block->{points} ||= {}; $block->{points}{$key} = $value; if ($key =~ /^(ONLY|SKIP|LAST)$/) { $block->{$key} = 1; } } push @$data, $block; } $self->function->{data} = $data if @$data; } sub done { my ($self) = @_; @{$self->{tokens}} ? 0 : 1 } sub peek { my ($self, $index) = @_; $index ||= 1; die if $index > @{$self->{tokens}}; $self->{tokens}->[$index - 1]; } sub pop { my ($self, $count) = @_; $count ||= 1; die if $count > @{$self->{tokens}}; splice @{$self->{tokens}}, 0, $count; } sub fail { my ($self, $message) = @_; my $text = "Failed to compile TestML document.\n"; $text .= "Reason: $message\n" if $message; $text .= "\nCode section of failure:\n$self->{line}\n$self->{code}\n"; die $text; } 1; PK ��[1�#� inc/TestML/Compiler/Pegex.pmnu �[��� package TestML::Compiler::Pegex; use TestML::Base; extends 'TestML::Compiler'; use TestML::Compiler::Pegex::Grammar; use TestML::Compiler::Pegex::AST; use Pegex::Parser; has parser => (); sub compile_code { my ($self) = @_; $self->{parser} = Pegex::Parser->new( grammar => TestML::Compiler::Pegex::Grammar->new, receiver => TestML::Compiler::Pegex::AST->new, ); $self->fixup_grammar; $self->parser->parse($self->code, 'code_section') or die "Parse TestML code section failed"; } sub compile_data { my ($self) = @_; if (length $self->data) { $self->parser->parse($self->data, 'data_section') or die "Parse TestML data section failed"; } $self->{function} = $self->parser->receiver->function; } # TODO This can be moved to the AST some day. sub fixup_grammar { my ($self) = @_; my $tree = $self->{parser}->grammar->tree; my $point_lines = $tree->{point_lines}{'.rgx'}; my $block_marker = $self->directives->{BlockMarker}; if ($block_marker) { $block_marker =~ s/([\$\%\^\*\+\?\|])/\\$1/g; $tree->{block_marker}{'.rgx'} = qr/\G$block_marker/; $point_lines =~ s/===/$block_marker/; } my $point_marker = $self->directives->{PointMarker}; if ($point_marker) { $point_marker =~ s/([\$\%\^\*\+\?\|])/\\$1/g; $tree->{point_marker}{'.rgx'} = qr/\G$point_marker/; $point_lines =~ s/\\-\\-\\-/$point_marker/; } $tree->{point_lines}{'.rgx'} = qr/$point_lines/; } 1; PK ��[��]�� � inc/TestML/Compiler/Pegex/AST.pmnu �[��� package TestML::Compiler::Pegex::AST; use TestML::Base; extends 'Pegex::Tree'; use TestML::Runtime; has points => []; has function => sub { TestML::Function->new }; # sub final { # my ($self, $match, $top) = @_; # XXX $match; # } # __END__ sub got_code_section { my ($self, $code) = @_; $self->function->{statements} = $code; } sub got_assignment_statement { my ($self, $match) = @_; return TestML::Assignment->new( name => $match->[0], expr => $match->[1], ); } sub got_code_statement { my ($self, $list) = @_; my ($expression, $assertion); my $points = $self->points; $self->{points} = []; for (@$list) { if (ref eq 'TestML::Assertion') { $assertion = $_; } else { #if (ref eq 'TestML::Expression') { $expression = $_; } } return TestML::Statement->new( $expression ? ( expr => $expression ) : (), $assertion ? ( assert => $assertion ) : (), @$points ? ( points => $points ) : (), ); } sub got_code_expression { my ($self, $list) = @_; my $calls = []; push @$calls, shift @$list if @$list; $list = shift @$list || []; for (@$list) { my $call = $_->[0]; #->{call_call}[0][0]; push @$calls, $call; } return $calls->[0] if @$calls == 1; return TestML::Expression->new( calls => $calls, ); } sub got_string_object { my ($self, $string) = @_; return TestML::Str->new( value => $string, ); } sub got_double_quoted_string { my ($self, $string) = @_; $string =~ s/\\n/\n/g; return $string; } sub got_number_object { my ($self, $number) = @_; return TestML::Num->new( value => $number + 0, ); } sub got_point_object { my ($self, $point) = @_; $point =~ s/^\*// or die; push @{$self->points}, $point; return TestML::Point->new( name => $point, ); } sub got_assertion_call { my ($self, $call) = @_; # XXX $call strangley becomes an array when $PERL_PEGEX_DEBUG is on. # Workaround for now, until I figure it out. $call = $call->[0] if ref $call eq 'ARRAY'; my ($name, $expr); for (qw( eq has ok )) { if ($expr = $call->{"assertion_$_"}) { $name = uc $_; $expr = $expr->{"assertion_operator_$_"}[0] || $expr->{"assertion_function_$_"}[0]; last; } } return TestML::Assertion->new( name => $name, $expr ? (expr => $expr) : (), ); } sub got_assertion_function_ok { my ($self, $ok) = @_; return { assertion_function_ok => [], } } sub got_function_start { my ($self) = @_; my $function = TestML::Function->new; $function->outer($self->function); $self->{function} = $function; return 1; } sub got_function_object { my ($self, $object) = @_; my $function = $self->function; $self->{function} = $function->outer; if (ref($object->[0]) and ref($object->[0][0])) { $function->{signature} = $object->[0][0]; } $function->{statements} = $object->[-1]; return $function; } sub got_call_name { my ($self, $name) = @_; return TestML::Call->new(name => $name); } sub got_call_object { my ($self, $object) = @_; my $call = $object->[0]; my $args = $object->[1][-1]; if ($args) { $args = [ map { ($_->isa('TestML::Expression') and @{$_->calls} == 1 and ( $_->calls->[0]->isa('TestML::Point') || $_->calls->[0]->isa('TestML::Object') )) ? $_->calls->[0] : $_; } @$args ]; $call->args($args) } return $call; } sub got_call_argument_list { my ($self, $list) = @_; return $list; } sub got_call_indicator { my ($self) = @_; return; } sub got_data_section { my ($self, $data) = @_; $self->function->data($data); } sub got_data_block { my ($self, $block) = @_; return TestML::Block->new( label => $block->[0][0][0], points => +{map %$_, @{$block->[1]}}, ); } sub got_block_point { my ($self, $point) = @_; return { $point->[0] => $point->[1], }; } 1; PK ��[���a) a) $ inc/TestML/Compiler/Pegex/Grammar.pmnu �[��� package TestML::Compiler::Pegex::Grammar; use TestML::Base; extends 'Pegex::Grammar'; use constant file => '../testml-pgx/testml.pgx'; sub make_tree { # Generated/Inlined by Pegex::Grammar (0.43) { '+grammar' => 'testml', '+include' => 'atom', '+toprule' => 'testml_document', '+version' => '0.0.1', '__' => { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+/ }, 'assertion_call' => { '.any' => [ { '-wrap' => 1, '.ref' => 'assertion_eq' }, { '-wrap' => 1, '.ref' => 'assertion_ok' }, { '-wrap' => 1, '.ref' => 'assertion_has' } ] }, 'assertion_call_test' => { '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)(?:EQ|OK|HAS)/ }, 'assertion_eq' => { '.any' => [ { '-wrap' => 1, '.ref' => 'assertion_operator_eq' }, { '-wrap' => 1, '.ref' => 'assertion_function_eq' } ] }, 'assertion_function_eq' => { '.all' => [ { '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)EQ\(/ }, { '.ref' => 'code_expression' }, { '.rgx' => qr/\G\)/ } ] }, 'assertion_function_has' => { '.all' => [ { '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)HAS\(/ }, { '.ref' => 'code_expression' }, { '.rgx' => qr/\G\)/ } ] }, 'assertion_function_ok' => { '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)(OK)(?:\((?:[\ \t]|\r?\n|\#.*\r?\n)*\))?/ }, 'assertion_has' => { '.any' => [ { '-wrap' => 1, '.ref' => 'assertion_operator_has' }, { '-wrap' => 1, '.ref' => 'assertion_function_has' } ] }, 'assertion_ok' => { '.ref' => 'assertion_function_ok' }, 'assertion_operator_eq' => { '.all' => [ { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+==(?:[\ \t]|\r?\n|\#.*\r?\n)+/ }, { '.ref' => 'code_expression' } ] }, 'assertion_operator_has' => { '.all' => [ { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+\~\~(?:[\ \t]|\r?\n|\#.*\r?\n)+/ }, { '.ref' => 'code_expression' } ] }, 'assignment_statement' => { '.all' => [ { '.ref' => 'variable_name' }, { '.rgx' => qr/\G\s+=\s+/ }, { '.ref' => 'code_expression' }, { '.ref' => 'ending' } ] }, 'blank_line' => { '.rgx' => qr/\G[\ \t]*\r?\n/ }, 'blanks' => { '.rgx' => qr/\G[\ \t]+/ }, 'block_header' => { '.all' => [ { '.ref' => 'block_marker' }, { '+max' => 1, '.all' => [ { '.ref' => 'blanks' }, { '.ref' => 'block_label' } ] }, { '.ref' => 'blank_line' } ] }, 'block_label' => { '.ref' => 'unquoted_string' }, 'block_marker' => { '.rgx' => qr/\G===/ }, 'block_point' => { '.any' => [ { '.ref' => 'lines_point' }, { '.ref' => 'phrase_point' } ] }, 'call_argument' => { '.ref' => 'code_expression' }, 'call_argument_list' => { '.all' => [ { '.rgx' => qr/\G\((?:[\ \t]|\r?\n|\#.*\r?\n)*/ }, { '+max' => 1, '.all' => [ { '.ref' => 'call_argument' }, { '+min' => 0, '-flat' => 1, '.all' => [ { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*,(?:[\ \t]|\r?\n|\#.*\r?\n)*/ }, { '.ref' => 'call_argument' } ] } ] }, { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\)/ } ] }, 'call_call' => { '.all' => [ { '+asr' => -1, '.ref' => 'assertion_call_test' }, { '.ref' => 'call_indicator' }, { '.ref' => 'code_object' } ] }, 'call_indicator' => { '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)/ }, 'call_name' => { '.any' => [ { '.ref' => 'user_call' }, { '.ref' => 'core_call' } ] }, 'call_object' => { '.all' => [ { '.ref' => 'call_name' }, { '+max' => 1, '.ref' => 'call_argument_list' } ] }, 'code_expression' => { '.all' => [ { '.ref' => 'code_object' }, { '+min' => 0, '.ref' => 'call_call' } ] }, 'code_object' => { '.any' => [ { '.ref' => 'function_object' }, { '.ref' => 'point_object' }, { '.ref' => 'string_object' }, { '.ref' => 'number_object' }, { '.ref' => 'call_object' } ] }, 'code_section' => { '+min' => 0, '.any' => [ { '.ref' => '__' }, { '.ref' => 'assignment_statement' }, { '.ref' => 'code_statement' } ] }, 'code_statement' => { '.all' => [ { '.ref' => 'code_expression' }, { '+max' => 1, '.ref' => 'assertion_call' }, { '.ref' => 'ending' } ] }, 'comment' => { '.rgx' => qr/\G\#.*\r?\n/ }, 'core_call' => { '.rgx' => qr/\G([A-Z]\w*)/ }, 'data_block' => { '.all' => [ { '.ref' => 'block_header' }, { '+min' => 0, '-skip' => 1, '.any' => [ { '.ref' => 'blank_line' }, { '.ref' => 'comment' } ] }, { '+min' => 0, '.ref' => 'block_point' } ] }, 'data_section' => { '+min' => 0, '.ref' => 'data_block' }, 'double_quoted_string' => { '.rgx' => qr/\G(?:"((?:[^\n\\"]|\\"|\\\\|\\[0nt])*?)")/ }, 'ending' => { '.any' => [ { '.rgx' => qr/\G(?:;|\r?\n)/ }, { '+asr' => 1, '.ref' => 'ending2' } ] }, 'ending2' => { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\}/ }, 'function_object' => { '.all' => [ { '+max' => 1, '.ref' => 'function_signature' }, { '.ref' => 'function_start' }, { '+min' => 0, '.any' => [ { '.ref' => '__' }, { '.ref' => 'assignment_statement' }, { '.ref' => 'code_statement' } ] }, { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\}/ } ] }, 'function_signature' => { '.all' => [ { '.rgx' => qr/\G\((?:[\ \t]|\r?\n|\#.*\r?\n)*/ }, { '+max' => 1, '.ref' => 'function_variables' }, { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\)/ } ] }, 'function_start' => { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*(\{)(?:[\ \t]|\r?\n|\#.*\r?\n)*/ }, 'function_variable' => { '.rgx' => qr/\G([a-zA-Z]\w*)/ }, 'function_variables' => { '.all' => [ { '.ref' => 'function_variable' }, { '+min' => 0, '-flat' => 1, '.all' => [ { '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*,(?:[\ \t]|\r?\n|\#.*\r?\n)*/ }, { '.ref' => 'function_variable' } ] } ] }, 'lines_point' => { '.all' => [ { '.ref' => 'point_marker' }, { '.ref' => 'blanks' }, { '.ref' => 'point_name' }, { '.ref' => 'blank_line' }, { '.ref' => 'point_lines' } ] }, 'number' => { '.rgx' => qr/\G([0-9]+)/ }, 'number_object' => { '.ref' => 'number' }, 'phrase_point' => { '.all' => [ { '.ref' => 'point_marker' }, { '.ref' => 'blanks' }, { '.ref' => 'point_name' }, { '.rgx' => qr/\G:[\ \t]/ }, { '.ref' => 'point_phrase' }, { '.rgx' => qr/\G\r?\n/ }, { '.rgx' => qr/\G(?:\#.*\r?\n|[\ \t]*\r?\n)*/ } ] }, 'point_lines' => { '.rgx' => qr/\G((?:(?!(?:===|\-\-\-)\ \w).*\r?\n)*)/ }, 'point_marker' => { '.rgx' => qr/\G\-\-\-/ }, 'point_name' => { '.rgx' => qr/\G([a-z]\w*|[A-Z]\w*)/ }, 'point_object' => { '.rgx' => qr/\G(\*[a-z]\w*)/ }, 'point_phrase' => { '.ref' => 'unquoted_string' }, 'quoted_string' => { '.any' => [ { '.ref' => 'single_quoted_string' }, { '.ref' => 'double_quoted_string' } ] }, 'single_quoted_string' => { '.rgx' => qr/\G(?:'((?:[^\n\\']|\\'|\\\\)*?)')/ }, 'string_object' => { '.ref' => 'quoted_string' }, 'testml_document' => { '.all' => [ { '.ref' => 'code_section' }, { '+max' => 1, '.ref' => 'data_section' } ] }, 'unquoted_string' => { '.rgx' => qr/\G([^\ \t\n\#](?:[^\n\#]*[^\ \t\n\#])?)/ }, 'user_call' => { '.rgx' => qr/\G([a-z]\w*)/ }, 'variable_name' => { '.rgx' => qr/\G([a-zA-Z]\w*)/ } } } 1; PK ��[�Q��L L inc/TestML/Bridge.pmnu �[��� package TestML::Bridge; use TestML::Base; use TestML::Util 'runtime'; 1; PK ��[�a�� � inc/TestML/Util.pmnu �[��� use strict; use warnings; use TestML::Runtime; package TestML::Util; use Exporter 'import'; our @EXPORT = qw( runtime list str num bool none native ); sub runtime { $TestML::Runtime::Singleton } sub list { TestML::List->new(value => $_[0]) } sub str { TestML::Str->new(value => $_[0]) } sub num { TestML::Num->new(value => $_[0]) } sub bool { TestML::Bool->new(value => $_[0]) } sub none { TestML::None->new(value => $_[0]) } sub native { TestML::Native->new(value => $_[0]) } 1; PK ��[�"���1 �1 inc/TestML/Runtime.pmnu �[��� package TestML::Runtime; use TestML::Base; has testml => (); has bridge => (); has library => (); has compiler => (); has skip => (); has function => (); has error => (); has global => (); has base => (); sub BUILD { my ($self) = @_; $TestML::Runtime::Singleton = $self; $self->{base} ||= $0 =~ m!(.*)/! ? $1 : "."; } sub run { my ($self) = @_; $self->compile_testml; $self->initialize_runtime; $self->run_function($self->{function}, []); } # TODO Functions should have return values sub run_function { my ($self, $function, $args) = @_; $self->apply_signature($function, $args); my $parent = $self->function; $self->{function} = $function; for my $statement (@{$function->statements}) { if (ref($statement) eq 'TestML::Assignment') { $self->run_assignment($statement); } else { $self->run_statement($statement); } } $self->{function} = $parent; return; } sub apply_signature { my ($self, $function, $args) = @_; my $signature = $function->signature; die sprintf( "Function received %d args but expected %d", scalar(@$args), scalar(@$signature), ) if @$signature and @$args != @$signature; $function->setvar('Self', $function); for (my $i = 0; $i < @$signature; $i++) { my $arg = $args->[$i]; $arg = $self->run_expression($arg) if ref($arg) eq 'TestML::Expression'; $function->setvar($signature->[$i], $arg); } } sub run_statement { my ($self, $statement) = @_; my $blocks = $self->select_blocks($statement->points || []); for my $block (@$blocks) { $self->function->setvar('Block', $block) if $block != 1; my $result = $self->run_expression($statement->expr); if (my $assert = $statement->assert) { $self->run_assertion($result, $assert); } } } sub run_assignment { my ($self, $assignment) = @_; $self->function->setvar( $assignment->name, $self->run_expression($assignment->expr), ); } sub run_assertion { my ($self, $left, $assert) = @_; my $method = 'assert_' . $assert->name; $self->function->getvar('TestNumber')->{value}++; if ($assert->expr) { $self->$method($left, $self->run_expression($assert->expr)); } else { $self->$method($left); } } sub run_expression { my ($self, $expr) = @_; my $context = undef; $self->{error} = undef; if ($expr->isa('TestML::Expression')) { my @calls = @{$expr->calls}; die if @calls <= 1; $context = $self->run_call(shift(@calls)); for my $call (@calls) { if ($self->error) { next unless $call->isa('TestML::Call') and $call->name eq 'Catch'; } $context = $self->run_call($call, $context); } } else { $context = $self->run_call($expr); } if ($self->error) { die $self->error; } return $context; } sub run_call { my ($self, $call, $context) = @_; if ($call->isa('TestML::Object')) { return $call; } if ($call->isa('TestML::Function')) { return $call; } if ($call->isa('TestML::Point')) { return $self->get_point($call->name); } if ($call->isa('TestML::Call')) { my $name = $call->name; my $callable = $self->function->getvar($name) || $self->lookup_callable($name) || die "Can't locate '$name' callable"; if ($callable->isa('TestML::Object')) { return $callable; } return $callable unless $call->args or defined $context; $call->{args} ||= []; my $args = [map $self->run_expression($_), @{$call->args}]; unshift @$args, $context if $context; if ($callable->isa('TestML::Callable')) { my $value = eval { $callable->value->(@$args) }; if ($@) { $self->{error} = $@; return TestML::Error->new(value => $@); } die "'$name' did not return a TestML::Object object" unless UNIVERSAL::isa($value, 'TestML::Object'); return $value; } if ($callable->isa('TestML::Function')) { return $self->run_function($callable, $args); } die; } die; } sub lookup_callable { my ($self, $name) = @_; for my $library (@{$self->function->getvar('Library')->value}) { if ($library->can($name)) { my $function = sub { $library->$name(@_) }; my $callable = TestML::Callable->new(value => $function); $self->function->setvar($name, $callable); return $callable; } } return; } sub get_point { my ($self, $name) = @_; my $value = $self->function->getvar('Block')->{points}{$name}; defined $value or return; if ($value =~ s/\n+\z/\n/ and $value eq "\n") { $value = ''; } $value =~ s/^\\//gm; return TestML::Str->new(value => $value); } sub select_blocks { my ($self, $wanted) = @_; return [1] unless @$wanted; my $selected = []; OUTER: for my $block (@{$self->function->data}) { my %points = %{$block->points}; next if exists $points{SKIP}; if (exists $points{ONLY}) { for my $point (@$wanted) { return [] unless exists $points{$point}; } $selected = [$block]; last; } for my $point (@$wanted) { next OUTER unless exists $points{$point}; } push @$selected, $block; last if exists $points{LAST}; } return $selected; } sub compile_testml { my ($self) = @_; die "'testml' document required but not found" unless $self->testml; if ($self->testml !~ /\n/) { $self->testml =~ /(?:(.*)\/)?(.*)/ or die; $self->{testml} = $2; $self->{base} .= '/' . $1 if $1; $self->{testml} = $self->read_testml_file($self->testml); } $self->{function} = $self->compiler->new->compile($self->testml) or die "TestML document failed to compile"; } sub initialize_runtime { my ($self) = @_; $self->{global} = $self->function->outer; $self->{global}->setvar(Block => TestML::Block->new); $self->{global}->setvar(Label => TestML::Str->new(value => '$BlockLabel')); $self->{global}->setvar(True => $TestML::Constant::True); $self->{global}->setvar(False => $TestML::Constant::False); $self->{global}->setvar(None => $TestML::Constant::None); $self->{global}->setvar(TestNumber => TestML::Num->new(value => 0)); $self->{global}->setvar(Library => TestML::List->new); my $library = $self->function->getvar('Library'); for my $lib ($self->bridge, $self->library) { if (ref($lib) eq 'ARRAY') { $library->push($_->new) for @$lib; } else { $library->push($lib->new); } } } sub get_label { my ($self) = @_; my $label = $self->function->getvar('Label') or return; $label = $label->value or return; $label =~ s/\$(\w+)/$self->replace_label($1)/ge; return $label; } sub replace_label { my ($self, $var) = @_; my $block = $self->function->getvar('Block'); return $block->label if $var eq 'BlockLabel'; if (my $v = $block->points->{$var}) { $v =~ s/\n.*//s; $v =~ s/^\s*(.*?)\s*$/$1/; return $v; } if (my $v = $self->function->getvar($var)) { return $v->value; } } sub read_testml_file { my ($self, $file) = @_; my $path = $self->base . '/' . $file; open my $fh, $path or die "Can't open '$path' for input: $!"; local $/; return <$fh>; } #----------------------------------------------------------------------------- package TestML::Function; use TestML::Base; has type => 'Func'; # Functions are TestML typed objects has signature => []; # Input variable names has namespace => {}; # Lexical scoped variable stash has statements => []; # Exexcutable code statements has data => []; # Data section scoped to this function my $outer = {}; sub outer { @_ == 1 ? $outer->{$_[0]} : ($outer->{$_[0]} = $_[1]) } sub getvar { my ($self, $name) = @_; while ($self) { if (my $object = $self->namespace->{$name}) { return $object; } $self = $self->outer; } undef; } sub setvar { my ($self, $name, $value) = @_; $self->namespace->{$name} = $value; } sub forgetvar { my ($self, $name) = @_; delete $self->namespace->{$name}; } #----------------------------------------------------------------------------- package TestML::Assignment; use TestML::Base; has name => (); has expr => (); #----------------------------------------------------------------------------- package TestML::Statement; use TestML::Base; has expr => (); has assert => (); has points => (); #----------------------------------------------------------------------------- package TestML::Expression; use TestML::Base; has calls => []; #----------------------------------------------------------------------------- package TestML::Assertion; use TestML::Base; has name => (); has expr => (); #----------------------------------------------------------------------------- package TestML::Call; use TestML::Base; has name => (); has args => (); #----------------------------------------------------------------------------- package TestML::Callable; use TestML::Base; has value => (); #----------------------------------------------------------------------------- package TestML::Block; use TestML::Base; has label => ''; has points => {}; #----------------------------------------------------------------------------- package TestML::Point; use TestML::Base; has name => (); #----------------------------------------------------------------------------- package TestML::Object; use TestML::Base; has value => (); sub type { my $type = ref($_[0]); $type =~ s/^TestML::// or die "Can't find type of '$type'"; return $type; } sub str { die "Cast from ${\ $_[0]->type} to Str is not supported" } sub num { die "Cast from ${\ $_[0]->type} to Num is not supported" } sub bool { die "Cast from ${\ $_[0]->type} to Bool is not supported" } sub list { die "Cast from ${\ $_[0]->type} to List is not supported" } sub none { $TestML::Constant::None } #----------------------------------------------------------------------------- package TestML::Str; use TestML::Base; extends 'TestML::Object'; sub str { $_[0] } sub num { TestML::Num->new( value => ($_[0]->value =~ /^-?\d+(?:\.\d+)$/ ? ($_[0]->value + 0) : 0), )} sub bool { length($_[0]->value) ? $TestML::Constant::True : $TestML::Constant::False } sub list { TestML::List->new(value => [split //, $_[0]->value]) } #----------------------------------------------------------------------------- package TestML::Num; use TestML::Base; extends 'TestML::Object'; sub str { TestML::Str->new(value => $_[0]->value . "") } sub num { $_[0] } sub bool { ($_[0]->value != 0) ? $TestML::Constant::True : $TestML::Constant::False } sub list { my $list = []; $#{$list} = int($_[0]) -1; TestML::List->new(value =>$list); } #----------------------------------------------------------------------------- package TestML::Bool; use TestML::Base; extends 'TestML::Object'; sub str { TestML::Str->new(value => $_[0]->value ? "1" : "") } sub num { TestML::Num->new(value => $_[0]->value ? 1 : 0) } sub bool { $_[0] } #----------------------------------------------------------------------------- package TestML::List; use TestML::Base; extends 'TestML::Object'; has value => []; sub list { $_[0] } sub push { my ($self, $elem) = @_; push @{$self->value}, $elem; } #----------------------------------------------------------------------------- package TestML::None; use TestML::Base; extends 'TestML::Object'; sub str { TestML::Str->new(value => '') } sub num { TestML::Num->new(value => 0) } sub bool { $TestML::Constant::False } sub list { TestML::List->new(value => []) } #----------------------------------------------------------------------------- package TestML::Native; use TestML::Base; extends 'TestML::Object'; #----------------------------------------------------------------------------- package TestML::Error; use TestML::Base; extends 'TestML::Object'; #----------------------------------------------------------------------------- package TestML::Constant; our $True = TestML::Bool->new(value => 1); our $False = TestML::Bool->new(value => 0); our $None = TestML::None->new; 1; PK ��[B��=� � inc/TestML/Runtime/TAP.pmnu �[��� use Test::Builder; use TestML::Runtime; package TestML::Runtime::TAP; use TestML::Base; extends 'TestML::Runtime'; has tap_object => sub { Test::Builder->new }; has planned => 0; sub run { my ($self) = @_; $self->SUPER::run; $self->check_plan; $self->plan_end; } sub run_assertion { my ($self, @args) = @_; $self->check_plan; $self->SUPER::run_assertion(@args); } sub check_plan { my ($self) = @_; if (! $self->planned) { $self->title; $self->plan_begin; $self->{planned} = 1; } } sub title { my ($self) = @_; if (my $title = $self->function->getvar('Title')) { $title = $title->value; $title = "=== $title ===\n"; $self->tap_object->note($title); } } sub skip_test { my ($self, $reason) = @_; $self->tap_object->plan(skip_all => $reason); } sub plan_begin { my ($self) = @_; if (my $tests = $self->function->getvar('Plan')) { $self->tap_object->plan(tests => $tests->value); } } sub plan_end { my ($self) = @_; $self->tap_object->done_testing(); } # TODO Use Test::Diff here. sub assert_EQ { my ($self, $got, $want) = @_; $got = $got->str->value; $want = $want->str->value; if ($got ne $want and $want =~ /\n/) { my $block = $self->function->getvar('Block'); my $diff = $self->function->getvar('Diff'); if ($diff or exists $block->points->{DIFF}) { require Text::Diff; $self->tap_object->ok(0, $self->get_label); my $diff = Text::Diff::diff( \$want, \$got, { FILENAME_A => "want", FILENAME_B => "got", }, ); $self->tap_object->diag($diff); return; } } $self->tap_object->is_eq( $got, $want, $self->get_label, ); } sub assert_HAS { my ($self, $got, $has) = @_; $got = $got->str->value; $has = $has->str->value; my $assertion = (index($got, $has) >= 0); if (not $assertion) { my $msg = <<"..."; Failed TestML HAS (~~) assertion. This text: '$got' does not contain this string: '$has' ... $self->tap_object->diag($msg); } $self->tap_object->ok($assertion, $self->get_label); } sub assert_OK { my ($self, $got) = @_; $self->tap_object->ok( $got->bool->value, $self->get_label, ); } 1; PK ��[G� inc/TestML/Compiler.pmnu �[��� use TestML::Runtime; package TestML::Compiler; use TestML::Base; has code => (); has data => (); has text => (); has directives => (); has function => (); sub compile { my ($self, $input) = @_; $self->preprocess($input, 'top'); $self->compile_code; $self->compile_data; if ($self->directives->{DumpAST}) { XXX($self->function); } $self->function->namespace->{TestML} = $self->directives->{TestML}; $self->function->outer(TestML::Function->new); return $self->function; } sub preprocess { my ($self, $input, $top) = @_; my @parts = split /^((?:\%\w+.*|\#.*|\ *)\n)/m, $input; $input = ''; $self->{directives} = { TestML => '', DataMarker => '', BlockMarker => '===', PointMarker => '---', }; my $order_error = 0; for my $part (@parts) { next unless length($part); if ($part =~ /^(\#.*|\ *)\n/) { $input .= "\n"; next; } if ($part =~ /^%(\w+)\s*(.*?)\s*\n/) { my ($directive, $value) = ($1, $2); $input .= "\n"; if ($directive eq 'TestML') { die "Invalid TestML directive" unless $value =~ /^\d+\.\d+\.\d+$/; die "More than one TestML directive found" if $self->directives->{TestML}; $self->directives->{TestML} = TestML::Str->new(value => $value); next; } $order_error = 1 unless $self->directives->{TestML}; if ($directive eq 'Include') { my $runtime = $TestML::Runtime::Singleton or die "Can't process Include. No runtime available"; my $include = ref($self)->new; $include->preprocess($runtime->read_testml_file($value)); $input .= $include->text; $self->directives->{DataMarker} = $include->directives->{DataMarker}; $self->directives->{BlockMarker} = $include->directives->{BlockMarker}; $self->directives->{PointMarker} = $include->directives->{PointMarker}; die "Can't define %TestML in an Included file" if $include->directives->{TestML}; } elsif ($directive =~ /^(DataMarker|BlockMarker|PointMarker)$/) { $self->directives->{$directive} = $value; } elsif ($directive =~ /^(DebugPegex|DumpAST)$/) { $value = 1 unless length($value); $self->directives->{$directive} = $value; } else { die "Unknown TestML directive '$directive'"; } } else { $order_error = 1 if $input and not $self->directives->{TestML}; $input .= $part; } } if ($top) { die "No TestML directive found" unless $self->directives->{TestML}; die "%TestML directive must be the first (non-comment) statement" if $order_error; my $DataMarker = $self->directives->{DataMarker} ||= $self->directives->{BlockMarker}; if ((my $split = index($input, "\n$DataMarker")) >= 0) { $self->{code} = substr($input, 0, $split + 1); $self->{data} = substr($input, $split + 1); } else { $self->{code} = $input; $self->{data} = ''; } } else { $self->{text} = $input; } } 1; PK ��[C��t� � inc/TestML/Base.pmnu �[��� package TestML::Base; # use Mo qw'build default builder xxx import'; # The following line of code was produced from the previous line by # Mo::Inline version 0.38 no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{my$c=shift;my$s=bless{@_},$c;my%n=%{$c.::.':E'};map{$s->{$_}=$n{$_}->()if!exists$s->{$_}}keys%n;$s};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};@_=(default,@_)if!($#_%2);$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'build::e'}=sub{my($P,$e)=@_;$e->{new}=sub{$c=shift;my$s=&{$M.Object::new}($c,@_);my@B;do{@B=($c.::BUILD,@B)}while($c)=@{$c.::ISA};exists&$_&&&$_($s)for@B;$s}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;exists$a{default}or return$m;my($d,$r)=$a{default};my$g='HASH'eq($r=ref$d)?sub{+{%$d}}:'ARRAY'eq$r?sub{[@$d]}:'CODE'eq$r?$d:sub{$d};my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=$g and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$g->(@_):$m->(@_)}}};*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_;my$b=$a{builder}or return$m;my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=\&{$P.$b}and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$_[0]->$b:$m->(@_)}}};use constant XXX_skip=>1;my$dm='YAML::XS';*{$M.'xxx::e'}=sub{my($P,$e)=@_;$e->{WWW}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::WWW(@_)};$e->{XXX}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::XXX(@_)};$e->{YYY}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::YYY(@_)};$e->{ZZZ}=sub{require XXX;local$XXX::DumpModule=$dm}};my$i=\&import;*{$M.import}=sub{(@_==2 and not$_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};@f=qw[build default builder xxx import];use strict;use warnings; our $DumpModule = 'YAML'; 1; PK ��[��#� inc/TestML.pmnu �[��� package TestML; use TestML::Base; our $VERSION = '0.49'; has runtime => (); has compiler => (); has bridge => (); has library => (); has testml => (); sub run { my ($self) = @_; $self->set_default_classes; $self->runtime->new( compiler => $self->compiler, bridge => $self->bridge, library => $self->library, testml => $self->testml, )->run; } sub set_default_classes { my ($self) = @_; if (not $self->runtime) { require TestML::Runtime::TAP; $self->{runtime} = 'TestML::Runtime::TAP'; } if (not $self->compiler) { require TestML::Compiler::Pegex; $self->{compiler} = 'TestML::Compiler::Pegex'; } if (not $self->bridge) { require TestML::Bridge; $self->{bridge} = 'TestML::Bridge'; } if (not $self->library) { require TestML::Library::Standard; require TestML::Library::Debug; $self->{library} = [ 'TestML::Library::Standard', 'TestML::Library::Debug', ]; } } 1; PK ��[��Gg6 6 Makefile.PLnu �[��� # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019. use strict; use warnings; use 5.008001; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "A Simple Interface to Template Toolkit", "AUTHOR" => "Ingy d\x{f6}t net <ingy\@cpan.org>", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Template-Toolkit-Simple", "EXE_FILES" => [ "bin/tt-render" ], "LICENSE" => "perl", "NAME" => "Template::Toolkit::Simple", "PREREQ_PM" => { "Template" => "2.22", "YAML::XS" => "0.37" }, "VERSION" => "0.31", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Template" => "2.22", "YAML::XS" => "0.37" ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); PK ��[�fe e bin/tt-rendernu �[��� #!/usr/bin/env perl use Template::Toolkit::Simple; Template::Toolkit::Simple->_run_command(@ARGV); PK ��[ blib/man3/.existsnu �[��� PK ��[�3zd. d. '