$ ./2.excel.pl abs is /home/bob/Documents/meditations/2.excel.pl path1 is /home/bob/Documents/meditations path2 is /home/bob/Documents/meditations/template_stuff This script will build path2? Abort with ctrl-c. $VAR1 = { 'monk_tags' => bless( [ '/home/bob/Documents/meditations/template_stuff/1.test.xml', '/home/bob/Documents/meditations/template_stuff/1.test.xml' ], 'Path::Tiny' ), 'book' => 'excel template example ', 'output' => bless( [ '/home/bob/Documents/meditations/template_stuff/output', '/home/bob/Documents/meditations/template_stuff/output' ], 'Path::Tiny' ) }; string monk is /home/bob/Documents/meditations/template_stuff/1.test.xml string save is /home/bob/Documents/meditations/template_stuff/output/30-11-2018-17-15-37.monk.txt Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 250. (in cleanup) Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 418. $ cat 2.excel.pl #!/usr/bin/perl -w use 5.011; use Path::Tiny; use POSIX qw(strftime); use Data::Dumper; # initialization that must precede main data structure # User: enter a subdirectory you would like to create # enter a subdirectory of this^^^ for output my $ts = "template_stuff"; my $output = "output"; # User: enter a name for a template file my $template_file = "1.test.xml"; ## turning things to Path::Tiny my $abs = path(__FILE__)->absolute; my $path1 = Path::Tiny->cwd; my $path2 = path( $path1, $ts ); say "abs is $abs"; say "path1 is $path1"; say "path2 is $path2"; print "This script will build path2? Abort with ctrl-c."; my $prompt = ; chomp $prompt; die if ( $prompt eq "n" ); # Path::Tiny creates $ts directory if necessary my $abs_to_template = path( $path2, $template_file )->touchpath; # script params my %vars = ( monk_tags => path( $path2, $template_file ), output => path( $path2, $output ), book => 'excel template example ', ); my $rvars = \%vars; print Dumper $rvars; my $munge = strftime( "%d-%m-%Y-%H-%M-%S", localtime ); $munge .= ".monk.txt"; # use Path::Tiny to create and write to a text in relevant directory my $save_file = path( $vars{output}, $munge )->touchpath; ## stringify input and output files for export my $string_monk = $vars{monk_tags}->stringify; say "string monk is $string_monk"; my $string_save = $save_file->stringify; say "string save is $string_save"; ## end preliminaries # keep time my $start = time; use Excel::Template; # Create the Excel template my $template = Excel::Template->new( filename => $string_monk, ); # Add a few parameters $template->param( HOME => $ENV{HOME}, PATH => $ENV{PATH}, ); $template->write_file($save_file); say time - $start, "seconds elapsed during execution"; say "created file $save_file"; system("gedit $save_file &"); __END__ $ #### $ ./3.excel.pl abs is /home/bob/Documents/meditations/3.excel.pl path1 is /home/bob/Documents/meditations path2 is /home/bob/Documents/meditations/template_stuff This script will build path2. Abort with ctrl-c.$VAR1 = { 'output' => bless( [ '/home/bob/Documents/meditations/template_stuff/output', '/home/bob/Documents/meditations/template_stuff/output' ], 'Path::Tiny' ), 'book' => 'excel template example ', 'monk_tags' => bless( [ '/home/bob/Documents/meditations/template_stuff/1.test.xml', '/home/bob/Documents/meditations/template_stuff/1.test.xml' ], 'Path::Tiny' ) }; string monk is /home/bob/Documents/meditations/template_stuff/1.test.xml string save is /home/bob/Documents/meditations/template_stuff/output/30-11-2018-10-58-04.monk.txt Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 250, line 0.000000. (in cleanup) Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 418, line 0.000000. $ ./3.excel.pl abs is /home/bob/Documents/meditations/3.excel.pl path1 is /home/bob/Documents/meditations path2 is /home/bob/Documents/meditations/template_stuff This script will build path2. Abort with ctrl-c or n.standard in waits for you $VAR1 = { 'monk_tags' => bless( [ '/home/bob/Documents/meditations/template_stuff/1.test.xml', '/home/bob/Documents/meditations/template_stuff/1.test.xml' ], 'Path::Tiny' ), 'book' => 'excel template example ', 'output' => bless( [ '/home/bob/Documents/meditations/template_stuff/output', '/home/bob/Documents/meditations/template_stuff/output' ], 'Path::Tiny' ) }; string monk is /home/bob/Documents/meditations/template_stuff/1.test.xml string save is /home/bob/Documents/meditations/template_stuff/output/30-11-2018-11-07-45.monk.txt Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 250, line 0.000000. (in cleanup) Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 418, line 0.000000. $ cat 3.excel.pl #!/usr/bin/perl -w use 5.011; use Path::Tiny; use POSIX qw(strftime); use Data::Dumper; # initialization that must precede main data structure # User: enter a subdirectory you would like to create # enter a subdirectory of this^^^ for output my $ts = "template_stuff"; my $output = "output"; # User: enter a name for a template file my $template_file = "1.test.xml"; ## turning things to Path::Tiny my $abs = path(__FILE__)->absolute; my $path1 = Path::Tiny->cwd; my $path2 = path( $path1, $ts ); say "abs is $abs"; say "path1 is $path1"; say "path2 is $path2"; say "This script will build path2. Abort with ctrl-c or n."; print "standard in waits for you"; my $prompt = ; chomp $prompt; die if ( $prompt eq "n" ); # Path::Tiny creates $ts directory if necessary my $abs_to_template = path( $path2, $template_file )->touchpath; # script params my %vars = ( monk_tags => path( $path2, $template_file ), output => path( $path2, $output ), book => 'excel template example ', ); my $rvars = \%vars; print Dumper $rvars; my $munge = strftime( "%d-%m-%Y-%H-%M-%S", localtime ); $munge .= ".monk.txt"; # use Path::Tiny to create and write to a text in relevant directory my $save_file = path( $vars{output}, $munge )->touchpath; ## stringify input and output files for export my $string_monk = $vars{monk_tags}->stringify; say "string monk is $string_monk"; my $string_save = $save_file->stringify; say "string save is $string_save"; ## end preliminaries # keep time my $start = time; use Excel::Template; # Create the Excel template my $template = Excel::Template->new( FILE => \*DATA ); # Add a few parameters $template->param( HOME => $ENV{HOME}, PATH => $ENV{PATH}, ); $template->write_file($save_file); say time - $start, "seconds elapsed during execution"; say "created file $save_file"; system("gedit $save_file &"); __DATA__ $ #### Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 250, line 0.000000. (in cleanup) Not a GLOB reference at /usr/local/share/perl/5.26.1/Spreadsheet/WriteExcel/OLEwriter.pm line 418, line 0.000000.