dagolden / Path-Tiny

File path utility
41 stars 59 forks source link

Allow tempdir/tempfile as instance methods #242

Closed polettix closed 2 years ago

polettix commented 3 years ago

This patch allows using methods tempdir/tempfile as instance methods too, in addition to class methods and simple functions.

When used as instance methods, the underlying instance MUST represent a directory. In this case, it is used to override the DIR option of File::Temp.

The documentation makes a reference to the version when the added behavior is made available, I don't know if this wanted.

This pull request addresses #115

polettix commented 3 years ago

One thing, to be transparent: any DIR option passed is ignored in this case, i.e. the directory-as-object always wins.

If this not the wanted behavior it's easy (although not trivial) to change this, although in this case I would expect the programmer to use the class method or the exported function.

xdg commented 3 years ago

Thanks. I'm a bit busy with family obligations lately, but I'll try to make time this weekend or next week to review it.

polettix commented 3 years ago

Thanks. I'm a bit busy with family obligations lately, but I'll try to make time this weekend or next week to review it.

No worries and no pressure - it's voluntary open source (and it's not a security bug) 😄

polettix commented 3 years ago

I'll do the requested changes and try to think about additional tests for improving coverage, thanks for looking into it

xdg commented 2 years ago

Thank you very much! Shipping a dev release to CPAN now.