| 1 | # You may distribute under the terms of the GNU General Public License | ||||||||||||||||||||
| 2 | # | ||||||||||||||||||||
| 3 | # (C) Paul Evans, 2008-2012 -- leonerd@leonerd.org.uk | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Circle::Net::Raw; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 4 | ▶ | use base qw( Tangence::Object Circle::WindowItem Circle::Ruleable ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 4 | __PACKAGE__->APPLY_Ruleable; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 4 | our $VERSION = '0.173320'; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 4 | ▶ | use constant NETTYPE => 'raw'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 4 | ▶ | use base qw( Circle::Rule::Store ); # for the attributes | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 4 | ▶ | use Text::Balanced qw( extract_delimited ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 4 | ▶ | use Circle::TaggedString; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 4 | ▶ | use Circle::Widget::Box; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 4 | ▶ | use Circle::Widget::Label; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | sub new | ||||||||||||||||||||
| 27 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 28 | 2 | my $class = shift; | |||||||||||||||||||
| 29 | 2 | my %args = @_; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 2 | my $self = $class->SUPER::new( %args ); | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 2 | $self->{loop} = $args{loop}; | |||||||||||||||||||
| 34 | 2 | $self->{root} = $args{root}; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 2 | $self->set_prop_tag( $args{tag} ); | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 2 | $self->{host} = undef; | |||||||||||||||||||
| 39 | 2 | $self->{port} = undef; | |||||||||||||||||||
| 40 | 2 | $self->{echo} = 1; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 2 | my $rulestore = $self->init_rulestore( parent => $args{root}->{rulestore} ); | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 2 | $rulestore->register_action( "sendline" => $self ); | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 2 | $rulestore->new_chain( "input" ); | |||||||||||||||||||
| 47 | 2 | $rulestore->new_chain( "output" ); | |||||||||||||||||||
| 48 | 2 | $rulestore->new_chain( "connected" ); | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 2 | return $self; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | sub describe | ||||||||||||||||||||
| 54 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
describe: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 55 | 2 | my $self = shift; | |||||||||||||||||||
| 56 | 2 | return __PACKAGE__."[" . $self->get_prop_tag . "]"; | |||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | sub parse_action_sendline | ||||||||||||||||||||
| 60 | 0 | ▶ | : Rule_description("Send a line of text to the peer") | ||||||||||||||||||
|
Subroutine
parse_action_sendline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 61 | : Rule_format('$text') | ||||||||||||||||||||
| 62 | { | ||||||||||||||||||||
| 63 | 0 | my $self = shift; | |||||||||||||||||||
| 64 | 0 | my ( $spec ) = @_; | |||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | my $text = extract_delimited( $spec, q{"} ); | |||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | # Trim leading and trailing " | ||||||||||||||||||||
| 69 | 0 | s/^"//, s/"$// for $text; | |||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | # Unescape intermediate \\ and \" | ||||||||||||||||||||
| 72 | 0 | $text =~ s/\\([\\"])/$1/g; | |||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 0 | return $text; | |||||||||||||||||||
| 75 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | sub deparse_action_sendline | ||||||||||||||||||||
| 78 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
deparse_action_sendline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 79 | 0 | my $self = shift; | |||||||||||||||||||
| 80 | 0 | my ( $text ) = @_; | |||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 0 | $text =~ s/([\\"])/\\$1/g; | |||||||||||||||||||
| 83 | 0 | return qq{"$text"}; | |||||||||||||||||||
| 84 | } | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | sub eval_action_sendline | ||||||||||||||||||||
| 87 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
eval_action_sendline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 88 | 0 | my $self = shift; | |||||||||||||||||||
| 89 | 0 | my ( $event, $results, $text ) = @_; | |||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 0 | ▶ | if( my $conn = $self->{conn} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | 0 | $conn->write( "$text\r\n" ); | |||||||||||||||||||
| 93 | } | ||||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | sub command_connect | ||||||||||||||||||||
| 97 | 1 | ▶ | : Command_description("Connect to the server") | ||||||||||||||||||
|
Subroutine
command_connect: called CC=5 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 98 | : Command_arg('host?') | ||||||||||||||||||||
| 99 | : Command_arg('port?') | ||||||||||||||||||||
| 100 | { | ||||||||||||||||||||
| 101 | 1 | my $self = shift; | |||||||||||||||||||
| 102 | 1 | my ( $host, $port, $cinv ) = @_; | |||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 1 | ▶ | $host ||= $self->{host}; | ||||||||||||||||||
|
Condition33%1/3
$host ||= $self->{"host"}
MC/DC0%0/2
$host ||= $self->{"host"}
$host
$self->{"host"}
Truth table33%1/3
A ||= B
A= $hostB= $self->{"host"}
| |||||||||||||||||||||
| 105 | 1 | ▶ | $port ||= $self->{port}; # 0 is not a valid TCP port | ||||||||||||||||||
|
Condition33%1/3
$port ||= $self->{"port"}
MC/DC0%0/2
$port ||= $self->{"port"}
$port
$self->{"port"}
Truth table33%1/3
A ||= B
A= $portB= $self->{"port"}
| |||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 1 | ▶ | defined $host or return $cinv->responderr( "Cannot connect - no host defined" ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 108 | 1 | ▶ | defined $port or return $cinv->responderr( "Cannot connect - no port defined" ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 1 | my $loop = $self->{loop}; | |||||||||||||||||||
| 111 | $loop->connect( | ||||||||||||||||||||
| 112 | host => $host, | ||||||||||||||||||||
| 113 | service => $port, | ||||||||||||||||||||
| 114 | socktype => 'stream', | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 1 | ▶ | on_connected => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.3
| |||||||||||||||||||||
| 117 | 1 | my ( $sock ) = @_; | |||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 1 | $cinv->respond( "Connected to $host:$port", level => 1 ); | |||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | my $conn = $self->{conn} = IO::Async::Stream->new( | ||||||||||||||||||||
| 122 | handle => $sock, | ||||||||||||||||||||
| 123 | 2 | ▶ | on_read => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 124 | 2 | my ( undef, $buffref, $closed ) = @_; | |||||||||||||||||||
| 125 | 2 | ▶ | return 0 unless $$buffref =~ s/^([^\r\n]*)\r?\n//; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | 2 | $self->incoming_text( $1 ); | |||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | 2 | return 1; | |||||||||||||||||||
| 130 | }, | ||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | 0 | ▶ | on_closed => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 133 | 0 | $self->push_displayevent( "status", { text => "Connection closed by peer" } ); | |||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | 0 | $self->set_prop_connected(0); | |||||||||||||||||||
| 136 | 0 | $self->fire_event( disconnected => ); | |||||||||||||||||||
| 137 | 0 | undef $self->{conn}; | |||||||||||||||||||
| 138 | }, | ||||||||||||||||||||
| 139 | 1 | ); | |||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | 1 | $loop->add( $conn ); | |||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 1 | $self->run_rulechain( "connected" ); | |||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | 1 | $self->set_prop_connected(1); | |||||||||||||||||||
| 146 | 1 | $self->fire_event( connected => $host, $port ); | |||||||||||||||||||
| 147 | }, | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 0 | ▶ | on_resolve_error => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 150 | 0 | $cinv->responderr( "Unable to resolve $host:$port - $_[0]", level => 3 ); | |||||||||||||||||||
| 151 | }, | ||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | 0 | ▶ | on_connect_error => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 154 | 0 | $cinv->responderr( "Unable to connect to $host:$port", level => 3 ); | |||||||||||||||||||
| 155 | }, | ||||||||||||||||||||
| 156 | 1 | ); | |||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 1 | return; | |||||||||||||||||||
| 159 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | sub command_discon | ||||||||||||||||||||
| 162 | 0 | ▶ | : Command_description( "Disconnect TCP port" ) | ||||||||||||||||||
|
Subroutine
command_discon: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 163 | { | ||||||||||||||||||||
| 164 | 0 | my $self = shift; | |||||||||||||||||||
| 165 | 0 | my ( $cinv ) = @_; | |||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 0 | ▶ | if( my $conn = $self->{conn} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 168 | 0 | $conn->close; | |||||||||||||||||||
| 169 | 0 | undef $self->{conn}; | |||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | 0 | $cinv->respond( "Disconnected", level => 1 ); | |||||||||||||||||||
| 172 | } | ||||||||||||||||||||
| 173 | else { | ||||||||||||||||||||
| 174 | 0 | $cinv->responderr( "Not connected" ); | |||||||||||||||||||
| 175 | } | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | 0 | return; | |||||||||||||||||||
| 178 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | sub connected | ||||||||||||||||||||
| 181 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
connected: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 182 | 0 | my $self = shift; | |||||||||||||||||||
| 183 | 0 | defined $self->{conn}; | |||||||||||||||||||
| 184 | } | ||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | sub command_close | ||||||||||||||||||||
| 187 | 0 | ▶ | : Command_description("Disconnect and close the window") | ||||||||||||||||||
|
Subroutine
command_close: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 188 | { | ||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | 0 | ▶ | if( my $conn = $self->{conn} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 192 | 0 | $conn->close; | |||||||||||||||||||
| 193 | 0 | undef $self->{conn}; | |||||||||||||||||||
| 194 | } | ||||||||||||||||||||
| 195 | |||||||||||||||||||||
| 196 | 0 | $self->destroy; | |||||||||||||||||||
| 197 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | sub do_send | ||||||||||||||||||||
| 200 | 1 | ▶ | { | ||||||||||||||||||
|
Subroutine
do_send: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||
| 201 | 1 | my $self = shift; | |||||||||||||||||||
| 202 | 1 | my ( $text ) = @_; | |||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | # TODO: Line separator | ||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | 1 | ▶ | if( my $conn = $self->{conn} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 207 | 1 | my $event = { | |||||||||||||||||||
| 208 | text => Circle::TaggedString->new( $text ), | ||||||||||||||||||||
| 209 | }; | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | 1 | $self->run_rulechain( "output", $event ); | |||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | 1 | my $str = $event->{text}->str; | |||||||||||||||||||
| 214 | 1 | $conn->write( "$str\r\n" ); | |||||||||||||||||||
| 215 | |||||||||||||||||||||
| 216 | 1 | ▶ | $self->push_displayevent( "text", { text => $event->{text} } ) if $self->{echo}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 217 | } | ||||||||||||||||||||
| 218 | else { | ||||||||||||||||||||
| 219 | 0 | $self->responderr( "Not connected" ); | |||||||||||||||||||
| 220 | } | ||||||||||||||||||||
| 221 | } | ||||||||||||||||||||
| 222 | |||||||||||||||||||||
| 223 | sub enter_text | ||||||||||||||||||||
| 224 | 1 | ▶ | { | ||||||||||||||||||
|
Subroutine
enter_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 225 | 1 | my $self = shift; | |||||||||||||||||||
| 226 | 1 | my ( $text ) = @_; | |||||||||||||||||||
| 227 | |||||||||||||||||||||
| 228 | 1 | $self->do_send( $text ); | |||||||||||||||||||
| 229 | } | ||||||||||||||||||||
| 230 | |||||||||||||||||||||
| 231 | sub command_send | ||||||||||||||||||||
| 232 | 0 | ▶ | : Command_description('Send a line of text') | ||||||||||||||||||
|
Subroutine
command_send: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 233 | : Command_arg('text', eatall => 1) | ||||||||||||||||||||
| 234 | { | ||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||
| 236 | 0 | my ( $text, $cinv ) = @_; | |||||||||||||||||||
| 237 | |||||||||||||||||||||
| 238 | 0 | $self->do_send( $text ); | |||||||||||||||||||
| 239 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | sub incoming_text | ||||||||||||||||||||
| 242 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
incoming_text: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 243 | 2 | my $self = shift; | |||||||||||||||||||
| 244 | 2 | my ( $text ) = @_; | |||||||||||||||||||
| 245 | |||||||||||||||||||||
| 246 | 2 | my $event = { | |||||||||||||||||||
| 247 | text => Circle::TaggedString->new( $text ), | ||||||||||||||||||||
| 248 | level => 2, | ||||||||||||||||||||
| 249 | }; | ||||||||||||||||||||
| 250 | |||||||||||||||||||||
| 251 | 2 | $self->run_rulechain( "input", $event ); | |||||||||||||||||||
| 252 | |||||||||||||||||||||
| 253 | 2 | $self->push_displayevent( "text", { text => $event->{text} } ); | |||||||||||||||||||
| 254 | 2 | ▶ | $self->bump_level( $event->{level} ) if defined $event->{level}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 255 | } | ||||||||||||||||||||
| 256 | |||||||||||||||||||||
| 257 | sub commandable_parent | ||||||||||||||||||||
| 258 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
commandable_parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 259 | 2 | my $self = shift; | |||||||||||||||||||
| 260 | 2 | return $self->{root}; | |||||||||||||||||||
| 261 | } | ||||||||||||||||||||
| 262 | |||||||||||||||||||||
| 263 | sub enumerable_name | ||||||||||||||||||||
| 264 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
enumerable_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 265 | 0 | my $self = shift; | |||||||||||||||||||
| 266 | 0 | return $self->get_prop_tag; | |||||||||||||||||||
| 267 | } | ||||||||||||||||||||
| 268 | |||||||||||||||||||||
| 269 | sub parent | ||||||||||||||||||||
| 270 | 4 | ▶ | { | ||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 271 | 4 | my $self = shift; | |||||||||||||||||||
| 272 | 4 | return $self->{root}; | |||||||||||||||||||
| 273 | } | ||||||||||||||||||||
| 274 | |||||||||||||||||||||
| 275 | 4 | __PACKAGE__->APPLY_Setting( host => | |||||||||||||||||||
| 276 | description => "Hostname of the server", | ||||||||||||||||||||
| 277 | type => 'str', | ||||||||||||||||||||
| 278 | ); | ||||||||||||||||||||
| 279 | |||||||||||||||||||||
| 280 | 4 | __PACKAGE__->APPLY_Setting( port => | |||||||||||||||||||
| 281 | description => "Port number of the server", | ||||||||||||||||||||
| 282 | type => 'int', | ||||||||||||||||||||
| 283 | ); | ||||||||||||||||||||
| 284 | |||||||||||||||||||||
| 285 | 4 | __PACKAGE__->APPLY_Setting( echo => | |||||||||||||||||||
| 286 | description => "Local line echo", | ||||||||||||||||||||
| 287 | type => 'bool', | ||||||||||||||||||||
| 288 | ); | ||||||||||||||||||||
| 289 | |||||||||||||||||||||
| 290 | ### | ||||||||||||||||||||
| 291 | # Widgets | ||||||||||||||||||||
| 292 | ### | ||||||||||||||||||||
| 293 | |||||||||||||||||||||
| 294 | sub get_widget_statusbar | ||||||||||||||||||||
| 295 | 1 | ▶ | { | ||||||||||||||||||
|
Subroutine
get_widget_statusbar: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 296 | 1 | my $self = shift; | |||||||||||||||||||
| 297 | |||||||||||||||||||||
| 298 | 1 | my $registry = $self->{registry}; | |||||||||||||||||||
| 299 | |||||||||||||||||||||
| 300 | 1 | my $statusbar = $registry->construct( | |||||||||||||||||||
| 301 | "Circle::Widget::Box", | ||||||||||||||||||||
| 302 | classes => [qw( status )], | ||||||||||||||||||||
| 303 | orientation => "horizontal", | ||||||||||||||||||||
| 304 | ); | ||||||||||||||||||||
| 305 | |||||||||||||||||||||
| 306 | 1 | my $serverlabel = $registry->construct( | |||||||||||||||||||
| 307 | "Circle::Widget::Label", | ||||||||||||||||||||
| 308 | classes => [qw( label )], | ||||||||||||||||||||
| 309 | ); | ||||||||||||||||||||
| 310 | 1 | ▶ | $self->subscribe_event( connected => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 311 | 1 | my ( $self, $host, $port ) = @_; | |||||||||||||||||||
| 312 | 1 | $serverlabel->set_prop_text( "$host:$port" ); | |||||||||||||||||||
| 313 | 1 | } ); | |||||||||||||||||||
| 314 | 0 | ▶ | $self->subscribe_event( disconnected => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 315 | 0 | $serverlabel->set_prop_text( "--unconnected--" ); | |||||||||||||||||||
| 316 | 1 | } ); | |||||||||||||||||||
| 317 | |||||||||||||||||||||
| 318 | 1 | $statusbar->add( $serverlabel ); | |||||||||||||||||||
| 319 | |||||||||||||||||||||
| 320 | 1 | return $statusbar; | |||||||||||||||||||
| 321 | } | ||||||||||||||||||||
| 322 | |||||||||||||||||||||
| 323 | 4 | 0x55AA; | |||||||||||||||||||