in reply to Using scalars as a file data?

Yes, you can open a file handle for output or input against a string for instance:
my $variable = "HELLO world\nhow are you?\n"; open(my $fh, '<', \$variable); print $_ for (<$fh>);
Prints:
HELLO world how are you?
Although this wont work if the CPAN module only takes a filename, but usually modules that take a filename will also accept a file handle like the one created above.