Oh, well, whatever you want, as specifically as you expect is what to do. If the XMLin() will always return a HashRef for your data, then specify that. Otherwise something like \my $moo; can be considered valid XML in your object layer. Better to catch problems early. I think you can | (OR) stuff together too if you need to consider ArrayRef as well. I'm not even sure if XML::Simple allows for that. While we're on the topic XML::Simple is not really anyone's friend except in the most predictable and unchanging use. See Examples where XML::Simple is the optimal choice? and Stepping up from XML::Simple to XML::LibXML.
| [reply] [d/l] [select] |
| [reply] |
| [reply] |
That depends a bit on what your XML looks like - XMLin will usually return a hashref, but there is some XML that will cause it to return an arrayref. So if you wanted to play it safe you could say isa => 'HashRef | ArrayRef', or if you know your XML will always look a certain way and so XMLin will always return a hashref, just say isa => 'HashRef', which should make the rest of your code easier because it doesn't have to check every time if it's a hashref or arrayref. Ref is a superset that includes a whole lot more than hashrefs and arrayrefs, so it's probably too general. For all the details see Moose::Manual::Types. By the way, XML::Simple is not really recommended for new code, see for example this thread.
(Update: Your Mother already replied as I was typing, so yeah :-) )
| [reply] [d/l] [select] |
| [reply] |
| [reply] |