I'm currently working on a little snippet of code, and i've hit this exceedingly weird problem. Here's a basic outline of what it's doing:
if (!(defined( $FDomainName->{ WEBFWD } ) ) ) {
if ( defined( $FDomainName->{ DocumentRoot } ) ) {
$FDomainName->{ WEBSPACE } = "TRUE";
}
}
The program essentially accepts a line of data on stdin (a domain name) and then returns details to stdout. Pretty simple stuff. It's a
WHILE (<STDIN>) sorta deal, so one can keep plugging domains in until you get bored.
Now, there have been many cases when executing this code that even in the case where $FDomainName->{ WEBFWD } absolutely positively DOES definately have something in it - a URL, to be precise - that $FDomainName->{ WEBSPACE } still ends up equalling "TRUE". Can anyone shed any light on this phenomenon? To make matters worse, it's intermittantly failing - most of the time, when $FDomainName->{ WEBFWD } has its URL, then WEBSPACE doesn't get set to "TRUE". Oh, and this is the only place where the WEBSPACE hash thing can ever get set throughout the whole program.
I'm really scratching my head over this. I *know* that each and every time i run the code and the check fails (or succeeds, depending on how you want to look at it) that there is definately a string in the checked variable, cause i've been printing it for debug purposes, yet still it's failing to work in the prescribed manner.
I bet i'm doing something stupidly wrong :) Let me guess, an
if (!( $variable )) { foo } type check is unreliable, and i should know better? :)
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.