|
Lines 231-236
sub rename_file {
Link Here
|
| 231 |
return 1; |
231 |
return 1; |
| 232 |
} |
232 |
} |
| 233 |
|
233 |
|
|
|
234 |
=head3 disconnect |
| 235 |
|
| 236 |
$server->disconnect(); |
| 237 |
|
| 238 |
Disconnects from the SFTP server. |
| 239 |
|
| 240 |
=cut |
| 241 |
|
| 242 |
sub disconnect { |
| 243 |
my ($self) = @_; |
| 244 |
|
| 245 |
if ( $self->{connection} ) { |
| 246 |
$self->{connection}->disconnect; |
| 247 |
$self->{connection} = undef; |
| 248 |
} |
| 249 |
|
| 250 |
return 1; |
| 251 |
} |
| 252 |
|
| 234 |
=head2 Internal methods |
253 |
=head2 Internal methods |
| 235 |
|
254 |
|
| 236 |
=head3 _post_store_trigger |
255 |
=head3 _post_store_trigger |
|
Lines 355-360
Ensure proper cleanup of open filehandles
Link Here
|
| 355 |
sub DESTROY { |
374 |
sub DESTROY { |
| 356 |
my ($self) = @_; |
375 |
my ($self) = @_; |
| 357 |
|
376 |
|
|
|
377 |
# Clean up the SFTP connection |
| 378 |
if ( $self->{connection} ) { |
| 379 |
$self->{connection}->disconnect; |
| 380 |
} |
| 381 |
|
| 358 |
# Ensure the filehandle is closed properly |
382 |
# Ensure the filehandle is closed properly |
| 359 |
if ( $self->{stderr_fh} ) { |
383 |
if ( $self->{stderr_fh} ) { |
| 360 |
close $self->{stderr_fh} or warn "Failed to close STDERR filehandle: $!"; |
384 |
close $self->{stderr_fh} or warn "Failed to close STDERR filehandle: $!"; |
| 361 |
- |
|
|