First, for clarity, you want to indent the code within each subroutine, e.g.
sub sendFile {
# application object
my $self = shift;
# load template files
my $tmpl = $self->param('info' => $self->load_tmpl('info.phtml')
+);
...
}
Re: your question of where the bug is, I think it's here:
# get the filename
my $filename = "dir+filename";
# check if file exist
if(-e $filename){
- Is the actual path of the file you want to send really "dir+filename"? Or was that intended to be a note to yourself to assign it something like "/home/boboson/media/mp3.mp3"?
- You may want to replace your -e $filename test with -f $filename, as the former tests only for existence, the latter tests if it's an actual plain file. See the perldoc for more info and other tests you can run.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.