Menu

#21 listify all XSD type objects when called as @{}

closed
5
2007-11-06
2007-11-06
Anonymous
No

It would be very useful to be able to write the following idiom (safely):

for (@{$complexType->get_element}) {
}

This is especially useful when called from other "languages" like HTML::Template::Compiled, where you cannot do something like

$result = [ $result ] if ref $result ne 'ARRAY';
for (@{ $result })

Discussion

  • Martin Kutter

    Martin Kutter - 2007-11-06

    Logged In: YES
    user_id=884175
    Originator: NO

    The easiest way to fulfill this would be adding an :ARRAIFY method to SOAP::WSDL::XSD::Typelib::Builtin::anyType. This would result in the following behaviour:

    Calling $complexType->get_element

    - get_element is a list ref:
    all fine, nothing triggered

    - get_element is an object:
    arraify triggered, should return [ $self ]

    - get_element is undef:
    remains undef.

    So you have to write something like this in HTC:

    <%IF_DEFINED complexType.get_element %>
    <%LOOP complexType.get_element %>

     
  • Martin Kutter

    Martin Kutter - 2007-11-06

    Logged In: YES
    user_id=884175
    Originator: NO

    Fixed in rev353 in SVN.

     
  • Martin Kutter

    Martin Kutter - 2007-11-06
    • status: open --> closed
     

Log in to post a comment.

Auth0 Logo