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

question on return Perl object

Expand Messages
  • eat_lemon
    Hi, If soaplite return result is an object, is there any way I can prefix this object with the proper package name? For example If the return object type is
    Message 1 of 3 , Jan 25, 2002
      Hi,

      If soaplite return result is an object, is there any way I can prefix
      this object with the proper package name?

      For example

      If the return object type is "class", does soaplite provide any
      method for me to change it to "my::class"?

      Any help is greatly appreciated!

      Thanks,

      Simon
    • eat_lemon
      Hi Paul, One solution I had is to rebless the returned object from $som- result() with the proper package prefix (assuming MY is the package prefix): $class
      Message 2 of 3 , Jan 29, 2002
        Hi Paul,

        One solution I had is to rebless the returned object from
        $som->result() with the proper package prefix (assuming "MY" is the
        package prefix):

        $class = "MY::".ref($som->result());
        bless($som->result(), $class);

        This solution works for simple situiation. However, it gets messy
        for nested objects and arrays. Is there any way I could add the
        proper package prefix inside soaplite before it is returned inside
        SOM->result or add the prefix in SOM->result?

        This is quite urgent, any help is greatly appreciated.

        Thanks,

        Simon

        --- In soaplite@y..., "eat_lemon" <eat_lemon@y...> wrote:
        > Hi,
        >
        > If soaplite return result is an object, is there any way I can
        prefix
        > this object with the proper package name?
        >
        > For example
        >
        > If the return object type is "class", does soaplite provide any
        > method for me to change it to "my::class"?
        >
        > Any help is greatly appreciated!
        >
        > Thanks,
        >
        > Simon
      • Paul Kulchenko
        Hi, Simon! It can be done in SOAP::Lite (I need to think about it though), but I m not sure it s toolkit s responsibility. IMHO SOAP layer must be as
        Message 3 of 3 , Jan 29, 2002
          Hi, Simon!

          It can be done in SOAP::Lite (I need to think about it though), but
          I'm not sure it's toolkit's responsibility. IMHO SOAP layer must be
          as transparent as possible and if you want to make class A looks like
          My::A there are others ways to do that. Probably the easiest one is
          this:

          BEGIN { package A; @A:ISA = 'My::A' }

          later on A->method() will behave like My::A->method();

          You can create those classes on demand, probably using AUTOLOAD or
          UNIVERSAL::AUTOLOAD features. Let me know if it's far from what you
          need, we'll think about something else or I'll give you an example on
          how to do it in S::L.

          Best wishes, Paul.

          --- eat_lemon <eat_lemon@...> wrote:
          > Hi Paul,
          >
          > One solution I had is to rebless the returned object from
          > $som->result() with the proper package prefix (assuming "MY" is the
          >
          > package prefix):
          >
          > $class = "MY::".ref($som->result());
          > bless($som->result(), $class);
          >
          > This solution works for simple situiation. However, it gets messy
          > for nested objects and arrays. Is there any way I could add the
          > proper package prefix inside soaplite before it is returned inside
          > SOM->result or add the prefix in SOM->result?
          >
          > This is quite urgent, any help is greatly appreciated.
          >
          > Thanks,
          >
          > Simon
          >
          > --- In soaplite@y..., "eat_lemon" <eat_lemon@y...> wrote:
          > > Hi,
          > >
          > > If soaplite return result is an object, is there any way I can
          > prefix
          > > this object with the proper package name?
          > >
          > > For example
          > >
          > > If the return object type is "class", does soaplite provide any
          > > method for me to change it to "my::class"?
          > >
          > > Any help is greatly appreciated!
          > >
          > > Thanks,
          > >
          > > Simon
          >
          >
          > ------------------------ 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!?
          Great stuff seeking new owners in Yahoo! Auctions!
          http://auctions.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.