I humbly ask the monks greater than me about an error that has been giving me much humility. While humility is fine in some cases, it is not good when your trying to get some thing done...

What I want the snippet of code, that currently is not working, to do is check to see if the user of the upload has a directory on the server, and if they do not, make them one...

The syntax error is: Compilation failed in require at e:\domains\karawachi.com\user\htdocs\upload\default.pl line 13

The code in that file main file (default.pl) is:

#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); push @INC, "e:/domains/karawachi.com/user/htdocs/upload"; package S3DUpload; my $basedir = "e:/domains/karawachi.com/user/htdocs/upload/upload"; my $stylefile = "style/style1.css"; my $datfile = "dat/datfile.dat"; # This next line is where the error: # Compilation failed in require at e:\domains\karawachi.com\user\htdoc +s\upload\default.pl line 13. # Prolly now line 16 or something in this text. require "checkname.pl"; require "displayfiles.pl"; require "handleupload.pl"; require "parsedatfile.pl"; require "printdat.pl"; require "uploadscreen.pl"; require "welcome.pl"; require "upload.pl"; return 1;

I will take the package bit out, maybe, later.

The code in the other file (checkname.pl) is:

#!/usr/bin/perl use strict; use CGI; # Errors should get shown to the browser better here: use CGI::Carp qw(fatalsToBrowser); # checks to see if a user has a directory, # Then makes one if they do not... sub checkname { $name = shift; opendir UPLOAD,"$basedir/$name" or mkdir "$basedir/$name", 777; closedir UPLOAD; #return success, cause you should always have # a return'd value return 1; } # Need this line so that the file may be # gotten with require(); return 1;

Unless I am being evil with my opening of directories (Which I think would cause an error when the function is actually used more than anything), this code should work. Of course I am not really seasoned enough in perl to make that as an accurate judgement.

DakeDesu teh Confused Werewolf.
Year Neo 3102
(Webpages under construction)

In reply to Problem with require() by dakedesu

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.