659 |
} |
} |
660 |
|
|
661 |
|
|
662 |
|
package Search::Estraier::Node; |
663 |
|
|
664 |
|
use Carp qw/croak/; |
665 |
|
|
666 |
|
=head1 Search::Estraier::Node |
667 |
|
|
668 |
|
=head2 new |
669 |
|
|
670 |
|
my $node = new Search::HyperEstraier::Node; |
671 |
|
|
672 |
|
=cut |
673 |
|
|
674 |
|
sub new { |
675 |
|
my $class = shift; |
676 |
|
my $self = { |
677 |
|
pxport => -1, |
678 |
|
timeout => -1, |
679 |
|
dnum => -1, |
680 |
|
wnum => -1, |
681 |
|
size => -1.0, |
682 |
|
wwidth => 480, |
683 |
|
hwidth => 96, |
684 |
|
awidth => 96, |
685 |
|
status => -1, |
686 |
|
}; |
687 |
|
bless($self, $class); |
688 |
|
|
689 |
|
$self ? return $self : return undef; |
690 |
|
} |
691 |
|
|
692 |
|
=head2 set_url |
693 |
|
|
694 |
|
Specify URL to node server |
695 |
|
|
696 |
|
$node->set_url('http://localhost:1978'); |
697 |
|
|
698 |
|
=cut |
699 |
|
|
700 |
|
sub set_url { |
701 |
|
my $self = shift; |
702 |
|
$self->{url} = shift; |
703 |
|
} |
704 |
|
|
705 |
|
=head2 set_proxy |
706 |
|
|
707 |
|
Specify proxy server to connect to node server |
708 |
|
|
709 |
|
$node->set_proxy('proxy.example.com', 8080); |
710 |
|
|
711 |
|
=cut |
712 |
|
|
713 |
|
sub set_proxy { |
714 |
|
my $self = shift; |
715 |
|
my ($host,$port) = @_; |
716 |
|
croak "proxy port must be number" unless ($port =~ m/^\d+$/); |
717 |
|
$self->{pxhost} = $host; |
718 |
|
$self->{pxport} = $port; |
719 |
|
} |
720 |
|
|
721 |
|
=head2 set_timeout |
722 |
|
|
723 |
|
Specify timeout of connection in seconds |
724 |
|
|
725 |
|
$node->set_timeout( 15 ); |
726 |
|
|
727 |
|
=cut |
728 |
|
|
729 |
|
sub set_timeout { |
730 |
|
my $self = shift; |
731 |
|
my $sec = shift; |
732 |
|
croak "timeout must be number" unless ($sec =~ m/^\d+$/); |
733 |
|
$self->{timeout} = $sec; |
734 |
|
} |
735 |
|
|
736 |
package Search::Estraier::Master; |
package Search::Estraier::Master; |
737 |
|
|
738 |
use Carp; |
use Carp; |