Monks, This is a problem that has been plaguing me for a week now and I am out of ideas. The code below works fine in command line (RH9) but as soon as I try the browser it gives me two errors. Any ideas will be appreciated. Thank you Monks!
#!/usr/bin/perl use CGI qw(:standard); my $cgi = new CGI; $i = 0; $connect = 0; make_connection(); cut_connection(); sub make_html { use Spreadsheet::ParseExcel::Simple; print $cgi->header(); print $cgi->start_html('7513 Interface Descriptions'); print "<H1><center>7513 Interface Descriptions</H1>\n"; print "<Table border = 1>\n"; $xls = Spreadsheet::ParseExcel::Simple->read('/root/FLA_DHRS/S +HRHZ006/7513.xls'); foreach $sheet ($xls->sheets) { while ($sheet->has_data) { @data = $sheet->next_row; print " <tr>\n"; #print "@data\n"; foreach $element (@data) { if ($i <= 2) { print "<td><b><center>$element</td></b></cent +er>\n"; $i++; } else { print "<td><center>$element</t +d></ceneter>\n"; } } print " </tr>\n"; } } print end_html; } sub make_connection { if($connect eq 0) { system("/usr/local/bin/ncpmount -S server -A ip address -V /vol2/ISPSNC/PortAssignments -U username -P password /root/FLA_DHRS/SHRHZ006"); $connect = 1; } else { $connect = 0; error(); } if($connect eq 1) { make_html(); } } sub cut_connection { if ($connect eq 1) { system('ncpumount -S server'); } } sub error { print $cgi->header(); print $cgi->start('Error'); print "<center>"; print "<H2> Error: Could not connect to server </H2>"; print "Please Try again later"; print "<HR></center>"; print end_html; }
Error 1
Cannot to mount on /root/FLA_DHRS/SHRHZ006: Operation not permitted
Error 2
Can't call method "sheets" on an undefined value at /var/www/cgi-bin/perldev/excel.cgi line 22.

Retitled from "Racking My Brain!" by Chady


In reply to permission problems between commandline and CGI by parkprimus

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.