So, I've taken the "short road" to the intended goal. I've just put the graph generating routine in the main script, it works now, via saving the image first on the server and displaying it. It's not a good solution but a working one. By time I will try to migrate these little "script pages" onto another system, like the "Template::Toolkit" or via Mojolicious/Dancer2/Catalyst. "Solution" for my problem:
my $safe_filename_characters = "a-zA-Z0-9_.-"; sub PLOTTING { my ($GRAPH_FH, $mygraph, $graphimage); open ($GRAPH_FH, '>','/home/deruytja/webserver/output/multiping/'.$gra +phname.'.png'); #Redirecting Standart Error to file $mygraph = GD::Graph::linespoints->new(500, 300); $mygraph->set( x_label => 'Link', y_label => 'Antwortzeit in ms', title => 'Antwortzeiten der Links', dclrs => ['green'], y_max_value => $max, bar_spacing => 10, show_values => 1, ) or warn $mygraph->error; $graphimage = $mygraph->plot(\@graphdata); binmode $GRAPH_FH; print $GRAPH_FH $graphimage->png; close $GRAPH_FH; }

Also I modified the upload script after encountering problems regarding filenames (If they've got ä/ö/ü in it) like this:

sub UPLOAD { my $filename = $cgi->param('toping'); if ( !$filename ) { print $cgi->header ( ); print 'There was a problem uploading your file (try a smaller file +).'; exit; } my ( $name, $path, $extension ) = fileparse ( $filename, '..*' ); $filename = $name . $extension; $filename =~ tr/ /_/; $filename =~ s/[^$safe_filename_characters]//g; if ( $filename =~ /^([$safe_filename_characters]+)$/ ) { $filename = $1; } else { print $cgi->header(); print 'There was a problem with the filename (please rename).'; exit; } my $wfile = $cgi->upload('toping'); open(my $DAT,">", "/home/deruytja/webserver/rifucgi/temp_ul/toping.$da +te") or die 'Error processing file INPUT: ',$!; binmode $DAT; while (read $wfile, $data, 1024) { print $DAT $data } close $DAT; }

The user could also give the output file a name, which would encounter the same problems with the characters, solved via this piece of code:

if (!length($dateiname) == 0 && $dateiname =~ /^([$safe_filename_chara +cters]+)$/) { $out_file = ("$dateiname\_$date.csv") or die 'Error processing + file: ',$!; $graphname = "$dateiname\_$date"; } else { print $cgi->header(); print 'There was a problem with your file name, it was reverte +d to "ping_" (please change output name).'; $out_file = ("ping_$date.csv") or die 'Error processing file: +',$!; $graphname = "ping_$date"; }

In reply to Re: Problems calling a second perl script from the first by deruytja
in thread Problems calling a second perl script from the first by deruytja

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.