Hi, Am trying to fix a bug in the Perl CGI code.

Below is the message

Status: 500 Content-type: text/html <h1>Software error:</h1> <pre>fileparse(): need a valid pathname at login.cgi line 34. </pre> <p> For help, please send mail to this site's webmaster, giving this error + message and the time and date of the error. </p> [Fri Jul 6 21:02:17 2018] login.cgi: fileparse(): need a valid pathna +me at login.cgi line 34.

please help

#!/usr/bin/perl -w #use strict; use DBI; use Carp; use File::Path; use File::stat; use File::Basename; use Cwd; use CGI; use CGI::Carp qw(carpout fatalsToBrowser); use Digest::MD5 qw(md5_hex); #use lib "$ENV{'DOCUMENT_ROOT'}/home/honeyisl/public_html/cgi-bin/sche +dule"; use lib "/home/honeyisl/public_html/cgi-bin/schedule"; use SUBS; use DBDAT; no warnings 'uninitialized'; #use lib "$ENV{'DOCUMENT_ROOT'}/home/honeyisl/public_html/cgi-bin"; use lib "/home/honeyisl/public_html/cgi-bin"; use Date::Manip; use Apache::DBI (); use Mail::Mailer; use Exporter; # P A R A M S A N D V A R I A B L E S my $q = CGI->new; my $action=$q->param("submit") || 'Annonymous'; my $user=$q->param('user'); my $msg=$q->param('msg'); #-------------------------------------------------------------------- my $md5 = Digest::MD5->new; my $digest; my $dir=dirname($ENV{'SCRIPT_FILENAME'}); #my $dir=cwd(dirname($ENV{"SCRIPT_FILENAME"}));
The error is coming from line " my $dir=dirname($ENV{'SCRIPT_FILENAME'});" Please help Thanks in advance

In reply to fileparse(): need a valid pathname by roopra

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.