r45677 - in /branches/upstream/libxml-opml-simplegen-perl: ./ current/ current/lib/ current/lib/XML/ current/lib/XML/OPML/ current/t/

mogaal-guest at users.alioth.debian.org mogaal-guest at users.alioth.debian.org
Mon Oct 12 23:39:39 UTC 2009


Author: mogaal-guest
Date: Mon Oct 12 23:39:34 2009
New Revision: 45677

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=45677
Log:
[svn-inject] Installing original source of libxml-opml-simplegen-perl

Added:
    branches/upstream/libxml-opml-simplegen-perl/
    branches/upstream/libxml-opml-simplegen-perl/current/
    branches/upstream/libxml-opml-simplegen-perl/current/Changes
    branches/upstream/libxml-opml-simplegen-perl/current/MANIFEST
    branches/upstream/libxml-opml-simplegen-perl/current/META.yml
    branches/upstream/libxml-opml-simplegen-perl/current/Makefile.PL
    branches/upstream/libxml-opml-simplegen-perl/current/README
    branches/upstream/libxml-opml-simplegen-perl/current/lib/
    branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/
    branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/
    branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/SimpleGen.pm
    branches/upstream/libxml-opml-simplegen-perl/current/t/
    branches/upstream/libxml-opml-simplegen-perl/current/t/00-load.t
    branches/upstream/libxml-opml-simplegen-perl/current/t/01-func.t
    branches/upstream/libxml-opml-simplegen-perl/current/t/02-parse.t
    branches/upstream/libxml-opml-simplegen-perl/current/t/pod-coverage.t
    branches/upstream/libxml-opml-simplegen-perl/current/t/pod.t

