--- deliantra/server/lib/cf/mapscript.pm 2009/11/03 23:44:21 1.7 +++ deliantra/server/lib/cf/mapscript.pm 2011/04/23 04:56:52 1.10 @@ -1,9 +1,7 @@ -#! perl - # # This file is part of Deliantra, the Roguelike Realtime MMORPG. # -# Copyright (©) 2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team +# Copyright (©) 2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team # # Deliantra is free software: you can redistribute it and/or modify it under # the terms of the Affero GNU General Public License as published by the @@ -42,7 +40,7 @@ =cut -package safe::mapscript; +package cf::mapscript::eval; use common::sense; @@ -66,7 +64,7 @@ =cut -our ($self, $state, $activator, $originator); +use vars qw($self $state $activator $originator); =item @obs = find $id_or_object @@ -83,7 +81,7 @@ =item trigger $id_or_object[, $state] Triggers the linked chain with the given I id, or the connected -chain associated with the given object (if an objetc reference is passed), +chain associated with the given object (if an object reference is passed), and passes the given state (or C<1>, if missing) to it. =cut @@ -94,7 +92,7 @@ =item timer $id_or_object, $seconds -Starts the timer on the given mapscript object (usually, $id_or_object is +Starts the timer on the given mapscript object (usually, C<$id_or_object> is C<$self>). When the timer expires on the mapscript object, it will trigger the script with C<$activator == $self> and C<$originator == undef>. @@ -108,16 +106,20 @@ package cf::mapscript; -use strict qw(subs vars); +use common::sense; + +*{"main::safe::cf::mapscript::eval::"} = \%{"main::cf::mapscript::eval::"}; our %CACHE; sub activate($$$) { + package cf::mapscript::eval; + ($self, $state, $activator, $originator) = @_; ( $CACHE{$self->msg} ||= cf::safe_eval - "package mapscript; sub {\n" + "package cf::mapscript::eval; sub {\n" . "#line 1 '" . ($self->debug_desc) . "'\n" . $self->msg . "\n}"