Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Software error: Can't open file '/default_form.html', reason: No such

Status
Not open for further replies.

chuckID

Technical User
Oct 1, 2002
8
US
Software error:
Can't open file '/default_form.html', reason: No such file or directory at routines.pl line 804, <DBD> line 10.
Here's the sub for the routines.pl file which is a script library:
sub parse_template {

($template, $ret_msg, $db) = @_;
$result = ();

open (FILE, &quot;$template = /default_form.html&quot;) or #line 804 die &quot;Can't open file '$template', reason: $!&quot;;
while (<FILE>)
{
s/%%ret_msg%%/$ret_msg/ig;
s/%%database%%/$db/ig;
$result .= $_;
}

close (FILE);
return $result;
}

I don't get it... the default_form.html file IS in the /www/ (which is my root directory on my server) and I went ahead a uploaded it five times in a row just to be sure. Every time it overwrites it and shows up as present in this directory. Why do you suppose it says &quot;no such file or directory at routines.pl line 804, <DBD> line 10?

Thanks,
Chuck

 
Hi Chuck,

You mentioned that the is the root, but have you tried

open (FILE, &quot;$template = / ...

to see what happens?

I'm not sure, but I think that if you don't fully specify the path, perl will default to the directory where you are running the script from. So perhaps the routines.pl file and the template need to be in the same dir.

Also, is there a file handle named &quot;DBD&quot; in the rest of your script? The error references it, but it isn't in the subroutine.

I'd have a close look at line 10 and the surrounding lines to check for syntax errors also...and, of course, use the -w switch.

Hope that helps.

MattMcGinnis
 
i did not know the statement:
open (FILE, &quot;$template = /default_form.html&quot;) ;
is this new ??
i use:
$template = &quot;whatyouwant/default_form.html&quot;;
open (FILE, $template );
------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
Jamisar,

I think you have found the problem. I answered assuming that he was using a short cut that I hadn't seen before. God knows there is a million ways to do the same thing in per. :)

 
Hi and thanks for your help,

If my entire path was something like this: .... what would you use for the path in routines.pl at line 804 which is,
$template = &quot;whatyouwant/default_form.html&quot;;
open (FILE, $template ); or die &quot;Can't open file '$template', reason: $!&quot;;

You know, I've tried an unbelievable amount of paths and other changes to try and make this thing work.
For example,
//default_form.html
//
and of course I've moved the respective files to the correct directory to match the above paths, but none of them have worked. I continue to get the same error:
Software error:
Can't open file '/default_form.html', reason: No such file or directory at routines.pl line 804, <DBD> line 10.

Here is the sub for the <DBD> line 10: BTW, it's not line 10 in routines.pl so it must mean in the table.

sub parse_table_definition {
$td_file = shift;

# check if table has been specified
if(!$td_file) {&gen_error(&quot;Source table not specified!&quot;);}

# open table
open (DBD, &quot;${td_file}.td&quot;) || &gen_error(&quot;Unable to open table def at

parse_table_def&quot;);

# parse table definition into arrays
while(defined($the_line=<DBD>)) {
chomp($the_line);

$the_line =~ s/\t{1,}/\t/g;
($field_name, $field_param, $field_type) = split(/\t/,$the_line);

push(@field_names,($field_name));
push(@field_params,($field_param));
push(@field_types,($field_type));
}

Thanks,
Chuck
 
Hi,

I don't really understand why routines.pl can't find the the default_form.html file when it is pointing to the correct directory location.

If this is the correct path to the file(default_form.html) on my server( what then should the line of code be in line 804 of routins.pl which is?:

open (FILE, &quot;$template = /default_form.html&quot;) or die &quot;Can't open file '$template', reason: $!&quot;;?

When I try to load I am still receiving the error message: ---(This is a test to see if all is working)

Software error:
Can't open file '/default_form.html', reason: No such file or directory at routines.pl line 803, <DBD> line 10.

Thanks,
Chuck
 
Hi mate,

Are you sure that the server path to your files is /www/ ?

The reason that I say this is just because your URL shows that does not mean that is the actual server path to the files.

Check with your host what the full server path to your files is.

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
My server path is either/or mydomainname.com/ I'm not sure I understand your question. If you mean the path to surf to my website then the above is true, if you mean the path for me to access all my files on my server, it's files/.pl
.cgi scripts and other folders and files etc.

Thanks,
Chuck
 
Ya, I'm thinking something along the same lines as wullie. On my server I ftp in and see but the public_html folder is never mentioned or used in my scripts (or seen when navigating around). I'm assuming your is just a symlink or something to the folder on your account that the server uses to serve your pages. Actually I see both a public_html folder on my server, both pointing to my web-directory...

Try removing /www/ completely and see if that works...oh wait, it looks like you may have tried that already. Um, I'm stumped. Uhhhhh.

So if:
and
is correct...then:

open FILE, &quot;../default_form.html&quot; should work. Why it wouldn't escapes me ... :/
 
Hi mate,

Lets assume that you are one of 100 people on that server.

Each person on your server would have a unique path to their files something like the following:

/ is your files here

A full server path is different from what you see when you log-in to FTP.

Who are you hosted with?

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Hi ChuckId,
I'm not that good in perl and I don't really know if I can help you but I think you should do some testing to make shure that it is definitely the path that is wrong?
Why don't you for example try to run the part of your skript where you're looking for the path, on your personal computer to make sure all your syntax is correct.
If this is proven you might try to reach a simple txt file on your server(try using other files to make sure it's not the file that is the problem).
If the first try works and the second try doesn't I'm quite sure that wullie and PerlIsGood are right with their opinion.
 
You could try escaping the backslash in

open (FILE, &quot;$template = /default_form.html&quot;)
to
open (FILE, &quot;$template = \/default_form.html&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top