Can't quite see the connection, but maybe it is related ...
On 2/8/06, Daniel McBrearty <[EMAIL PROTECTED]
> wrote:
Thanks. Well, here is the code (slightly edited)
<SNIP>
package Sitetext;
{
my $sitetext_cache = {};
sub init
{
print "Sitetext::init\n";
my $all = getAll();
foreach $st (@$all)
{
# ... fill in the cache. This is definitely OK.
}
#print Dumper($sitetext_cache); # because this shows the data as exp
print "cache at $sitetext_cache\n";
}
sub getFromCache
{
my ($tag, $lang) = @_;
Error::log ("cache at $sitetext_cache"); # this shows a different address!
Error::fatal ("not initialised!") unless (scalar %$sitetext_cache); # and this is what happens
my $result = $sitetext_cache->{$lang}->{$tag};
# some error checking omitted ... here (check the value is defined, use a default otherwise)
return $result;
}
}
If I comment out the
Error::fatal ("not initialised!") unless (scalar %$sitetext_cache);
the error checking at the next stage finds that there is just nothing in the cache.
As I say, this is OK on my home machine (5.8.7), but these probs occur on the 5.8.4. I did look through perldelta to see if anything obvious jumped out, but didn't see anything.
and doing
use vars '$sitetext_cache';
fixes things.
Thanks for any ideas.
Daniel
(PS sorry Perrin that my earlier posts were to you not the group - hadn't noticed)On 2/8/06, Perrin Harkins < [EMAIL PROTECTED] > wrote:Daniel McBrearty wrote:
> Hmm. You're right. I was so pleased to fix the *** thing, I didn't see
> that. This is bizarre, and I don't trust it. Not sure what to do though.
> Rewrite it with IPC::Shareable perhaps.
The technique you are trying to use works fine. There's no need to
switch to something else. It's just a bug. If it still isn't working
for you, post your code.
- Perrin
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131