Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A File::Temp object is created as an opened file, but the cached_temp is not open #280

Closed
robrwo opened this issue Dec 20, 2022 · 1 comment

Comments

@robrwo
Copy link

robrwo commented Dec 20, 2022

When you create a File::Temp object, the object is actually an open file handle:

use feature 'say';

use File::Temp;
use Scalar::Util qw/ openhandle /;

my $tmp = File::Temp->new;
say openhandle($tmp); # returns a true value

but the file seems to be closed when creating one through Path::Tiny:

use feature 'say';

use Path::Tiny;
use Scalar::Util qw/ openhandle /;

my $path = Path::Tiny->tempfile; 
my $tmp  = $path->cached_temp;
say openhandle($tmp); # should be true, but returns undef
@robrwo
Copy link
Author

robrwo commented Dec 22, 2022

Actually, I see in the tempfile method that you close the filehandle, and it is documented.

@robrwo robrwo closed this as completed Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant