Thanks sherm for replying.

Am 27.10.2005 um 11:50 schrieb Sherm Pendley:


CBPerl is a singleton, so it's better to use the class method to access the shared instance:

        CBPerl *perl = [CBPerl sharedPerl];

That doesn't work here. Get a nil pointer returned.

Should be:

        id perlO = [[NSClassFromString(@"SomePerl") alloc] init];

Note that perlO is typed as "id". That's necessary because the compiler doesn't know about the SomePerl class at compile time. The call to NSClassFromString() is needed for the same reason.

That either returns a nil pointer. Where does the ObjC runtime system look for the SomePerl.pm file.
I placed it in some locations, so it should be found by whom ever. ;)
How does this work in general, maybe I can figure out where the problem is.


SomePerl.pm should look like this:

    package SomePerl;

    use CamelBones qw(:All);

    use strict;
    use warnings;

    class SomePerl {
        'super' => 'NSObject',
        'properties' => [ 'foo', 'bar', 'baz' ],
    };

    sub init : Selector(init) ReturnType(@) {
        my ($self) = @_;
        $self = $self->SUPER::init();

        # Do other initialization

        return $self;
    }


Ok, done that.


Regards,
Manfred

Reply via email to