in reply to Re: Problem with creating Files
in thread Problem with creating Files

Wow @AppleFilter, you describe my problem that myself! Do you have any suggestion how I might do that? Keep in mind that everything is generalized, meaning:

I have only 3 files for PERL:

run.pl mainModule.pm (here I get the statistics info) and htmlModule.pm

RUN.PL:

It consists of calls to sub routines.

1. Are the calls to subroutines in mainModule.pm to get the numbers (for statistic) for each file (html) -> this is stored in hash. After having values, I store also the elements that have this values inside @array1

2. Back to .pl I loop the Array to store the numbers inside variables, these variables will be then put inside HTML to as values for the chart. I use something like:

foreach $element (@array1){ $var1 = $hash{value1}; $var2 $hash{value2} createBarchart(....); }

I use 2 different run.PL, because there are two different database's that I get the values from (for e.g. database1 and database2 -> they differ with unique ID which I provide as an INPUT when I call subs that get me the values)

Replies are listed 'Best First'.
Re^3: Problem with creating Files
by poj (Abbot) on Jul 25, 2014 at 10:18 UTC
    I'm not sure I fully understand your problem but try this
    #!perl use strict; # test for ('file1LAY.html','file1DFT.html','file2DFT.html'){ open OUT,'>',$_; createButtons(undef,$_); } sub createButtons{ my ($outfile,$filename) = @_; my %file=(); if ($filename =~ m/(.+)(?:LAY|DFT)\.html/){ for my $s ('LAY','DFT'){ $file{$s} = './'.$1.$s.'.html'; $file{$s} = '#' unless (-e $file{$s}); } } print qq! <a href="$file{'LAY'}" class="button_lay">Layout</a> <a href="$file{'DFT'}" class="button_dft">DfT</a>\n </div>\n!; }
    poj
Re^3: Problem with creating Files
by AppleFritter (Vicar) on Jul 25, 2014 at 10:12 UTC
    I'd like to help you, but it would really help to see a bit more actual code there; based on general descriptions, I'm afraid I can only give general suggestions.