0

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?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
dileepmani
  • 37
  • 8

1 Answers1

2

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

Demnogonis
  • 3,172
  • 5
  • 31
  • 45