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?
Asked
Active
Viewed 73 times
0
-
3I'd be really unimpressed if a module started writing writing to ~/ during its install. Don't do that. – Quentin Jul 23 '13 at 13:37
-
1Makefile.PL is just a Perl program. You can do anything you like in it. – brian d foy Jul 23 '13 at 15:42
-
brian d foy, is absolutely right. I could simply put some codes in Makefile.Pl to write a text file in the Home folder.Thank you!! – dileepmani Jul 23 '13 at 23:53
1 Answers
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
-
1[File a bug!](https://rt.cpan.org/Dist/Display.html?Name=File-HomeDir) Unspecific complaints on a forum do not count. – daxim Jul 23 '13 at 14:35
-