# This is a fake program/data file subroutine_1 { # there are three spaces in front of this pound sign } #### #!/usr/bin/perl # FILE: /WIP/perl_try_OODoc/perl_monks_03.pl # apt-get install liboffice-oodoc-perl (Ubuntu 9.04) or equivalent required. use warnings; use strict; use OpenOffice::OODoc; my ($i, $my_text); my @Fnames = ('/var/www/php/1.php', '/var/www/php/2.php'); # files to read into document my $x = "cp /home/my_name/util/oo-macro/blank_seed.odt /home/my_name/util/oo-macro/test.odt"; system($x); # copy from seed file to output document file my $doc_out = odfDocument(file => '/home/my_name/util/oo-macro/test.odt'); # setup output # ====== add files into output document ====== foreach(@Fnames) # process each php file { open(FI, "<$_"); my @code_lines = ; # read all the php code from a single file close FI; $my_text = ""; # init for($i = 0; $i <= $#code_lines; $i++) { $my_text .= $code_lines[$i]; #$my_text =~ s/\r/\r\n/g; # didn't help, didn't hurt } $doc_out -> appendParagraph(text => $my_text, style => "Default"); # write a full php file to odt } $doc_out -> save; # done