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

Re: null return values

Expand Messages
  • mbrutsch@intrusion.com
    Paul, I wish to return an empty string, as in $a = ; print $a; which returns no error with -w, but does with SOAP::Lite (perhaps you are treating an empty
    Message 1 of 5 , Apr 12 12:32 PM
    • 0 Attachment
      Paul,

      I wish to return an empty string, as in

      $a = "";
      print $a;

      which returns no error with -w, but does with SOAP::Lite (perhaps you
      are treating an empty string as undef?)


      > Hi, Michael!
      >
      > Because it's REAL null (undef) value. if you do
      > $a = undef;
      > print $a;
      >
      > you'll also get warning on this.
      >
      > in our situation it could be
      > $a = $soap->something->result; # returns undef
      > print $a;
      >
      > and you'll get warning again with -w.
      >
      > What did you expect to get? I tried to reproduce as much Perlish
      > behavior as possible :)
      >
      > Best wishes, Paul.
      >
      > --- mbrutsch@i... wrote:
      > > Whenever I return a null from a method call, I get the error "Use
      > > of
      > > uninitialized value". It works fine when I return anything else.
      > > Any thoughts?
    • Paul Kulchenko
      Hi, Michael! you re absolutely right. All simple types defined in spec will return undef value if transferred as or . As far as
      Message 2 of 5 , Apr 12 2:47 PM
      • 0 Attachment
        Hi, Michael!

        you're absolutely right. All simple types defined in spec will return
        undef value if transferred as <name ...../> or <name ....></name>. As
        far as I can understand it makes difference only for string (empty
        string becames undef), because for all other values empty string is
        not allowed value anyway. Since null/undef values are marked as such
        on wire or can be completely omitted I may convert undef string
        values back to empty strings in deserializer. Any objections?

        Best wishes, Paul.

        --- mbrutsch@... wrote:
        > Paul,
        >
        > I wish to return an empty string, as in
        >
        > $a = "";
        > print $a;
        >
        > which returns no error with -w, but does with SOAP::Lite (perhaps
        > you
        > are treating an empty string as undef?)
        >
        >
        > > Hi, Michael!
        > >
        > > Because it's REAL null (undef) value. if you do
        > > $a = undef;
        > > print $a;
        > >
        > > you'll also get warning on this.
        > >
        > > in our situation it could be
        > > $a = $soap->something->result; # returns undef
        > > print $a;
        > >
        > > and you'll get warning again with -w.
        > >
        > > What did you expect to get? I tried to reproduce as much Perlish
        > > behavior as possible :)
        > >
        > > Best wishes, Paul.
        > >
        > > --- mbrutsch@i... wrote:
        > > > Whenever I return a null from a method call, I get the error
        > "Use
        > > > of
        > > > uninitialized value". It works fine when I return anything
        > else.
        > > > Any thoughts?
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Get email at your own domain with Yahoo! Mail.
        http://personal.mail.yahoo.com/
      • Brutsch, Michael
        ... No, that would be fine. I am just ignoring the warnings, at this point. Everything else is working great! SOAP::Lite is most excellent! Thanks, Michael
        Message 3 of 5 , Apr 12 3:08 PM
        • 0 Attachment
          Paul Kulchenko wrote:

          > Hi, Michael!
          >
          > you're absolutely right. All simple types defined in spec will return
          > undef value if transferred as <name ...../> or <name ....></name>. As
          > far as I can understand it makes difference only for string (empty
          > string becames undef), because for all other values empty string is
          > not allowed value anyway. Since null/undef values are marked as such
          > on wire or can be completely omitted I may convert undef string
          > values back to empty strings in deserializer. Any objections?

          No, that would be fine. I am just ignoring the warnings, at this point.
          Everything else is working great! SOAP::Lite is most excellent!

          Thanks,
          Michael

          >
          > Best wishes, Paul.
          >
          > --- mbrutsch@... wrote:
          >
          >> Paul,
          >>
          >> I wish to return an empty string, as in
          >>
          >> $a = "";
          >> print $a;
          >>
          >> which returns no error with -w, but does with SOAP::Lite (perhaps
          >> you
          >> are treating an empty string as undef?)
          >>
          >>
          >>
          >>> Hi, Michael!
          >>>
          >>> Because it's REAL null (undef) value. if you do
          >>> $a = undef;
          >>> print $a;
          >>>
          >>> you'll also get warning on this.
          >>>
          >>> in our situation it could be
          >>> $a = $soap->something->result; # returns undef
          >>> print $a;
          >>>
          >>> and you'll get warning again with -w.
          >>>
          >>> What did you expect to get? I tried to reproduce as much Perlish
          >>> behavior as possible :)
          >>>
          >>> Best wishes, Paul.
          >>>
          >>> --- mbrutsch@i... wrote:
          >>>
          >>>> Whenever I return a null from a method call, I get the error
          >>>
          >> "Use
          >>
          >>>> of
          >>>> uninitialized value". It works fine when I return anything
          >>>
          >> else.
          >>
        Your message has been successfully submitted and would be delivered to recipients shortly.