Net-PH
view release on metacpan or search on metacpan
B<Debug> - Enable the printing of debugging information to STDERR
=back
=head1 METHODS
Unless otherwise stated all methods return either a I<true> or I<false>
value, with I<true> meaning that the operation was a success. When a method
states that it returns a value, failure will be returned as I<undef> or an
empty list.
=over 4
=item query( SEARCH [, RETURN ] )
$q = $ph->query({ name => $myname },
[qw(name email schedule)]);
foreach $handle (@{$q}) {
foreach $field (keys %{$handle}) {
$c = ${$handle}{$field}->code;
$v = ${$handle}{$field}->value;
$f = ${$handle}{$field}->field;
$t = ${$handle}{$field}->text;
print "field:[$field] [$c][$v][$f][$t]\n" ;
}
}
Search the database and return fields from all matching entries.
The C<SEARCH> argument is a reference to a HASH which contains field/value
pairs which will be passed to the Nameserver as the search criteria.
C<RETURN> is optional, but if given it should be a reference to a list which
contains field names to be returned.
The alternative syntax is to pass strings instead of references, for example
$q = $ph->query('name=myname',
'name email schedule');
The C<SEARCH> argument is a string that is passed to the Nameserver as the
search criteria. The strings being passed should B<not> contain any carriage
returns, or else the query command might fail or return invalid data.
C<RETURN> is optional, but if given it should be a string which will
contain field names to be returned.
Each match from the server will be returned as a HASH where the keys are the
field names and the values are C<Net::PH:Result> objects (I<code>, I<value>,
I<field>, I<text>).
Returns a reference to an ARRAY which contains references to HASHs, one
per match from the server.
=item change( SEARCH , MAKE )
$r = $ph->change({ email => "*.domain.name" },
{ schedule => "busy");
Change field values for matching entries.
The C<SEARCH> argument is a reference to a HASH which contains field/value
pairs which will be passed to the Nameserver as the search criteria.
The C<MAKE> argument is a reference to a HASH which contains field/value
pairs which will be passed to the Nameserver that
will set new values to designated fields.
The alternative syntax is to pass strings instead of references, for example
$r = $ph->change('email="*.domain.name"',
'schedule="busy"');
The C<SEARCH> argument is a string to be passed to the Nameserver as the
search criteria. The strings being passed should B<not> contain any carriage
returns, or else the query command might fail or return invalid data.
The C<MAKE> argument is a string to be passed to the Nameserver that
will set new values to designated fields.
Upon success all entries that match the search criteria will have
the field values, given in the Make argument, changed.
=item login( USER, PASS [, ENCRYPT ])
$r = $ph->login('username','password',1);
Enter login mode using C<USER> and C<PASS>. If C<ENCRYPT> is given and
is I<true> then the password will be used to encrypt a challenge text
string provided by the server, and the encrypted string will be sent back
to the server. If C<ENCRYPT> is not given, or I<false> then the password
will be sent in clear text (I<this is not recommended>)
=item logout()
$r = $ph->logout();
Exit login mode and return to anonymous mode.
=item fields( [ FIELD_LIST ] )
$fields = $ph->fields();
foreach $field (keys %{$fields}) {
$c = ${$fields}{$field}->code;
$v = ${$fields}{$field}->value;
$f = ${$fields}{$field}->field;
$t = ${$fields}{$field}->text;
print "field:[$field] [$c][$v][$f][$t]\n";
}
In a scalar context, returns a reference to a HASH. The keys of the HASH are
the field names and the values are C<Net::PH:Result> objects (I<code>,
I<value>, I<field>, I<text>).
In an array context, returns a two element array. The first element is a
reference to a HASH as above, the second element is a reference to an array
which contains the tag names in the order that they were returned from the
server.
C<FIELD_LIST> is a string that lists the fields for which info will be
returned.
=item add( FIELD_VALUES )
$r = $ph->add( { name => $name, phone => $phone });
This method is used to add new entries to the Nameserver database. You
must successfully call L<login> before this method can be used.
B<Note> that this method adds new entries to the database. To modify
an existing entry use L<change>.
( run in 1.842 second using v1.01-cache-2.11-cpan-39bf76dae61 )