Hi fellow monks,
I've got a site which I'm trying to use on two different platforms: Win2000/IIS and Linux/Apache.
Everything succeeds, except for one thing:
require "../config.pl";
What doesn't work is that the IIS can't find the config.pl-file, even though it's got '.' in it's @INC.
The simplest solution would off course be to use an absolute path, but the thing is that I want the config-file to tell me what the abs. path is, not define it in multiple files.
So it looks like IIS-perl (activeperl v5.8) doesn't like the '../'.
Okay, so the solution:
$temp = $ENV{'PATH_TRANSLATED'}; # get full path
$temp =~ s|\\|/|g; # convert \ to / (necessary if win)
$temp =~ s/\/([^\/]*)\/([^\/]*)$//; # strip the last two parts (filena
+me and current folder) to get to '../'
push(@INC, $temp); # now it's got the right folder
require "config.pl"; # so the '../' isn't needed
But I'm 100% sure there are many better things to do instead of this.
Would someone be so kind to help me with this issue?
Thanx in advance, Paul
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.