SPUG: Two errors I need hashing out

Colin Meyer cmeyer at helvella.org
Tue Jan 15 14:00:55 CST 2002

On Tue, Jan 15, 2002 at 11:22:54AM -0800, Susanne Bullo wrote:

> Ok, did the change in the reports mysql insert and changed the open file so
> it would indicate if it dies - and it does.  Now I get an error that says
> "No such file or directory at sunday line 61".  Here is the part in question
> again:


> my $file_path = "members/data/$username/$system_name/$date3.txt";
> my $resp = $ua->request($req, $file_path);
> my $sec_file_path = "members/data/$username";
> my $outfile = "index.html";
> my $filename = "$sec_file_path/$outfile";
> open (FILE,">>$filename") or die $!;
> { print FILE "<a href=$sec_file_path>Report on $date3</a><br>"; }
> }
> Does $sec_file_path need to have a full path?  Or could it be that it's
> literally looking for the folder of $username instead of placing the
> variable there?

$sec_file_path needs to be either an absolute path, or relative to the
current working directory. The current working dir will be the directory
that the script was started in, as nothing in your code changes dir.
The folder containing the file must already exist.

You can add a print statement or run through the debugger (perl -d) to
see for yourself what the values of $sec_file_path and $filename are.
You are using double quotes, which allows the interpolation of variable
names to their values within the string.  Had you been using single
quotes, then the interpolation would be prevented, and you'd be looking
for a directory called literally '$username'.

Hope to see you all at the meeting tonite... ;-)

Have fun,

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/

More information about the spug-list mailing list