Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

setting server root HTTP::SERVER::Simple

by blueberryCoffee (Scribe)
on Oct 09, 2006 at 17:37 UTC ( #577235=perlquestion: print w/replies, xml ) Need Help??

blueberryCoffee has asked for the wisdom of the Perl Monks concerning the following question:

I have an app that uses HTTP::SERVER::Simple, Sqlite and HTML::Template to provide an html based application for a user. I have everything working great except that I have to hard code the image paths because the server does not seem to have a root.

I realize I may be missing something elemental here, but anyone have an idea of how I could set things up so that an image like "c:/theapp/images/top.jpg" can be referenced in html as "/images/top.jpg".

Thanks in advance
  • Comment on setting server root HTTP::SERVER::Simple

Replies are listed 'Best First'.
Re: setting server root HTTP::SERVER::Simple
by Corion (Patriarch) on Oct 09, 2006 at 17:39 UTC
      bless you, that is just what I needed. I now have this working
      sub handle_request { my ($self, $cgi) = @_; # is this an static request or dynamic # actions do not have a period as they are # functions of the webserver rather than files if($cgi->path_info() =~ /\./) { $self->serve_static($cgi,"c:\\appdir\\html"); } else { # ensure action exists or set it to default my $action = $cgi->path_info(); $action =~ s|^/||; if(! $self->can($action)) { $action = "home"; } $self->$action($cgi); } }
      Having dynamic requestes be functions of the web server is probably not the best way to go about this, but it is working. Not sure what the best way of doing it is.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://577235]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2023-01-28 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?