r4365 - in /packages/libtemplate-plugin-yaml-perl: ./ branches/
branches/upstream/ branches/upstream/current/
branches/upstream/current/lib/ branches/upstream/current/lib/Template/
branches/upstream/current/lib/Template/Plugin/ branches/upstream/current/t/
tags/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Thu Nov 23 23:05:04 CET 2006
Author: eloy
Date: Thu Nov 23 23:05:04 2006
New Revision: 4365
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4365
Log:
[svn-inject] Installing original source of libtemplate-plugin-yaml-perl
Added:
packages/libtemplate-plugin-yaml-perl/
packages/libtemplate-plugin-yaml-perl/branches/
packages/libtemplate-plugin-yaml-perl/branches/upstream/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Build.PL
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Changes
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/MANIFEST
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/META.yml
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Makefile.PL
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/README
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/YAML.pm
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/
packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/00simple.t
packages/libtemplate-plugin-yaml-perl/tags/
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Build.PL?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Build.PL (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Build.PL Thu Nov 23 23:05:04 2006
@@ -1,0 +1,14 @@
+use strict;
+use Module::Build;
+
+Module::Build
+->new( module_name => "Template::Plugin::YAML",
+ license => 'perl',
+ requires => {
+ 'Test::More' => 0,
+ 'Template' => 0,
+ 'YAML' => 0,
+ },
+ create_makefile_pl => 'traditional',
+ )
+ ->create_build_script;
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Changes?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Changes (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Changes Thu Nov 23 23:05:04 2006
@@ -1,0 +1,5 @@
+1.22 29th August, 2003
+ Adds undump, dumpfile, undumpfile as provided by Randal L. Schwartz
+
+1.21 30th July, 2003
+ Initial CPAN release
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/MANIFEST?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/MANIFEST Thu Nov 23 23:05:04 2006
@@ -1,0 +1,8 @@
+Build.PL
+README
+Changes
+Makefile.PL
+MANIFEST
+META.yml
+lib/Template/Plugin/YAML.pm
+t/00simple.t
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/META.yml?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/META.yml (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/META.yml Thu Nov 23 23:05:04 2006
@@ -1,0 +1,17 @@
+--- #YAML:1.0
+name: Template-Plugin-YAML
+version: 1.22
+license: perl
+distribution_type: module
+requires:
+ Template: 0
+ Test::More: 0
+ YAML: 0
+recommends: {}
+build_requires: {}
+conflicts: {}
+provides:
+ Template::Plugin::YAML:
+ file: lib/Template/Plugin/YAML.pm
+ version: 1.22
+generated_by: Module::Build version 0.20
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Makefile.PL?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/Makefile.PL Thu Nov 23 23:05:04 2006
@@ -1,0 +1,15 @@
+# Generated by Module::Build::Compat->create_makefile_pl
+
+use ExtUtils::MakeMaker;
+WriteMakefile
+ (
+ NAME => 'Template::Plugin::YAML',
+ VERSION => '1.22',
+ PL_FILES => {},
+ INSTALLDIRS => 'site',
+ PREREQ_PM => {
+ 'Test::More' => '0',
+ 'YAML' => '0',
+ 'Template' => '0',
+ },
+ );
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/README?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/README (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/README Thu Nov 23 23:05:04 2006
@@ -1,0 +1,68 @@
+README for Template::Plugin::YAML 1.22
+
+=head1 NAME
+
+Template::Plugin::YAML - Plugin interface to YAML
+
+=head1 SYNOPSIS
+
+ [% USE YAML %]
+
+ [% YAML.dump(variable) %]
+ [% YAML.dump_html(variable) %]
+ [% value = YAML.undump(yaml_string) %]
+ [% YAML.dumpfile(filename, variable) %]
+ [% value = YAML.undumpfile(filename) %]
+
+
+=head1 DEPENDENCIES
+
+This module has external dependencies on the following modules:
+
+ Template
+ Test::More
+ YAML
+
+=head1 INSTALLATION
+
+ perl Build.PL
+ perl Build test
+
+and if all goes well
+
+ perl Build install
+
+=head1 HISTORY
+
+What changed over the last 3 revisions
+
+=over
+
+=item 1.22 29th August, 2003
+
+ Adds undump, dumpfile, undumpfile as provided by Randal L. Schwartz
+
+
+=item 1.21 30th July, 2003
+
+ Initial CPAN release
+=back
+
+=head1 AUTHORS
+
+Richard Clamp <richardc at unixbeard.net>, with undump, undumpfile, and
+dumpfile implementation by Randal L. Schwartz <merlyn at stonehenge.com>
+
+based on Simon Matthews' L<Template::Plugin::Dumper>
+
+=head1 COPYRIGHT
+
+Copyright 2003 Richard Clamp All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Template::Plugin::Dumper>
+
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/YAML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/YAML.pm?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/YAML.pm (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/lib/Template/Plugin/YAML.pm Thu Nov 23 23:05:04 2006
@@ -1,0 +1,149 @@
+use strict;
+package Template::Plugin::YAML;
+use Template::Plugin;
+use base 'Template::Plugin';
+use YAML qw(Dump Load DumpFile LoadFile);
+use vars qw($VERSION);
+$VERSION = 1.22;
+
+=head1 NAME
+
+Template::Plugin::YAML - Plugin interface to YAML
+
+=head1 SYNOPSIS
+
+ [% USE YAML %]
+
+ [% YAML.dump(variable) %]
+ [% YAML.dump_html(variable) %]
+ [% value = YAML.undump(yaml_string) %]
+ [% YAML.dumpfile(filename, variable) %]
+ [% value = YAML.undumpfile(filename) %]
+
+=head1 DESCRIPTION
+
+This is a simple Template Toolkit Plugin Interface to the YAML module.
+A YAML object will be instantiated via the following directive:
+
+ [% USE YAML %]
+
+As a standard plugin, you can also specify its name in lower case:
+
+ [% USE yaml %]
+
+=head1 METHODS
+
+These are the methods supported by the YAML object.
+
+=head2 dump( @variables )
+
+Generates a raw text dump of the data structure(s) passed
+
+ [% USE Dumper %]
+ [% yaml.dump(myvar) %]
+ [% yaml.dump(myvar, yourvar) %]
+
+=cut
+
+sub dump {
+ my $self = shift;
+ my $content = Dump @_;
+ return $content;
+}
+
+
+=head2 dump_html( @variables )
+
+Generates a dump of the data structures, as per C<dump>, but with the
+characters E<lt>, E<gt> and E<amp> converted to their equivalent HTML
+entities, spaces converted to and newlines converted to
+E<lt>brE<gt>.
+
+ [% USE yaml %]
+ [% yaml.dump_html(myvar) %]
+
+=cut
+
+sub dump_html {
+ my $self = shift;
+ my $content = Dump @_;
+ for ($content) {
+ s/&/&/g;
+ s/ / /g;
+ s/</</g;
+ s/>/>/g;
+ s/\n/<br>\n/g;
+ }
+ return $content;
+}
+
+
+=head2 undump( $string )
+
+Converts a YAML-encoded string into the equivalent data structure.
+Here's a way to deep-copy a complex structure by completely serializing
+the data.
+
+ [% USE yaml;
+ yaml_string = yaml.dump(complex_data_structure);
+ complex_copy = yaml.undump(yaml_string);
+ %]
+
+=cut
+
+sub undump {
+ my $self = shift;
+ return Load shift;
+}
+
+
+=head2 dumpfile( $file, @variables )
+
+Converts the data to YAML encoding, and dumps it to the specified
+filepath.
+
+ [% USE yaml; yaml.dumpfile(".storage", my_data) %]
+
+=cut
+
+sub dumpfile {
+ my $self = shift;
+ return DumpFile @_;
+}
+
+
+=head2 undumpfile( $file )
+
+Loads the YAML-encoded data from the specified filepath
+
+ [% USE yaml; my_data = yaml.undumpfile(".storage") %]
+
+=cut
+
+sub undumpfile {
+ my $self = shift;
+ return LoadFile @_;
+}
+
+1;
+__END__
+
+=head1 AUTHORS
+
+Richard Clamp <richardc at unixbeard.net>, with undump, undumpfile, and
+dumpfile implementation by Randal L. Schwartz <merlyn at stonehenge.com>
+
+based on Simon Matthews' L<Template::Plugin::Dumper>
+
+=head1 COPYRIGHT
+
+Copyright 2003 Richard Clamp All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Template::Plugin::Dumper>
+
+=cut
Added: packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/00simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/00simple.t?rev=4365&op=file
==============================================================================
--- packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/00simple.t (added)
+++ packages/libtemplate-plugin-yaml-perl/branches/upstream/current/t/00simple.t Thu Nov 23 23:05:04 2006
@@ -1,0 +1,14 @@
+#!perl -w
+use strict;
+use Test::More tests => 3;
+use Template;
+
+my $tt = new Template;
+my $out;
+ok( $tt->process(\"[% USE YAML %][% YAML.dump( struct ) %]", {
+ struct => [ { foo => 'bar' }, { foo => 'baz' } ],
+ }, \$out), "TT ran" );
+
+is( $tt->error, undef );
+
+is( $out, "--- #YAML:1.0\n- foo: bar\n- foo: baz\n", "got what we expected" );
More information about the Pkg-perl-cvs-commits
mailing list