The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OP::ForeignTable - Class factory for OP::ForeignRow

DESCRIPTION

OP::ForeignRow responds to the same messages as OP::RRNode, except ForeignRow objects live in databases of external applications with schemas which are not defined by OP.

Callers specify DB connection parameters, and ForeignTable returns a dynamically allocated ForeignRow subclass representing the table which was described.

SYNOPSIS

  use OP;

  use OP::ForeignRow;
  use OP::ForeignTable;

  my $table = OP::ForeignTable->new(
    db      => "somedb",
    host    => "somehost",
    table   => "sometable",
    user    => "myuser",
    pass    => "mypass",
  );

  #
  # Return an "anonymous" OP::ForeignRow subclass representing
  # the described datasource. Instances of ForeignRow represent
  # rows in the foreign table.
  #
  my $class = $table->objectClass;

  print $class;
  print "\n";

  $class->allNames->each( sub {
    print "Have name: $_\n";

    my $object = $class->loadByName($_);
  } );

SEE ALSO

This file is part of OP.