Added: branches/upstream/libxml-opml-simplegen-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/Changes?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/Changes (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/Changes Mon Oct 12 23:39:34 2009
@@ -1,0 +1,18 @@
+Revision history for XML-OPML-SimpleGen
+0.04 2008-02-08 10:27:00 UTC
+    - fix improper plan() declaration in t/02-parse.t
+
+0.03 2008-02-03 23:25 UTC
+    - make 5.6.0 oldest supported Perl version.
+    - use version pragma.
+    - eliminate dependencies on Date* modules.
+    - revise tests to add taint mode, pod coverage and remove un-needed
+      includes.
+
+0.02    2005-03-23 17:55 UTC
+	- dogh.. had atom still in my head
+	. added a test for passing XML::OPMLs parser
+
+0.01    Date/time
+        First version, released on an unsuspecting world.
+

Added: branches/upstream/libxml-opml-simplegen-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/MANIFEST?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/MANIFEST (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/MANIFEST Mon Oct 12 23:39:34 2009
@@ -1,0 +1,11 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/XML/OPML/SimpleGen.pm
+t/00-load.t
+t/01-func.t
+t/02-parse.t
+t/pod.t
+t/pod-coverage.t

Added: branches/upstream/libxml-opml-simplegen-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/META.yml?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/META.yml (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/META.yml Mon Oct 12 23:39:34 2009
@@ -1,0 +1,17 @@
+--- #YAML:1.0
+name:                XML-OPML-SimpleGen
+version:             0.04
+abstract:            create OPML using XML::Simple
+license:             ~
+generated_by:        ExtUtils::MakeMaker version 6.32
+distribution_type:   module
+requires:     
+    Class::Accessor:               0
+    Test::More:                    0
+    version:                       0
+    XML::Simple:                   0
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
+    version: 1.2
+author:
+    - Marcus Thiesen <marcus at thiesen.org>

Added: branches/upstream/libxml-opml-simplegen-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/Makefile.PL?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/Makefile.PL (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/Makefile.PL Mon Oct 12 23:39:34 2009
@@ -1,0 +1,20 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+require 5.006;
+
+WriteMakefile(
+    NAME                => 'XML::OPML::SimpleGen',
+    AUTHOR              => 'Marcus Thiesen <marcus at thiesen.org>',
+    VERSION_FROM        => 'lib/XML/OPML/SimpleGen.pm',
+    ABSTRACT_FROM       => 'lib/XML/OPML/SimpleGen.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'version'      => 0,
+        'Test::More'   => 0,
+        'XML::Simple'  => 0,
+        'Class::Accessor' => 0,
+    },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'XML-OPML-SimpleGen-*' },
+);

Added: branches/upstream/libxml-opml-simplegen-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/README?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/README (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/README Mon Oct 12 23:39:34 2009
@@ -1,0 +1,101 @@
+NAME
+    XML::OPML::SimpleGen - create OPML using XML::Simple
+
+SYNOPSIS
+        require XML::OPML::SimpleGen;
+
+        my $opml = new XML::OPML::SimpleGen();
+
+        $opml->head(
+                 title => 'FIFFS Subscriptions',
+               );
+
+        $opml->insert_outline(
+            group => 'news',  # groups will be auto generated
+            text =>  'some feed',
+            xmlUrl => 'http://www.somepage.org/feed.xml',
+        );
+
+        # insert_outline and add_outline are the same
+
+        $opml->add_group( text => 'myGroup' ); # explicitly create groups
+   
+        print $opml->to_string;
+
+        $opml->save('somefile.opml');
+
+        $opml->xml_options( $hashref ); # XML::Simple compatible options
+
+        # See XML::OPML's synopsis for more knowledge
+
+DESCRIPTION
+    XML::OPML::SimpleGen lets you simply generate OPML documents without
+    having too much to worry about. It is a drop-in replacement for
+    XML::OPML in regards of generation. As this module uses XML::Simple it
+    is rather generous in regards of attribute or element names.
+
+COMMON METHODS
+    new( key => value )
+        Creates a new XML::OPML::SimpleGen instance. All key values will be
+        used as attributes for the <atom> element. The only thing you might
+        want to use here is the version => '1.1', which is default anyway.
+
+    head( key => value )
+        XML::OPML compatible head method to change header values.
+
+    id ( )
+        Returns (and increments) a counter.
+
+    add_group ( text => 'name' )
+        Method to explicitly create a group which can hold multiple outline
+        elements.
+
+    insert_outline ( key => value )
+        XML::OPML compatible method to add an outline element. See XML::OPML
+        for details. The group key is used to put elements in a certain
+        group. Non existent groups will be created automagically.
+
+    add_outline ( key => value )
+        Alias to insert_outline for XML::OPML compatibility.
+
+    as_string
+        Returns the given OPML XML data as a string
+
+    save ( $filename )
+        Saves the OPML data to a file
+
+ADVANCED METHODS
+    xml_options ( $hashref )
+        $hashref may contain any XML::Simple options.
+
+    outline ( $hashref )
+        The outline method defines the 'template' for any new outline
+        element. You can preset key value pairs here to be used in all
+        outline elements that will be generated by XML::OPML::SimpleGen.
+
+    group ( $hashref )
+        This method is similar to outline, it defines the template for a
+        grouping outline element.
+
+AUTHOR
+    Marcus Thiesen, "<marcus at thiesen.org>"
+
+BUGS
+    Please report any bugs or feature requests to
+    "bug-xml-opml-simlegen at rt.cpan.org", or through the web interface at
+    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-OPML-SimleGen>. I
+    will be notified, and then you'll automatically be notified of progress
+    on your bug as I make changes.
+
+SEE ALSO
+    XML::OPML XML::Simple
+
+COPYRIGHT & LICENSE
+    Copyright 2005-2007 Marcus Thiesen, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself.
+
+CVS
+    $Id: README,v 1.4 2008/02/08 10:34:04 stephenca Exp $
+

Added: branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/SimpleGen.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/SimpleGen.pm?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/SimpleGen.pm (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/lib/XML/OPML/SimpleGen.pm Mon Oct 12 23:39:34 2009
@@ -1,0 +1,318 @@
+########################################################################
+#  
+#    XML::OPML::SimpleGen
+#
+#    Copyright 2005, Marcus Thiesen (marcus at thiesen.org)  All rights reserved.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of either:
+#
+#    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" which comes with Perl.
+#
+#    On Debian GNU/Linux systems, the complete text of the GNU General
+#    Public License can be found in `/usr/share/common-licenses/GPL' and
+#    the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+#
+#    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.  
+#
+########################################################################
+
+package XML::OPML::SimpleGen;
+
+use strict;
+use warnings;
+
+use base 'Class::Accessor';
+use POSIX qw(strftime);
+
+__PACKAGE__->mk_accessors(qw|groups xml_options outline group xml_head xml_outlines xml|);
+
+our $VERSION;
+use version; $VERSION = version->new(0.04);
+
+sub new {
+    my $class = shift;
+    my @args = @_;
+
+    my $args = {
+	    groups  => {},
+
+	    xml     => {
+	        version     => '1.1',
+	        @args,
+	        },			
+
+	    # XML::Simple options
+	    xml_options => {
+	        RootName    => 'opml', 
+	        XMLDecl     => '<?xml version="1.0" encoding="utf-8" ?>',
+	        AttrIndent  => 1,
+	    },
+
+	    # default values for nodes
+	    outline => {
+	        type        => 'rss',
+	        version     => 'RSS',
+	        text        => '',
+	        title       => '',
+	        description => '',
+	    },
+
+	    group => {
+	        isOpen      => 'true',
+	    },
+
+	    xml_head        => {},
+	    xml_outlines    => [],
+
+	    id              => 1,
+    };
+
+    my $self = bless $args, $class;
+
+    $self->head(
+        title => '',
+        dateCreated  => strftime( "%a, %e %b %Y %H:%M:%S %z", localtime ),
+        dateModified => strftime( "%a, %e %b %Y %H:%M:%S %z", localtime ),
+    );
+
+    return $self;
+}
+
+sub id {
+    my $self = shift;
+    
+    return $self->{id}++;
+}
+
+sub head {
+    my $self = shift;
+    my $data = {@_};
+
+    #this is necessary, otherwise XML::Simple will just generate attributes
+    while (my ($key,$value) = each %{ $data }) {
+	    $self->xml_head->{$key} = [ $value ];
+    }
+}
+
+sub add_group {
+    my $self = shift;
+    my %defaults = %{$self->group};
+    my $data = {
+        id => $self->id,
+        %defaults,
+        @_ };
+ 
+    die "Need to define 'text' attribute" unless defined $data->{text};
+
+    $data->{outline} = [];
+
+    push @{$self->xml_outlines}, $data;
+    $self->groups->{$data->{text}} = $data->{outline};
+}
+
+sub insert_outline {
+    my $self = shift;
+    my %defaults = %{$self->outline};
+    my $data = {
+        id => $self->id,
+        %defaults,
+        @_};
+
+    my $parent = $self->xml_outlines;
+
+    if (exists $data->{group}) {
+	    if (exists $self->groups->{$data->{group}}) {
+	        $parent = $self->groups->{$data->{group}};
+	        delete($data->{group});
+	    }
+        else {
+	        $self->add_group('text' => $data->{group});
+	        $self->insert_outline(%$data);
+	        return;
+	    }
+    }
+
+    push @{$parent}, $data;
+}
+
+sub add_outline {
+    my $self = shift;
+    $self->insert_outline(@_);
+}
+
+sub as_string {
+    my $self = shift;
+
+    require XML::Simple;
+    my $xs = new XML::Simple();
+
+    return $xs->XMLout( $self->_mk_hashref, %{$self->xml_options} );
+}
+
+sub _mk_hashref {
+    my $self = shift;
+
+    my $hashref =  {
+	    %{$self->xml},
+	    head => $self->xml_head,
+	    body => { outline => $self->xml_outlines },
+    };
+
+    return $hashref;
+}
+
+sub save {
+    my $self = shift;
+    my $filename = shift;
+
+    require XML::Simple;
+    my $xs = new XML::Simple();
+
+    $xs->XMLout( $self->_mk_hashref, %{$self->xml_options}, OutputFile => $filename );
+}
+
+1;
+
+=pod
+
+=head1 NAME
+
+XML::OPML::SimpleGen - create OPML using XML::Simple
+
+=head1 SYNOPSIS
+
+    require XML::OPML::SimpleGen;
+
+    my $opml = new XML::OPML::SimpleGen();
+
+    $opml->head(
+             title => 'FIFFS Subscriptions',
+           );
+
+    $opml->insert_outline(
+        group => 'news',  # groups will be auto generated
+        text =>  'some feed',
+        xmlUrl => 'http://www.somepage.org/feed.xml',
+    );
+
+    # insert_outline and add_outline are the same
+
+    $opml->add_group( text => 'myGroup' ); # explicitly create groups
+   
+    print $opml->to_string;
+
+    $opml->save('somefile.opml');
+
+    $opml->xml_options( $hashref ); # XML::Simple compatible options
+
+    # See XML::OPML's synopsis for more knowledge
+
+
+=head1 DESCRIPTION
+
+XML::OPML::SimpleGen lets you simply generate OPML documents
+without having too much to worry about. 
+It is a drop-in replacement for XML::OPML
+in regards of generation. 
+As this module uses XML::Simple it is rather
+generous in regards of attribute or element names.
+
+=head1 COMMON METHODS
+
+=over
+
+=item new( key => value )
+
+Creates a new XML::OPML::SimpleGen instance. All key values will be
+used as attributes for the <atom> element. The only thing you might
+want to use here is the version => '1.1', which is default anyway.
+
+=item head( key => value ) 
+
+XML::OPML compatible head method to change header values. 
+
+=item id ( )
+
+Returns (and increments) a counter.
+
+=item add_group ( text => 'name' )
+
+Method to explicitly create a group which can hold multiple outline
+elements.
+
+=item insert_outline ( key => value )
+
+XML::OPML compatible method to add an outline element. See
+L<XML::OPML> for details. The group key is used to put elements in a
+certain group. Non existent groups will be created automagically. 
+
+=item add_outline ( key => value )
+
+Alias to insert_outline for XML::OPML compatibility.
+
+=item as_string 
+
+Returns the given OPML XML data as a string
+
+=item save ( $filename )
+
+Saves the OPML data to a file
+
+=back
+
+=head1 ADVANCED METHODS
+
+=over
+
+=item xml_options ( $hashref ) 
+
+$hashref may contain any XML::Simple options.
+
+=item outline ( $hashref )
+
+The outline method defines the 'template' for any new outline
+element. You can preset key value pairs here to be used
+in all outline elements that will be generated by XML::OPML::SimpleGen.
+
+=item group ( $hashref )
+
+This method is similar to outline, it defines the template for a
+grouping outline element. 
+
+=back
+
+=head1 AUTHOR
+
+Marcus Thiesen, C<< <marcus at thiesen.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-xml-opml-simlegen at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-OPML-SimleGen>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SEE ALSO
+
+L<XML::OPML> L<XML::Simple>
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2005-2007 Marcus Thiesen, All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=head1 CVS
+
+$Id: SimpleGen.pm,v 1.9 2008/02/08 10:33:43 stephenca Exp $
+
+=cut

Added: branches/upstream/libxml-opml-simplegen-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/t/00-load.t?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/t/00-load.t (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/t/00-load.t Mon Oct 12 23:39:34 2009
@@ -1,0 +1,24 @@
+use Test::More tests => 2;
+
+BEGIN {
+use_ok( 'XML::OPML::SimpleGen' );
+}
+
+can_ok( 'XML::OPML::SimpleGen',
+    qw( new
+        id
+        head
+        group
+        groups
+        xml_options
+        outline
+        xml_head
+        xml_outlines
+        xml
+        add_group
+        insert_outline
+        add_outline
+        as_string
+        save ) );
+
+diag( "Testing XML::OPML::SimpleGen $XML::OPML::SimpleGen::VERSION, Perl $], $^X" );

Added: branches/upstream/libxml-opml-simplegen-perl/current/t/01-func.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/t/01-func.t?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/t/01-func.t (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/t/01-func.t Mon Oct 12 23:39:34 2009
@@ -1,0 +1,30 @@
+#!perl -T
+use Test::More tests => 2;
+
+BEGIN {
+	use_ok( 'XML::OPML::SimpleGen' );
+}
+
+my $foo = new XML::OPML::SimpleGen;
+
+$foo->head(dateCreated => '', dateModified => '');
+
+my $data = $foo->as_string();
+
+local $/ = undef;
+
+my $old = <DATA>;
+
+ok($old eq $data, "Basic function");
+
+__DATA__
+<?xml version="1.0" encoding="utf-8" ?>
+<opml version="1.1">
+  <body>
+  </body>
+  <head>
+    <dateCreated></dateCreated>
+    <dateModified></dateModified>
+    <title></title>
+  </head>
+</opml>

Added: branches/upstream/libxml-opml-simplegen-perl/current/t/02-parse.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/t/02-parse.t?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/t/02-parse.t (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/t/02-parse.t Mon Oct 12 23:39:34 2009
@@ -1,0 +1,22 @@
+#!perl -T
+use Test::More ;
+
+eval "use XML::OPML";
+plan skip_all => "XML::OPML required for parse tests" if ($@);
+plan tests => 2;
+
+require_ok( 'XML::OPML::SimpleGen' );
+
+my $obj = XML::OPML::SimpleGen->new();
+$obj->insert_outline(text => 'test');
+my $data = $obj->as_string;
+
+my $opml = new XML::OPML;
+
+
+$opml->parse($data);
+
+
+isa_ok($opml, 'XML::OPML');
+
+exit;

Added: branches/upstream/libxml-opml-simplegen-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/t/pod-coverage.t?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/t/pod-coverage.t Mon Oct 12 23:39:34 2009
@@ -1,0 +1,23 @@
+#!/usr/bin/perl -T
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+if($@) {
+    plan skip_all => 
+    "Test::Pod::Coverage 1.04 required for testing POD coverage";
+}
+else {
+    plan tests => 1;
+}
+
+my(@tests) = (
+    [ 'XML::OPML::SimpleGen' => 'Cvs::Simple is covered' ],
+);
+
+for my $t (@tests) {
+    pod_coverage_ok(@{$t});
+}
+
+exit;

Added: branches/upstream/libxml-opml-simplegen-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-opml-simplegen-perl/current/t/pod.t?rev=45677&op=file
==============================================================================
--- branches/upstream/libxml-opml-simplegen-perl/current/t/pod.t (added)
+++ branches/upstream/libxml-opml-simplegen-perl/current/t/pod.t Mon Oct 12 23:39:34 2009
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();




More information about the Pkg-perl-cvs-commits mailing list