Perl module placing text in home folder

82 Views Asked by At

I am trying to create a Perl module with ExtUtils::MakeMaker. When installing it along with the module I need to place a text file containing some information in the user's home folder. How can I do this?

1

There are 1 best solutions below

2
On

You could try something like this

...
use File::HomeDir;

my $home = File::HomeDir->my_home;

open my $fh, '>', "$home/foo.txt";
print $fh 'bar';
close $fh;

I didn't test this because I'm currently under windows where File::HomeDir is not completely implemented