Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/Obj/File.pm  view on Meta::CPAN

        $self->ivPoke('modifyFlag', TRUE);

        return %loadHash;
    }

    sub update_cage_all {

        # Called by $self->updateDataAfterRename
        # Converts AMud::Templ::XXX > Games::Axmud::Cage::XXX
        # Converts AMud::MaskTempl::XXX > Games::Axmud::CageMask::XXX

        my ($self, $obj) = @_;

        # Local variables
        my ($class, $flag, $hashRef);

        # (no improper arguments to check)

        # Update class
        $class = ref $obj;
        if ($class =~ m/^AMud\:\:Templ\:\:/) {

            $class =~ s/^AMud\:\:Templ/Games::Axmud::Cage/;
            $flag = TRUE;

        } elsif ($class =~ m/^AMud\:\:MaskTempl\:\:/) {

            $class =~ s/^AMud\:\:MaskTempl/Games::Axmud::CageMask/;
            $flag = TRUE;
        }

        # Updated ->_objName
        $obj->{_objName} = $obj->{_name};
        delete $obj->{_name};

        if ($flag) {

            bless $obj, $class;
            $obj->{_objClass} = $class;

            $obj->{_objName} = $obj->{_name};
            delete $obj->{_name};

            # (->_parentFile is 'otherprof')
            if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {

                $obj->{_parentFile} = 'otherprof';
            }

            # Update IVs
            if ($class =~ m/Route$/) {

                $hashRef = $obj->{routeHash};
                foreach my $key (keys %$hashRef) {

                    $$hashRef{$key} = $self->update_obj_route($$hashRef{$key});
                }

                $obj->{routeHash} = $hashRef;

            } elsif ($class =~ m/(Trigger|Alias|Macro|Timer|Hook)$/) {

                $hashRef = $obj->{interfaceHash};
                foreach my $key (keys %$hashRef) {

                    $$hashRef{$key} = $self->update_interface_all($$hashRef{$key});
                }

                $obj->{interfaceHash} = $hashRef;
            }

            $obj->{cageType} = $obj->{templType};
            delete $obj->{templType};

            $obj->{profName} = $obj->{defnName};
            delete $obj->{defnName};

            $obj->{profCategory} = $obj->{defnCategory};
            delete $obj->{defnCategory};

            # Update @ISA
            if ($class =~ m/(Cmd|Route)$/) {

                @obj::ISA = qw(Games::Axmud::Generic::Cage Games::Axmud);

            } else {

                @obj::ISA = qw(
                    Games::Axmud::Generic::InterfaceCage Games::Axmud::Generic::Cage
                    Games::Axmud
                );
            }
        }

        return $obj;
    }

    sub update_interface_all {

        # Called by $self->updateDataAfterRename
        # Converts AMud::Interface::XXX > Games::Axmud::Interface:::XXX

        my ($self, $obj) = @_;

        # Local variables
        my $class;

        # (no improper arguments to check)

        # Update class
        $class = ref $obj;
        if ($class =~ m/^AMud\:\:Interface\:\:/) {

            $class =~ s/^AMud/Games::Axmud/;
            bless $obj, $class;
            $obj->{_objClass} = $class;

            $obj->{_objName} = $obj->{_name};
            delete $obj->{_name};

            # (->_parentFile is 'undef')



( run in 4.601 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )