Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks:
I am having problems saving some params to a file ( printing();)($file, look at the code). The funny thing is the when I run the code (>perl ) a file is created. This is what I get in the apache server error log "Cannot save file /var/www/html/datfiles/data.dat at /var/www/cgi-bin/ line 48. ". Please help! #!/usr/bin/perl use strict; use CGI::Cookie; use CGI; my $cgi = new CGI; my $file = "/var/www/html/datfiles/data.dat"; print $cgi->header( -cookie => new CGI::Cookie(-name => 'Cho +colateChip', -value=> $cgi- +>param('color'), -expires => 'T +hu, 26-Sep-2002 00:00:00 GMT'#, #-domain => 's', #-path => '/' ) ); print $cgi->start_html(-title => 'Results', -bgcolor => $cgi->param('color')); if ($cgi->param()) { print $cgi->center( $cgi->h3("Hello: ". $cgi->param('name')), $cgi->p, "The keywords are: ",join(", ",$cgi->param('words')), $cgi->p, "Your favorite color is: ",$cgi->param('color')); } printing(); print $cgi->end_html(); sub printing { open(FILE, ">$file")|| die "Cannot save file $file "; print "test"; print FILE $cgi->param('name'); print FILE join(", ",$cgi->param('words')); print FILE $cgi->param('color'); close FILE; }

In reply to Cannot save to file with a CGI scipt by chuleto1

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2023-05-27 23:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found