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

help using iterator w/Class::DBI

Expand Messages
  • qglex <qglex@yahoo.com>
    I can t seem to get an iterator via Class::DBI to work using SOAP::Lite. #!/usr/local/bin/perl use SOAP::Lite; my $soap = SOAP::Lite -
    Message 1 of 2 , Jan 8, 2003
    View Source
    • 0 Attachment
      I can't seem to get an iterator via Class::DBI to work using SOAP::Lite.

      #!/usr/local/bin/perl
      use SOAP::Lite;
      my $soap = SOAP::Lite
      -> uri('http://myhost/MyDB/Tbl')
      -> proxy('http://myhost/soap/mysoap.cgi');

      my $result=$soap->retrieve_all();
      unless ($result->fault) {
      print "Result=", Dumper $result->result;
      }

      This gives me the object I'm looking for:
      Result=$VAR1 = bless( {
      'status' => 'U',
      .
      .
      .
      }, 'MyDB::Tbl'}

      Trying to access it's iterator (next()) I get:

      Can't locate object method "next" via package "MyDB::Tbl" ...

      How do I access the MyDB::Tbl's iterator (which is a subclass of
      Class::DBI), from the client? For example, in a typical script it'd be:

      #!/usr/local/bin/perl
      use MyDB::Tbl;
      my $obj=MyDB::Tbl->new();
      my $r=$obj->search(column=>0); #returns multiple values
      #print Dumper $a;
      while (my $it=$r->next)
      {
      print "id of record:",
      $it->id(), "\n";
      }

      Perl5.8..

      Thanks
    • Paul Kulchenko
      ... if that information IS in the object itself, then it might be enough to add use MyDB::Tbl . if that information is returned from a remote host then you
      Message 2 of 2 , Jan 8, 2003
      View Source
      • 0 Attachment
        > Can't locate object method "next" via package "MyDB::Tbl" ...
        >
        > How do I access the MyDB::Tbl's iterator (which is a subclass of
        > Class::DBI), from the client? For example, in a typical script

        if that information IS in the object itself, then it might be enough
        to add "use MyDB::Tbl".
        if that information is returned from a remote host then you need to
        use autodispatch feature:

        # > use MyDB::Tbl;

        use SOAP::Lite +autodispatch =>
        -> uri('http://myhost/MyDB/Tbl')
        -> proxy('http://myhost/soap/mysoap.cgi');

        > my $obj=MyDB::Tbl->new();
        > my $r=$obj->search(column=>0); #returns multiple values
        > #print Dumper $a;
        > while (my $it=$r->next)
        > {
        > print "id of record:",
        > $it->id(), "\n";
        > }

        If that object (MyDB::Tbl) is not serializable (has references to
        file/db handles, glob or something similar) you may need to look at
        objects_by_reference feature. Hope it helps.

        Best wishes, Paul.

        --- "qglex <qglex@...>" <qglex@...> wrote:
        > I can't seem to get an iterator via Class::DBI to work using
        > SOAP::Lite.
        >
        > #!/usr/local/bin/perl
        > use SOAP::Lite;
        > my $soap = SOAP::Lite
        > -> uri('http://myhost/MyDB/Tbl')
        > -> proxy('http://myhost/soap/mysoap.cgi');
        >
        > my $result=$soap->retrieve_all();
        > unless ($result->fault) {
        > print "Result=", Dumper $result->result;
        > }
        >
        > This gives me the object I'm looking for:
        > Result=$VAR1 = bless( {
        > 'status' => 'U',
        > .
        > .
        > .
        > }, 'MyDB::Tbl'}
        >
        > Trying to access it's iterator (next()) I get:
        >
        > Can't locate object method "next" via package "MyDB::Tbl" ...
        >
        > How do I access the MyDB::Tbl's iterator (which is a subclass of
        > Class::DBI), from the client? For example, in a typical script
        > it'd be:
        >
        > #!/usr/local/bin/perl
        > use MyDB::Tbl;
        > my $obj=MyDB::Tbl->new();
        > my $r=$obj->search(column=>0); #returns multiple values
        > #print Dumper $a;
        > while (my $it=$r->next)
        > {
        > print "id of record:",
        > $it->id(), "\n";
        > }
        >
        > Perl5.8..
        >
        > Thanks
        >
        >
        > ------------------------ 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!?
        Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
        http://mailplus.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.