Hello monks, I hope you can help me solve my task: I have a perl script, and it gives the error:
Software error: Can't open [http://b-my.com/cgi-bin/templates/friendlyurls/global_head +er.txt]: No such file or directory at modules/template.pm line 59.
See it working (not) here: http://b-my.com/cgi-bin/login.cgi Why is that, when the file http://b-my.com/cgi-bin/templates/friendlyurls/global_header.txt is there, i mean it is not missing but i receive an error? The file access code is 755? Here is my code:
package template; use strict; use warnings; sub files { my $templatepath = shift; opendir (DIR, "$templatepath"); my @files = grep { /.txt/ } readdir(DIR); close (DIR); @files = sort @files; return @files; } sub themes { my $templatepath = shift; opendir (DIR, "$templatepath"); my @files = grep { /./ } readdir(DIR); close (DIR); @files = sort @files; return @files; } sub save { my $name = shift; my $data = shift; my $templatepath = shift; open (DATABASE,">$templatepath/$name"); flock (DATABASE,2); print DATABASE "$data"; flock (DATABASE,8); close (DATABASE); } sub load2 { my $name = shift; my @bannerfile = shift; my @bannerfilebot = shift; my $templatepath = shift; open(DAT, "$name") or die "Can't open [templates/${name}]: $!"; flock (DAT, 2); my @data = <DAT>; flock (DAT, 8); close(DAT); return @data; } sub load { my $name = shift; my $templatepath = shift; open(DAT, "$name".'.txt') or die "Can't open [${name}.txt]: $!"; flock (DAT, 2); my @data = <DAT>; flock (DAT, 8); close(DAT); return @data; } sub loadsub { my $name = shift; my $templatepath = shift; open(DAT, 'accounts/$userid/templates/'. $name .'.txt') or die "Ca +n't open [templates/${name}.txt]: $!"; flock (DAT, 2); my @data = <DAT>; flock (DAT, 8); close(DAT); return @data; } sub print { my $name = shift; my @data = template::load($name); my @bannerfile = shift; my @bannerfilebot = shift; my $templatepath = shift; my $SITETEMPLATEgh = join ('', @data); print $SITETEMPLATEgh; } 1; # return true

In reply to File missing error...why? by sitecontact

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.