Loading ...
Sorry, an error occurred while loading the content.

reader sub

Expand Messages
  • mrdamnfrenchy
    Hi, would it be possible to return from a handler, a reader sub instead of a list of values. For example: sub enumerate { my ($start,$end) = @_; return
    Message 1 of 1 , Jan 29, 2002
    • 0 Attachment
      Hi,

      would it be possible to return from a handler, a reader sub instead of a list of values.

      For example:

      sub enumerate {
      my ($start,$end) = @_;
      return ($end-$start, sub { $start < $end ? $start++ : undef });
      }

      That way, when SOAP::Lite looks at the result from the handler, it replaces the array with the return value of the closure, until that closure returns undef.

      Why do I want this? I tend to deal with large amount of elements, and passing the array back to SOAP::Lite, and then SOAP::Lite encoding it, and so on, tends to result in a heavy use of memory. This would mean that my code never has to keep more than 1 element at a time in memory.

      Another possible improvement would be for the XML serializer to be able to spit out it's XML to STDOUT (or wherever it's supposed to go) right away, instead of encoding the whole thing in memory and then sending it.

      -Mathieu
    Your message has been successfully submitted and would be delivered to recipients shortly.