XML-OPML-SimpleGen-0.07/0000775000175000017500000000000012146672743014750 5ustar stephencstephencXML-OPML-SimpleGen-0.07/lib/0000775000175000017500000000000012146672743015516 5ustar stephencstephencXML-OPML-SimpleGen-0.07/lib/XML/0000775000175000017500000000000012146672743016156 5ustar stephencstephencXML-OPML-SimpleGen-0.07/lib/XML/OPML/0000775000175000017500000000000012146672743016725 5ustar stephencstephencXML-OPML-SimpleGen-0.07/lib/XML/OPML/SimpleGen.pm0000644000175000017500000001641512146672743021153 0ustar stephencstephencpackage XML::OPML::SimpleGen; use strict; use warnings; use base 'Class::Accessor'; use DateTime; use POSIX qw(setlocale LC_TIME LC_CTYPE); __PACKAGE__->mk_accessors(qw|groups xml_options outline group xml_head xml_outlines xml|); # Version set by dist.ini; do not change here. our $VERSION = '0.07'; # VERSION sub new { my $class = shift; my @args = @_; my $args = { groups => {}, xml => { version => '1.1', @args, }, # XML::Simple options xml_options => { RootName => 'opml', XMLDecl => '', 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; # Force locale to 'C' rather than local, then reset after setting times. # Fixes RT51000. Thanks to KAPPA for the patch. my $old_loc = POSIX::setlocale(LC_TIME, "C"); my $ts_ar = [ localtime() ]; $self->head( title => '', $self->_date( dateCreated => $ts_ar ), $self->_date( dateModified => $ts_ar ), ); POSIX::setlocale(LC_TIME,$old_loc); return $self; } sub _date { my $self = shift; my $type = shift; # dateCreated or dateModified. my $ts_ar = shift; # e.g [ localtime() ] my %arg; @arg{qw(second minute hour day month year)} = ( @{$ts_ar}[0..3], $ts_ar->[4]+1, $ts_ar->[5]+1900 ); my $dt = DateTime->new( %arg ); return ( $type => $dt->strftime('%a, %e %b %Y %H:%M:%S %z') ); } 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 = XML::Simple->new(); 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 = XML::Simple->new(); $xs->XMLout( $self->_mk_hashref, %{$self->xml_options}, OutputFile => $filename ); } 1; # ABSTRACT: create OPML using XML::Simple __END__ =pod =head1 NAME XML::OPML::SimpleGen - create OPML using XML::Simple =head1 VERSION version 0.07 =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 NAME XML::OPML::SimpleGen - create OPML using XML::Simple =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 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 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 MAINTAINER Stephen Cardie C<< >> =head1 REPOSITORY L =head1 CONTRIBUTORS =over 4 =item KAPPA C<< >> contributed a patch to close RT51000 L =item gregoa@debian.org contributed a patch to close RT77725 L =back =head1 REPO The git repository for this module is at L =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SEE ALSO L L =head1 AUTHOR Marcus Theisen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Marcus Thiesen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut XML-OPML-SimpleGen-0.07/Makefile.PL0000644000175000017500000000226512146672743016725 0ustar stephencstephenc use strict; use warnings; use 5.006; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "create OPML using XML::Simple", "AUTHOR" => "Marcus Theisen ", "BUILD_REQUIRES" => { "File::Find" => 0, "File::Temp" => 0, "Test::More" => 0 }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "XML-OPML-SimpleGen", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "XML::OPML::SimpleGen", "PREREQ_PM" => { "Class::Accessor" => 0, "DateTime" => 0, "POSIX" => 0, "XML::Simple" => 0, "base" => 0, "strict" => 0, "warnings" => 0 }, "VERSION" => "0.07", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); XML-OPML-SimpleGen-0.07/xt/0000775000175000017500000000000012146672743015403 5ustar stephencstephencXML-OPML-SimpleGen-0.07/xt/author/0000775000175000017500000000000012146672743016705 5ustar stephencstephencXML-OPML-SimpleGen-0.07/xt/author/critic.t0000644000175000017500000000043712146672743020351 0ustar stephencstephenc#!perl use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "t/perlcriticrc" ) if -e "t/perlcriticrc"; all_critic_ok(); XML-OPML-SimpleGen-0.07/xt/release/0000775000175000017500000000000012146672743017023 5ustar stephencstephencXML-OPML-SimpleGen-0.07/xt/release/distmeta.t0000644000175000017500000000021712146672743021020 0ustar stephencstephenc#!perl use Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); XML-OPML-SimpleGen-0.07/xt/release/test-version.t0000644000175000017500000000064312146672743021653 0ustar stephencstephencuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } my @imports = ( 'version_all_ok' ); my $params = { is_strict => 0, has_version => 1, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; XML-OPML-SimpleGen-0.07/xt/release/pod-coverage.t0000644000175000017500000000052712146672743021565 0ustar stephencstephenc#!perl use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); XML-OPML-SimpleGen-0.07/xt/release/pod-syntax.t0000644000175000017500000000021212146672743021307 0ustar stephencstephenc#!perl use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); XML-OPML-SimpleGen-0.07/LICENSE0000644000175000017500000004366112146672742015764 0ustar stephencstephencThis software is copyright (c) 2013 by Marcus Thiesen. 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) 2013 by Marcus Thiesen. 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. Copyright (C) 19yy 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. , 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) 2013 by Marcus Thiesen. 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 XML-OPML-SimpleGen-0.07/META.json0000644000175000017500000000304712146672742016372 0ustar stephencstephenc{ "abstract" : "create OPML using XML::Simple", "author" : [ "Marcus Theisen " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.300023, CPAN::Meta::Converter version 2.130880", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "XML-OPML-SimpleGen", "no_index" : { "directory" : [ "t", "xt", "examples", "corpus" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "runtime" : { "requires" : { "Class::Accessor" : "0", "DateTime" : "0", "POSIX" : "0", "XML::Simple" : "0", "base" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Find" : "0", "File::Temp" : "0", "Test::More" : "0" } } }, "provides" : { "XML::OPML::SimpleGen" : { "file" : "lib/XML/OPML/SimpleGen.pm", "version" : "0.07" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-xml-opml-simplegen at rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=XML-OPML-SimpleGen" } }, "version" : "0.07" } XML-OPML-SimpleGen-0.07/Changes0000644000175000017500000000310512146672742016237 0ustar stephencstephencRevision history for XML-OPML-SimpleGen 0.07 - Full release of strtime() changes. (Stephen Cardie) 0.06_01 Tue May 14 22:59:08 2013 +0100 - Use DateTime instead of POSIX::strfrime() - avoids problems on win32 and other platforms which implement strftime differently. (Stephen Cardie) 0.06 - Release v0.06. (Stephen Cardie) - Fix RT77725 - 03-localefix.t incorrectly fails on first 9 days of month. (Provided by gregoa [at ] debian.org) (Stephen Cardie) 0.05 Fri May 18 16:04:55 2012 +0100 - Release v0.05 - includes bugfix for RT51000 0.040_004 Fri May 18 15:26:16 2012 +0100 - Bug fix - merge KAPPA's fix for RT51000. (Stephen Cardie) 0.040_003 Fri May 18 14:54:13 2012 +0100 - Developer release - add perlcritic tests to release stage (Stephen Cardie) 0.040_002 Fri May 18 14:47:59 2012 +0100 - Developer release - fix indirect object syntax; was causing perlcritic failures (Stephen Cardie) 0.040_001 Fri May 18 14:34:40 2012 +0100 - Developer release - move to Dist::Zilla for managing infrastructure. (Stephen Cardie) 0.04 2008-02-08 10:27:00 UTC - fix improper plan() declaration in t/02-parse.t. (Stephen Cardie) 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. XML-OPML-SimpleGen-0.07/MANIFEST0000644000175000017500000000044212146672742016076 0ustar stephencstephencChanges LICENSE MANIFEST META.json META.yml Makefile.PL README lib/XML/OPML/SimpleGen.pm t/00-compile.t t/00-load.t t/01-func.t t/02-parse.t t/03-localefix.t t/perlcriticrc xt/author/critic.t xt/release/distmeta.t xt/release/pod-coverage.t xt/release/pod-syntax.t xt/release/test-version.t XML-OPML-SimpleGen-0.07/META.yml0000644000175000017500000000151512146672742016220 0ustar stephencstephenc--- abstract: 'create OPML using XML::Simple' author: - 'Marcus Theisen ' build_requires: File::Find: 0 File::Temp: 0 Test::More: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300023, CPAN::Meta::Converter version 2.130880' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: XML-OPML-SimpleGen no_index: directory: - t - xt - examples - corpus package: - DB provides: XML::OPML::SimpleGen: file: lib/XML/OPML/SimpleGen.pm version: 0.07 requires: Class::Accessor: 0 DateTime: 0 POSIX: 0 XML::Simple: 0 base: 0 perl: 5.006 strict: 0 warnings: 0 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=XML-OPML-SimpleGen version: 0.07 XML-OPML-SimpleGen-0.07/README0000644000175000017500000000726212146672742015634 0ustar stephencstephencNAME XML::OPML::SimpleGen - create OPML using XML::Simple VERSION version 0.07 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. NAME XML::OPML::SimpleGen - create OPML using XML::Simple COMMON METHODS new( key => value ) Creates a new XML::OPML::SimpleGen instance. All key values will be used as attributes for the 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. MAINTAINER Stephen Cardie "" REPOSITORY CONTRIBUTORS KAPPA "" contributed a patch to close RT51000 gregoa@debian.org contributed a patch to close RT77725 REPO The git repository for this module is at L BUGS Please report any bugs or feature requests to "bug-xml-opml-simlegen@rt.cpan.org", or through the web interface at . 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 AUTHOR Marcus Theisen COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Marcus Thiesen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. XML-OPML-SimpleGen-0.07/t/0000775000175000017500000000000012146672743015213 5ustar stephencstephencXML-OPML-SimpleGen-0.07/t/00-load.t0000644000175000017500000000066712146672742016542 0ustar stephencstephencuse 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" ); XML-OPML-SimpleGen-0.07/t/perlcriticrc0000644000175000017500000007035312146672743017631 0ustar stephencstephenc# Globals severity = 4 # force = 0 # only = 0 # profile-strictness = warn # color = 0 # pager = # top = 0 # verbose = 4 # include = # exclude = # single-policy = # theme = # color-severity-highest = bold red # color-severity-high = magenta # color-severity-medium = # color-severity-low = # color-severity-lowest = # Use `List::MoreUtils::any' instead of `grep' in boolean context. [BuiltinFunctions::ProhibitBooleanGrep] severity = 2 # Map blocks should have a single statement. [BuiltinFunctions::ProhibitComplexMappings] severity = 3 # The maximum number of statements to allow within a map block. # Minimum value 1. No maximum. # max_statements = 1 # Use 4-argument `substr' instead of writing `substr($foo, 2, 6) = $bar'. [BuiltinFunctions::ProhibitLvalueSubstr] severity = 3 # Forbid $b before $a in sort blocks. [BuiltinFunctions::ProhibitReverseSortBlock] severity = 1 # Use Time::HiRes instead of something like `select(undef, undef, undef, .05)'. [BuiltinFunctions::ProhibitSleepViaSelect] severity = 5 # Write `eval { my $foo; bar($foo) }' instead of `eval "my $foo; bar($foo);"'. [BuiltinFunctions::ProhibitStringyEval] severity = 5 # Allow eval of "use" and "require" strings. # allow_includes = 0 # Write `split /-/, $string' instead of `split '-', $string'. [BuiltinFunctions::ProhibitStringySplit] severity = 2 # Write `eval { $foo->can($name) }' instead of `UNIVERSAL::can($foo, $name)'. [BuiltinFunctions::ProhibitUniversalCan] severity = 3 # Write `eval { $foo->isa($pkg) }' instead of `UNIVERSAL::isa($foo, $pkg)'. [BuiltinFunctions::ProhibitUniversalIsa] severity = 3 # Don't use `grep' in void contexts. [BuiltinFunctions::ProhibitVoidGrep] severity = 3 # Don't use `map' in void contexts. [BuiltinFunctions::ProhibitVoidMap] severity = 3 # Write `grep { $_ =~ /$pattern/ } @list' instead of `grep /$pattern/, @list'. [BuiltinFunctions::RequireBlockGrep] severity = 4 # Write `map { $_ =~ /$pattern/ } @list' instead of `map /$pattern/, @list'. [BuiltinFunctions::RequireBlockMap] severity = 4 # Use `glob q{*}' instead of <*>. [BuiltinFunctions::RequireGlobFunction] severity = 5 # Sort blocks should have a single statement. [BuiltinFunctions::RequireSimpleSortBlock] severity = 3 # AUTOLOAD methods should be avoided. [ClassHierarchies::ProhibitAutoloading] severity = 3 # Employ `use base' instead of `@ISA'. [ClassHierarchies::ProhibitExplicitISA] severity = 3 # Write `bless {}, $class;' instead of just `bless {};'. [ClassHierarchies::ProhibitOneArgBless] severity = 5 # Use spaces instead of tabs. [CodeLayout::ProhibitHardTabs] severity = 3 # Allow hard tabs before first non-whitespace character. # allow_leading_tabs = 1 # Write `open $handle, $path' instead of `open($handle, $path)'. [CodeLayout::ProhibitParensWithBuiltins] severity = 1 # Write `qw(foo bar baz)' instead of `('foo', 'bar', 'baz')'. [CodeLayout::ProhibitQuotedWordLists] severity = 2 # The minimum number of words in a list that will be complained about. # Minimum value 1. No maximum. # min_elements = 2 # Complain even if there are non-word characters in the values. # strict = 0 # Don't use whitespace at the end of lines. [CodeLayout::ProhibitTrailingWhitespace] severity = 1 # Use the same newline through the source. [CodeLayout::RequireConsistentNewlines] severity = 4 # Put a comma at the end of every multi-line list declaration, including the last one. [CodeLayout::RequireTrailingCommas] severity = 1 # Write `for(0..20)' instead of `for($i=0; $i<=20; $i++)'. [ControlStructures::ProhibitCStyleForLoops] severity = 2 # Don't write long "if-elsif-elsif-elsif-elsif...else" chains. [ControlStructures::ProhibitCascadingIfElse] severity = 3 # The maximum number of alternatives that will be allowed. # Minimum value 1. No maximum. # max_elsif = 2 # Don't write deeply nested loops and conditionals. [ControlStructures::ProhibitDeepNests] severity = 3 # The maximum number of nested constructs to allow. # Minimum value 1. No maximum. # max_nests = 5 # Don't use labels that are the same as the special block names. [ControlStructures::ProhibitLabelsWithSpecialBlockNames] severity = 4 # Don't modify `$_' in list functions. [ControlStructures::ProhibitMutatingListFunctions] severity = 5 # The base set of functions to check. # list_funcs = map grep List::Util::first List::MoreUtils::any List::MoreUtils::all List::MoreUtils::none List::MoreUtils::notall List::MoreUtils::true List::MoreUtils::false List::MoreUtils::firstidx List::MoreUtils::first_index List::MoreUtils::lastidx List::MoreUtils::last_index List::MoreUtils::insert_after List::MoreUtils::insert_after_string # The set of functions to check, in addition to those given in list_funcs. # add_list_funcs = # Don't use operators like `not', `!~', and `le' within `until' and `unless'. [ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] severity = 3 # Write `if($condition){ do_something() }' instead of `do_something() if $condition'. [ControlStructures::ProhibitPostfixControls] severity = 2 # The permitted postfix controls. # Valid values: for, foreach, if, unless, until, while. # allow = # The exempt flow control functions. # flowcontrol = carp cluck confess croak die exit goto warn # Write `if(! $condition)' instead of `unless($condition)'. [ControlStructures::ProhibitUnlessBlocks] severity = 2 # Don't write code after an unconditional `die, exit, or next'. [ControlStructures::ProhibitUnreachableCode] severity = 4 # Write `while(! $condition)' instead of `until($condition)'. [ControlStructures::ProhibitUntilBlocks] severity = 2 # The `=head1 NAME' section should match the package. [Documentation::RequirePackageMatchesPodName] severity = 1 # All POD should be after `__END__'. [Documentation::RequirePodAtEnd] severity = 1 # Organize your POD into the customary sections. [Documentation::RequirePodSections] severity = 2 # The sections to require for modules (separated by qr/\s* [|] \s*/xms). # lib_sections = # The sections to require for programs (separated by qr/\s* [|] \s*/xms). # script_sections = # The origin of sections to use. # Valid values: book, book_first_edition, module_starter_pbp, module_starter_pbp_0_0_3. # source = book_first_edition # The spelling of sections to use. # Valid values: en_AU, en_US. # language = # Use functions from Carp instead of `warn' or `die'. [ErrorHandling::RequireCarping] severity = 3 # Don't complain about die or warn if the message ends in a newline. # allow_messages_ending_with_newlines = 1 # You can't depend upon the value of `$@'/`$EVAL_ERROR' to tell whether an `eval' failed. [ErrorHandling::RequireCheckingReturnValueOfEval] severity = 4 # Discourage stuff like `@files = `ls $directory`'. [InputOutput::ProhibitBacktickOperators] severity = 3 # Allow backticks everywhere except in void contexts. # only_in_void_context = # Write `open my $fh, q{<}, $filename;' instead of `open FH, q{<}, $filename;'. [InputOutput::ProhibitBarewordFileHandles] severity = 5 # swapped < for < to stop module-starter carping # Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>". [InputOutput::ProhibitExplicitStdin] severity = 4 # Use prompt() instead of -t. [InputOutput::ProhibitInteractiveTest] severity = 5 # Use `local $/ = undef' or File::Slurp instead of joined readline. [InputOutput::ProhibitJoinedReadline] severity = 4 # Never write `select($fh)'. [InputOutput::ProhibitOneArgSelect] severity = 4 # Write `while( $line = <> ){...}' instead of `for(<>){...}'. [InputOutput::ProhibitReadlineInForLoop] severity = 5 # Write `open $fh, q{<}, $filename;' instead of `open $fh, "<$filename";'. [InputOutput::ProhibitTwoArgOpen] severity = 5 # Write `print {$FH} $foo, $bar;' instead of `print $FH $foo, $bar;'. [InputOutput::RequireBracedFileHandleWithPrint] severity = 1 # Close filehandles as soon as possible after opening them. [InputOutput::RequireBriefOpen] severity = 4 # The maximum number of lines between an open() and a close(). # Minimum value 1. No maximum. # IJW: set to about a screen-length or so. lines = 30 # Write `my $error = close $fh;' instead of `close $fh;'. [InputOutput::RequireCheckedClose] severity = 2 # Write `my $error = open $fh, $mode, $filename;' instead of `open $fh, $mode, $filename;'. [InputOutput::RequireCheckedOpen] severity = 4 # Return value of flagged function ignored. [InputOutput::RequireCheckedSyscalls] severity = 2 # The set of functions to require checking the return value of. # functions = open close print # The set of functions to not require checking the return value of. # exclude_functions = # Do not use `format'. [Miscellanea::ProhibitFormats] severity = 3 # Do not use `tie'. [Miscellanea::ProhibitTies] severity = 2 # Forbid a bare `## no critic' [Miscellanea::ProhibitUnrestrictedNoCritic] severity = 3 # Remove ineffective "## no critic" annotations. [Miscellanea::ProhibitUselessNoCritic] severity = 2 # Put source-control keywords in every file. [Miscellanea::RequireRcsKeywords] severity = 2 # The keywords to require in all files. # keywords = # Export symbols via `@EXPORT_OK' or `%EXPORT_TAGS' instead of `@EXPORT'. [Modules::ProhibitAutomaticExportation] severity = 4 # Minimize complexity in code that is outside of subroutines. [Modules::ProhibitExcessMainComplexity] severity = 3 # The maximum complexity score allowed. # Minimum value 1. No maximum. # max_mccabe = 20 # Put packages (especially subclasses) in separate files. [Modules::ProhibitMultiplePackages] severity = 4 # Write `require Module' instead of `require 'Module.pm''. [Modules::RequireBarewordIncludes] severity = 5 # End each module with an explicitly `1;' instead of some funky expression. [Modules::RequireEndWithOne] severity = 4 # Always make the `package' explicit. [Modules::RequireExplicitPackage] severity = 4 # maximum_violations_per_document = 1 # Don't require programs to contain a package statement. # exempt_scripts = 1 # Package declaration must match filename. [Modules::RequireFilenameMatchesPackage] severity = 5 # `use English' must be passed a `-no_match_vars' argument. [Modules::RequireNoMatchVarsWithUseEnglish] severity = 2 # Give every module a `$VERSION' number. [Modules::RequireVersionVar] severity = 2 # Distinguish different program components by case. [NamingConventions::Capitalization] severity = 3 # How package name components should be capitalized. Valid values are :single_case, :all_lower, :all_upper:, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # packages = :starts_with_upper # Package names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # package_exemptions = main # How subroutine names should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # subroutines = :single_case # Subroutine names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # subroutine_exemptions = AUTOLOAD BUILD BUILDARGS CLEAR CLOSE DELETE DEMOLISH DESTROY EXISTS EXTEND FETCH FETCHSIZE FIRSTKEY GETC NEXTKEY POP PRINT PRINTF PUSH READ READLINE SCALAR SHIFT SPLICE STORE STORESIZE TIEARRAY TIEHANDLE TIEHASH TIESCALAR UNSHIFT UNTIE WRITE # How local lexical variables names should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # local_lexical_variables = :single_case # Local lexical variable names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # local_lexical_variable_exemptions = # How lexical variables that are scoped to a subset of subroutines, should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # scoped_lexical_variables = :single_case # Names for variables in anonymous blocks that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # scoped_lexical_variable_exemptions = # How lexical variables at the file level should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # file_lexical_variables = :single_case # File-scope lexical variable names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # file_lexical_variable_exemptions = # How global (package) variables should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # global_variables = :single_case # Global variable names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # global_variable_exemptions = \$VERSION @ISA @EXPORT(?:_OK)? %EXPORT_TAGS \$AUTOLOAD %ENV %SIG \$TODO # How constant names should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # constants = :all_upper # Constant names that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # constant_exemptions = # How labels should be capitalized. Valid values are :single_case, :all_lower, :all_upper, :starts_with_lower, :starts_with_upper, :no_restriction, or a regex. # labels = :all_upper # Labels that are exempt from capitalization rules. The values here are regexes that will be surrounded by \A and \z. # label_exemptions = # Don't use vague variable or subroutine names like 'last' or 'record'. [NamingConventions::ProhibitAmbiguousNames] severity = 3 # The variable names that are not to be allowed. # forbid = abstract bases close contract last left no record right second set # Write `@{ $array_ref }' instead of `@$array_ref'. [References::ProhibitDoubleSigils] severity = 2 # Capture variable used outside conditional. [RegularExpressions::ProhibitCaptureWithoutTest] severity = 3 # Use `eq' or hash instead of fixed-pattern regexps. [RegularExpressions::ProhibitFixedStringMatches] severity = 2 # Use only `//' or `{}' to delimit regexps. [RegularExpressions::ProhibitUnusualDelimiters] severity = 1 # In addition to allowing '{}', allow '()', '[]', and '{}'. # allow_all_brackets = # Use `{' and `}' to delimit multi-line regexps. [RegularExpressions::RequireBracesForMultiline] severity = 1 # In addition to allowing '{}', allow '()', '[]', and '{}'. # allow_all_brackets = # Always use the `/s' modifier with regular expressions. [RegularExpressions::RequireDotMatchAnything] severity = 2 # Always use the `/x' modifier with regular expressions. [RegularExpressions::RequireExtendedFormatting] severity = 3 # The number of characters that a regular expression must contain before this policy will complain. # Minimum value 0. No maximum. # minimum_regex_length_to_complain_about = 0 # Should regexes that only contain whitespace and word characters be complained about?. # strict = 0 # Always use the `/m' modifier with regular expressions. [RegularExpressions::RequireLineBoundaryMatching] severity = 2 # Don't call functions with a leading ampersand sigil. [Subroutines::ProhibitAmpersandSigils] severity = 2 # Don't declare your own `open' function. [Subroutines::ProhibitBuiltinHomonyms] severity = 2 # Minimize complexity by factoring code into smaller subroutines. [Subroutines::ProhibitExcessComplexity] severity = 4 # The maximum complexity score allowed. # Minimum value 1. No maximum. # max_mccabe = 20 # Return failure with bare `return' instead of `return undef'. [Subroutines::ProhibitExplicitReturnUndef] severity = 2 # Too many arguments. [Subroutines::ProhibitManyArgs] severity = 3 # The maximum number of arguments to allow a subroutine to have. # Minimum value 1. No maximum. # max_arguments = 5 # `sub never { sub correct {} }'. [Subroutines::ProhibitNestedSubs] severity = 5 # Behavior of `sort' is not defined if called in scalar context. [Subroutines::ProhibitReturnSort] severity = 5 # Don't write `sub my_function (@@) {}'. [Subroutines::ProhibitSubroutinePrototypes] severity = 5 # Prevent access to private subs in other packages. [Subroutines::ProtectPrivateSubs] severity = 3 # Pattern that determines what a private subroutine is. # private_name_regex = \b_\w+\b # Subroutines matching the private name regex to allow under this policy. # Values that are always included: POSIX::_PC_CHOWN_RESTRICTED, POSIX::_PC_LINK_MAX, POSIX::_PC_MAX_CANON, POSIX::_PC_MAX_INPUT, POSIX::_PC_NAME_MAX, POSIX::_PC_NO_TRUNC, POSIX::_PC_PATH_MAX, POSIX::_PC_PIPE_BUF, POSIX::_PC_VDISABLE, POSIX::_POSIX_ARG_MAX, POSIX::_POSIX_CHILD_MAX, POSIX::_POSIX_CHOWN_RESTRICTED, POSIX::_POSIX_JOB_CONTROL, POSIX::_POSIX_LINK_MAX, POSIX::_POSIX_MAX_CANON, POSIX::_POSIX_MAX_INPUT, POSIX::_POSIX_NAME_MAX, POSIX::_POSIX_NGROUPS_MAX, POSIX::_POSIX_NO_TRUNC, POSIX::_POSIX_OPEN_MAX, POSIX::_POSIX_PATH_MAX, POSIX::_POSIX_PIPE_BUF, POSIX::_POSIX_SAVED_IDS, POSIX::_POSIX_SSIZE_MAX, POSIX::_POSIX_STREAM_MAX, POSIX::_POSIX_TZNAME_MAX, POSIX::_POSIX_VDISABLE, POSIX::_POSIX_VERSION, POSIX::_SC_ARG_MAX, POSIX::_SC_CHILD_MAX, POSIX::_SC_CLK_TCK, POSIX::_SC_JOB_CONTROL, POSIX::_SC_NGROUPS_MAX, POSIX::_SC_OPEN_MAX, POSIX::_SC_PAGESIZE, POSIX::_SC_SAVED_IDS, POSIX::_SC_STREAM_MAX, POSIX::_SC_TZNAME_MAX, POSIX::_SC_VERSION, POSIX::_exit. # allow = # Always unpack `@_' first. [Subroutines::RequireArgUnpacking] severity = 3 # The number of statements to allow without unpacking. # Minimum value 0. No maximum. # short_subroutine_statements = 0 # Should unpacking from array slices and elements be allowed?. # allow_subscripts = 0 # Allow the usual delegation idiom to these namespaces/subroutines. # Values that are always included: NEXT::, SUPER::. # allow_delegation_to = # End every path through a subroutine with an explicit `return' statement. [Subroutines::RequireFinalReturn] severity = 2 # The additional subroutines to treat as terminal. # Values that are always included: Carp::confess, Carp::croak, confess, croak, die, exec, exit, throw. # terminal_funcs = # Prohibit various flavors of `no strict'. [TestingAndDebugging::ProhibitNoStrict] severity = 5 # Allow vars, subs, and/or refs. # allow = # Prohibit various flavors of `no warnings'. [TestingAndDebugging::ProhibitNoWarnings] severity = 4 # Permitted warning categories. # allow = # Allow "no warnings" if it restricts the kinds of warnings that are turned off. # allow_with_category_restriction = 0 # Don't turn off strict for large blocks of code. [TestingAndDebugging::ProhibitProlongedStrictureOverride] severity = 4 # The maximum number of statements in a no strict block. # Minimum value 1. No maximum. # statements = 3 # Tests should all have labels. [TestingAndDebugging::RequireTestLabels] severity = 3 # The additional modules to require labels for. # Values that are always included: Test::More. # modules = # Always `use strict'. [TestingAndDebugging::RequireUseStrict] severity = 5 # maximum_violations_per_document = 1 # The additional modules to treat as equivalent to "strict". # Values that are always included: Moose, Moose::Role, Moose::Util::TypeConstraints, strict. equivalent_modules = common::sense # Always `use warnings'. [TestingAndDebugging::RequireUseWarnings] severity = 5 # maximum_violations_per_document = 1 # The additional modules to treat as equivalent to "warnings". # Values that are always included: Moose, Moose::Role, Moose::Util::TypeConstraints, warnings. equivalent_modules = common::sense # Don't use the comma operator as a statement separator. [ValuesAndExpressions::ProhibitCommaSeparatedStatements] severity = 4 # Allow map and grep blocks to return lists. # allow_last_statement_to_be_comma_separated_in_map_and_grep = 0 # Don't `use constant FOO => 15'. [ValuesAndExpressions::ProhibitConstantPragma] severity = 2 # Write `q{}' instead of `'''. [ValuesAndExpressions::ProhibitEmptyQuotes] severity = 2 # Write `"\N{DELETE}"' instead of `"\x7F"', etc. [ValuesAndExpressions::ProhibitEscapedCharacters] severity = 2 # Use concatenation or HEREDOCs instead of literal line breaks in strings. [ValuesAndExpressions::ProhibitImplicitNewlines] severity = 3 # Always use single quotes for literal strings. [ValuesAndExpressions::ProhibitInterpolationOfLiterals] severity = 1 # Kinds of delimiters to permit, e.g. "qq{", "qq(", "qq[", "qq/". # allow = # If the string contains ' characters, allow "" to quote it. # allow_if_string_contains_single_quote = 0 # Write `oct(755)' instead of `0755'. [ValuesAndExpressions::ProhibitLeadingZeros] severity = 5 # Don't allow any leading zeros at all. Otherwise builtins that deal with Unix permissions, e.g. chmod, don't get flagged. # strict = 0 # Long chains of method calls indicate tightly coupled code. [ValuesAndExpressions::ProhibitLongChainsOfMethodCalls] severity = 2 # The number of chained calls to allow. # Minimum value 1. No maximum. # max_chain_length = 3 # Don't use values that don't explain themselves. [ValuesAndExpressions::ProhibitMagicNumbers] severity = 2 # maximum_violations_per_document = 10 # Individual and ranges of values to allow, and/or "all_integers". # allowed_values = 0 1 2 # Kind of literals to allow. # Valid values: Binary, Exp, Float, Hex, Octal. # allowed_types = Float # Should anything to the right of a "=>" be allowed?. # allow_to_the_right_of_a_fat_comma = 1 # Don't mix numeric operators with string operands, or vice-versa. [ValuesAndExpressions::ProhibitMismatchedOperators] severity = 3 # Write ` !$foo && $bar || $baz ' instead of ` not $foo && $bar or $baz'. [ValuesAndExpressions::ProhibitMixedBooleanOperators] severity = 4 # Use `q{}' or `qq{}' instead of quotes for awkward-looking strings. [ValuesAndExpressions::ProhibitNoisyQuotes] severity = 2 # Don't use quotes (`'', `"', ``') as delimiters for the quote-like operators. [ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] severity = 3 # The operators to allow single-quotes as delimiters for. # Valid values: m, q, qq, qr, qw, qx, s, tr, y. # single_quote_allowed_operators = m s qr qx # The operators to allow double-quotes as delimiters for. # Valid values: m, q, qq, qr, qw, qx, s, tr, y. # double_quote_allowed_operators = # The operators to allow back-quotes (back-ticks) as delimiters for. # Valid values: m, q, qq, qr, qw, qx, s, tr, y. # back_quote_allowed_operators = # Don't write ` print <<'__END__' '. [ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator] severity = 4 # Don't use strings like `v1.4' or `1.4.5' when including other modules. [ValuesAndExpressions::ProhibitVersionStrings] severity = 4 # Warns that you might have used single quotes when you really wanted double-quotes. [ValuesAndExpressions::RequireInterpolationOfMetachars] severity = 1 # RCS keywords to ignore in potential interpolation. # rcs_keywords = # Write ` 141_234_397.0145 ' instead of ` 141234397.0145 '. [ValuesAndExpressions::RequireNumberSeparators] severity = 2 # The minimum absolute value to require separators in. # Minimum value 10. No maximum. # min_value = 10_000 # Write ` print <<'THE_END' ' or ` print <<"THE_END" '. [ValuesAndExpressions::RequireQuotedHeredocTerminator] severity = 2 # Write ` <<'THE_END'; ' instead of ` <<'theEnd'; '. [ValuesAndExpressions::RequireUpperCaseHeredocTerminator] severity = 2 # Do not write ` my $foo = $bar if $baz; '. [Variables::ProhibitConditionalDeclarations] severity = 5 # Use `my' instead of `local', except when you have to. [Variables::ProhibitLocalVars] severity = 2 # Avoid `$`', `$&', `$'' and their English equivalents. [Variables::ProhibitMatchVars] severity = 4 # Eliminate globals declared with `our' or `use vars'. [Variables::ProhibitPackageVars] severity = 3 # The base set of packages to allow variables for. # packages = Data::Dumper File::Find FindBin Log::Log4perl # The set of packages to allow variables for, in addition to those given in "packages". # add_packages = # Use double colon (::) to separate package name components instead of single quotes ('). [Variables::ProhibitPerl4PackageNames] severity = 2 # Write `$EVAL_ERROR' instead of `$@'. [Variables::ProhibitPunctuationVars] severity = 1 # The additional variables to allow. # Values that are always included: $1, $2, $3, $4, $5, $6, $7, $8, $9, $_, @_, _. # allow = # Do not reuse a variable name in a lexical scope [Variables::ProhibitReusedNames] severity = 3 # The variables to not consider as duplicates. # allow = $self $class # Don't ask for storage you don't need. [Variables::ProhibitUnusedVariables] severity = 3 # Prevent access to private vars in other packages. [Variables::ProtectPrivateVars] severity = 3 # Write `local $foo = $bar;' instead of just `local $foo;'. [Variables::RequireInitializationForLocalVars] severity = 3 # Write `for my $element (@list) {...}' instead of `for $element (@list) {...}'. [Variables::RequireLexicalLoopIterators] severity = 5 # Magic variables should be assigned as "local". [Variables::RequireLocalizedPunctuationVars] severity = 5 # Global variables to exclude from this policy. # Values that are always included: $ARG, $_, @_. allow = %ENV # Negative array index should be used. [Variables::RequireNegativeIndices] severity = 4 XML-OPML-SimpleGen-0.07/t/01-func.t0000644000175000017500000000074212146672742016551 0ustar stephencstephenc#!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 = ; ok($old eq $data, "Basic function"); __DATA__ XML-OPML-SimpleGen-0.07/t/03-localefix.t0000644000175000017500000000154012146672743017564 0ustar stephencstephenc#!/usr/bin/env perl -T use strict; use warnings; use Test::More tests => 4; use POSIX qw/setlocale LC_ALL/; BEGIN { use_ok( 'XML::OPML::SimpleGen' ); } setlocale(LC_ALL, "ru_RU.utf8"); my $data = XML::OPML::SimpleGen->new()->as_string; like($data, qr/[a-z]{3}, {1,2}\d{1,2} [a-z]{3} \d{4} \d\d:\d\d:\d\d/i); #was Сбт, 31 Окт 2009 15:51:22 +0300 # { diag('RT77725'); my $opml = XML::OPML::SimpleGen->new; { my $lt = [ localtime(1328097661) ]; #2012-02-01 12:01:01 my $res = $opml->_date( dateCreated => $lt ); like($res, qr{[a-z]{3}, {1,2}\d{1,2} [a-z]{3} \d{4} \d\d:\d\d:\d\d}i ); } { my $lt = [ localtime(1330516861) ]; # 2012-02-28 12:01:01 my $res = $opml->_date( dateModified => $lt ); like($res, qr{[a-z]{3}, {1,2}\d{1,2} [a-z]{3} \d{4} \d\d:\d\d:\d\d}i ); } } done_testing; XML-OPML-SimpleGen-0.07/t/00-compile.t0000644000175000017500000000307712146672743017252 0ustar stephencstephenc#!perl use strict; use warnings; use Test::More; use File::Find; use File::Temp qw{ tempdir }; my @modules; find( sub { return if $File::Find::name !~ /\.pm\z/; my $found = $File::Find::name; $found =~ s{^lib/}{}; $found =~ s{[/\\]}{::}g; $found =~ s/\.pm$//; # nothing to skip push @modules, $found; }, 'lib', ); sub _find_scripts { my $dir = shift @_; my @found_scripts = (); find( sub { return unless -f; my $found = $File::Find::name; # nothing to skip open my $FH, '<', $_ or do { note( "Unable to open $found in ( $! ), skipping" ); return; }; my $shebang = <$FH>; return unless $shebang =~ /^#!.*?\bperl\b\s*$/; push @found_scripts, $found; }, $dir, ); return @found_scripts; } my @scripts; do { push @scripts, _find_scripts($_) if -d $_ } for qw{ bin script scripts }; my $plan = scalar(@modules) + scalar(@scripts); $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run"); { # fake home for cpan-testers local $ENV{HOME} = tempdir( CLEANUP => 1 ); like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" ) for sort @modules; SKIP: { eval "use Test::Script 1.05; 1;"; skip "Test::Script needed to test script compilation", scalar(@scripts) if $@; foreach my $file ( @scripts ) { my $script = $file; $script =~ s!.*/!!; script_compiles( $file, "$script script compiles" ); } } } XML-OPML-SimpleGen-0.07/t/02-parse.t0000644000175000017500000000055212146672743016731 0ustar stephencstephenc#!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;