… | |
… | |
114 | =over 4 |
114 | =over 4 |
115 | |
115 | |
116 | =item on_prepare => $cb->($handle) |
116 | =item on_prepare => $cb->($handle) |
117 | |
117 | |
118 | This (rarely used) callback is called before a new connection is |
118 | This (rarely used) callback is called before a new connection is |
119 | attempted, but after the file handle has been created. It could be used to |
119 | attempted, but after the file handle has been created (you can access that |
|
|
120 | file handle via C<< $handle->{fh} >>). It could be used to prepare the |
120 | prepare the file handle with parameters required for the actual connect |
121 | file handle with parameters required for the actual connect (as opposed to |
121 | (as opposed to settings that can be changed when the connection is already |
122 | settings that can be changed when the connection is already established). |
122 | established). |
|
|
123 | |
123 | |
124 | The return value of this callback should be the connect timeout value in |
124 | The return value of this callback should be the connect timeout value in |
125 | seconds (or C<0>, or C<undef>, or the empty list, to indicate that the |
125 | seconds (or C<0>, or C<undef>, or the empty list, to indicate that the |
126 | default timeout is to be used). |
126 | default timeout is to be used). |
127 | |
127 | |
… | |
… | |
546 | }, |
546 | }, |
547 | sub { |
547 | sub { |
548 | local $self->{fh} = $_[0]; |
548 | local $self->{fh} = $_[0]; |
549 | |
549 | |
550 | $self->{on_prepare} |
550 | $self->{on_prepare} |
551 | ? $self->{on_prepare}->($self) |
551 | ? $self->{on_prepare}->($self) |
552 | : () |
552 | : () |
553 | } |
553 | } |
554 | ); |
554 | ); |
555 | } |
555 | } |
556 | |
556 | |