Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to create objects from non-XML sources? #13

Open
sillitoe opened this issue Nov 2, 2018 · 0 comments
Open

Best way to create objects from non-XML sources? #13

sillitoe opened this issue Nov 2, 2018 · 0 comments

Comments

@sillitoe
Copy link

sillitoe commented Nov 2, 2018

Hi,

I've used XML::Rabbit to help me parse XML files into objects for lots of different projects. It works beautifully (thank you).

I now need to create some of these XML::Rabbit objects from a non-XML source (ie database) and export as XML. I would like to reuse as much code as possible.

I'm using MooseX::Templated to export the XML and that works fine (see test case).

I just need to be able to create the objects manually rather than from XML source, eg

Foo->new( id => 'my id', bars => [ Foo::Bar->new() ] );

Doing this currently makes XML::Rabbit complain about missing required attributes and not providing file, xml, etc.

Attribute (_node), passed as (node), is required at constructor Foo::Bar::new 
(defined at /[...]/.plenv/versions/5.12.5/lib/perl5/site_perl/5.12.5/XML/Rabbit/Sugar.pm line 136) line 30

So, do you have any suggestions for the best way to go about bypassing all the XML::Rabbit requirements and just fallback to the requirements of the Moose attributes?

I'm playing about with a test case here. I'm happy to write it up as a PR if you could point me in the right direction.

Best,

Ian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant