PDA

View Full Version : plugin success / failure


smogo
02-28-2004, 10:17 AM
I'm having difficulties with plugins.
Zone seems to load them from the plugins/*.pl sometimes, sometimes not.
Also, loading chokes one some script errors, not on others.

Anyone post information about status, thanks in advance.

samandhi
02-28-2004, 01:41 PM
Zone seems to load them from the plugins/*.pl sometimes, sometimes not. Is it random which ones do and which ones dont? Or is it constant which ones dont?

smogo
02-28-2004, 01:51 PM
it's still hard to say. Pretty random anyway.

./plugin.pl always gets loaded fine.

./plugin/*.pl, well, sometimes all succed, sometimes a group, but generally at least one ot two always get loaded. Still i can't guess the rule.

I suspect there is an error in one script (at least something the embparser does not like), and after that, it loads no more. It might be the readdir function used to parse directory that makes it random, that retrieves filenames one at a time. Duno if it's sorted on name, modification time, creation time, ...

smogo
02-29-2004, 10:15 AM
got it !

the file loading uses cache, to check if a package (read 'npc quest') was already loaded. It does the same for plugin files. So, it doesn't load the file if it is older than the previously loaded plugin file.

Correcting this in the embperl.cpp file :
@@ -93,7 +94,7 @@
"my($package, $filename) = @_;"
"$filename=~s/\'//g;"
"my $mtime = -M $filename;"
- "if(defined $Cache{$package}{mtime}&&$Cache{$package}{mtime} <= $mtime){ return; }"
+ "if(defined $Cache{$package}{mtime}&&$Cache{$package}{mtime} <= $mtime && !($package eq 'plugin')){ return; }"
"else {"
"local *FH;open FH, $filename or die \"open '$filename' $!\";"
"local($/) = undef;my $sub = <FH>;close FH;"

samandhi
03-01-2004, 01:30 AM
AAAHHH, good eye... :)