diff --git a/Build.PL b/Build.PL index ca0a333..40f3bab 100644 --- a/Build.PL +++ b/Build.PL @@ -3,26 +3,33 @@ use warnings; use Module::Build; my $builder = Module::Build->new( - module_name => 'W3C::SOAP::Parse::XSD', - license => 'perl', - dist_author => 'Ivan Wills ', - dist_version_from => 'lib/W3C/SOAP/Parse/XSD.pm', - requires => { - 'perl' => 5.008, - }, - build_requires => { - 'Test::More' => 0, - 'Test::NoWarnings' => 0, - }, - add_to_cleanup => [ 'W3C-SOAP-Parse-XSD-*' ], - create_makefile_pl => 'traditional', - create_license => 1, - meta_merge => { - resources => { - repository => 'git://github.com/ivanwills/W3C-SOAP-Parse-XSD.git', - bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=W3C::SOAP::Parse::XSD', - }, - }, + module_name => 'W3C::SOAP::XSD', + license => 'perl', + dist_author => 'Ivan Wills ', + dist_version_from => 'lib/W3C/SOAP/XSD.pm', + requires => { + 'perl' => 5.008, + 'XML::LibXML' => 0, + 'Moose' => 1, + }, + build_requires => { + 'Test::More' => 0, + 'Test::NoWarnings' => 0, + }, + share_dir => { + dist => [ + 'templates', + ], + }, + add_to_cleanup => [ 'W3C-SOAP-XSD-*' ], + create_makefile_pl => 'traditional', + create_license => 1, + meta_merge => { + resources => { + repository => 'git://github.com/ivanwills/W3C-SOAP-XSD.git', + bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=W3C::SOAP::XSD', + }, + }, ); $builder->create_build_script(); diff --git a/Changes b/Changes index 479a324..368c2d7 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,4 @@ -Revision history for W3C-SOAP-Parse-XSD +Revision history for W3C-SOAP-XSD 0.0.1 Date/time First version, released on an unsuspecting world. diff --git a/LICENSE b/LICENSE index 38df705..9d679f0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -This software is copyright (c) 2010 by Ivan Wills . +This software is copyright (c) 2012 by Ivan Wills . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,21 +12,22 @@ b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2010 by Ivan Wills . +This software is Copyright (c) 2012 by Ivan Wills . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + 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 + Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public @@ -67,7 +68,7 @@ authors' reputations. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which @@ -185,7 +186,7 @@ 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 + 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 @@ -207,9 +208,9 @@ 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 + END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + 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 @@ -235,8 +236,9 @@ the exclusion of warranty; and each file should have at least 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + 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. @@ -270,7 +272,7 @@ That's all there is to it! --- The Artistic License 1.0 --- -This software is Copyright (c) 2010 by Ivan Wills . +This software is Copyright (c) 2012 by Ivan Wills . This is free software, licensed under: @@ -290,21 +292,21 @@ Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through - textual modification. + 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. + Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for - the package. + 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.) + 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. + 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 diff --git a/MANIFEST b/MANIFEST index a3d30e0..89b00d7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -6,7 +6,14 @@ MANIFEST.SKIP META.yml Makefile.PL README -lib/W3C/SOAP/Parse/XSD.pm +bin/xsd-parser +lib/W3C/SOAP/XSD.pm +lib/W3C/SOAP/XSD/Document.pm +lib/W3C/SOAP/XSD/Document/ComplexType.pm +lib/W3C/SOAP/XSD/Document/Element.pm +lib/W3C/SOAP/XSD/Document/Node.pm +lib/W3C/SOAP/XSD/Document/SimpleType.pm +lib/W3C/SOAP/XSD/Traits.pm t/00-load.t t/boilerplate.t t/critic.t @@ -15,3 +22,7 @@ t/pod-coverage.t t/pod.t t/perlcriticrc t/spelling.t +templates/xsd.pm.tt +templates/xsd_base.pm.tt +templates/xsd_element.pm.tt +META.json diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 9996e00..768a029 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -60,4 +60,6 @@ Debian_CPANTS.txt \bnytprof* # Avoid archives of this distribution -\bW3C-SOAP-Parse-XSD-[\d\.\_]+ +\bW3C-SOAP-XSD-[\d\.\_]+ +errors.err +tags diff --git a/README b/README index 3047630..17d50fd 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -W3C-SOAP-Parse-XSD +W3C-SOAP-XSD The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for @@ -25,24 +25,24 @@ SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. - perldoc W3C::SOAP::Parse::XSD + perldoc W3C::SOAP::XSD You can also look for information at: RT, CPAN's request tracker - http://rt.cpan.org/NoAuth/Bugs.html?Dist=W3C-SOAP-Parse-XSD + http://rt.cpan.org/NoAuth/Bugs.html?Dist=W3C-SOAP-XSD AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/W3C-SOAP-Parse-XSD + http://annocpan.org/dist/W3C-SOAP-XSD CPAN Ratings - http://cpanratings.perl.org/d/W3C-SOAP-Parse-XSD + http://cpanratings.perl.org/d/W3C-SOAP-XSD Search CPAN - http://search.cpan.org/dist/W3C-SOAP-Parse-XSD/ + http://search.cpan.org/dist/W3C-SOAP-XSD/ Source Code - git://github.com/ivanwills/W3C-SOAP-Parse-XSD.git + git://github.com/ivanwills/W3C-SOAP-XSD.git COPYRIGHT AND LICENCE diff --git a/bin/xsd-parser b/bin/xsd-parser index ae8cc30..6ae5e84 100755 --- a/bin/xsd-parser +++ b/bin/xsd-parser @@ -18,7 +18,9 @@ use Data::Dumper qw/Dumper/; use English qw/ -no_match_vars /; use FindBin qw/$Bin/; use Path::Class; +use Template; use W3C::SOAP::XSD::Document; +use File::ShareDir qw/dist_dir/; our $VERSION = version->new('0.0.1'); my ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs; @@ -49,7 +51,6 @@ sub main { 'help', 'VERSION!', ) or pod2usage(2); - #my $file = join ' ', @ARGV; if ( $option{'VERSION'} ) { print "$name Version = $VERSION\n"; @@ -65,9 +66,26 @@ sub main { # do stuff here my $file = shift @ARGV; my @xsd = (W3C::SOAP::XSD::Document->new( location => $file, ns_module_map => $option{ns} )); + my $template = Template->new( + INCLUDE_PATH => dist_dir('W3C-SOAP-XSD'), + INTERPOLATE => 0, + EVAL_PERL => 1, + ); while ( my $xsd = shift @xsd ) { print "Namespace = " . $xsd->target_namespace . "\n"; + my $file = $xsd->get_module_base($xsd->target_namespace); + $file =~ s{::}{/}g; + $file = file $file; + my $parent = $file->parent; + my @missing; + while ( !-d $parent ) { + push @missing, $parent; + $parent = $parent->parent; + } + mkdir $_ for reverse @missing; + + $template->process('xsd.pm.tt', {xsd => $xsd}, "$file.pm"); print "Imports:\n"; for my $type ( @{ $xsd->imports } ) { print "\t", $type->target_namespace, "\n"; diff --git a/t/00-load.t b/t/00-load.t index 2f30bec..565d07c 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -6,7 +6,7 @@ use Test::More tests => 1 + 1; use Test::NoWarnings; BEGIN { - use_ok( 'W3C::SOAP::Parse::XSD' ); + use_ok( 'W3C::SOAP::XSD' ); } -diag( "Testing W3C::SOAP::Parse::XSD $W3C::SOAP::Parse::XSD::VERSION, Perl $], $^X" ); +diag( "Testing W3C::SOAP::XSD $W3C::SOAP::XSD::VERSION, Perl $], $^X" ); diff --git a/t/boilerplate.t b/t/boilerplate.t index 0616b28..8cb0bcc 100644 --- a/t/boilerplate.t +++ b/t/boilerplate.t @@ -52,5 +52,5 @@ TODO: { } -module_boilerplate_ok('lib/W3C-SOAP-Parse-XSD/t/boilerplate.t.pm'); +module_boilerplate_ok('lib/W3C-SOAP-XSD/t/boilerplate.t.pm');