2005/5/10

     
 

acdk_perl Manual

artefaktur

acdk_perl_man contains an interface to an perl interperter and the DMI code to script ACDK objects from perl code.


Content of this chapter:

   ACDK / Perl
     Type mapping
     command: sub acdk::new($;) / pacdk::new($;)
     command: sub acdk::invoke($$;) / pacdk::invoke($$;)
     command: sub acdk::peek($$) / pacdk::peek($$)
     command: sub acdk::poke($$$) / pacdk::poke($$$)
     command: sub acdk::invoke_static($$;) / pacdk::invoke_static($$;)
     command: sub acdk::peek_static($$) / pacdk::peek_static($$)
     command: sub acdk::perl2acdk($) / pacdk::perl2acdk($)
     command: sub acdk::acdk2perl($) / pacdk::acdk2perl($)



 ACDK / Perl


 Type mapping

Perl: number <-> ACDK: int/Integer.
Perl: double <-> ACDK: double/Double.
Perl: string <-> ACDK: String.
Perl: array <-> ACDK: ObjectArray.
Perl: hash <-> ACDK: HashMap.

Note: The mapping of array and hash may change later.

 command: sub acdk::new($;) / pacdk::new($;)

acdk::new creates a new ACDK-Object.
argument 1: The fully qualified ACDK-Class name like "acdk/lang/StringBuffer".
argument 2 - n: Arguments for the class constructor.
return: a new Object , wich is a blessed scalar.
Usage:

## perl
my $sb = pacdk::new("acdk/lang/StringBuffer", "Hallo ");

 command: sub acdk::invoke($$;) / pacdk::invoke($$;)

acdk::invoke invokes a method. argument 1: the ACDK Object pointer of the class. argument 2: the name of the method.
argument 3-n: arguments of the method.
return: returns the result of the method.

Instead of using invoke, you can also use the '->' operator to call a function:

## perl
my $sb = pacdk::new("acdk/lang/StringBuffer", "Hallo ");

my $erg = pacdk::invoke($sb, "toString");
# the same as 
my $erg = $sb->toString();

 command: sub acdk::peek($$) / pacdk::peek($$)

acdk::peek reads a named attribute (member) of the class.
argument 1: the ACDK Object pointer of the class. argument 2: name of the member return: the value of the member

 command: sub acdk::poke($$$) / pacdk::poke($$$)

acdk::peek sets a named attribute (member) of the class with new new value argument 1: the ACDK Object pointer of the class. argument 2: name of the member argument 3: the new value of the member return: nothing

 command: sub acdk::invoke_static($$;) / pacdk::invoke_static($$;)

acdk::invoke_static calls a static method.
argument 1: name of the class as string.
argument 2: name of the method as string.
arguments 3-n: arguments of the method.
return: returns the result of the method.

 command: sub acdk::peek_static($$) / pacdk::peek_static($$)

reads a static member of an ACDK class.
argument 1: name of the class as string.
argument 2: name of the member as string.


 command: sub acdk::perl2acdk($) / pacdk::perl2acdk($)

sub acdk::perl2acdk($) converts a perl variable to a ACDK object.

 command: sub acdk::acdk2perl($) / pacdk::acdk2perl($)

sub acdk::acdk2perl($) converts a acdk object to a perl variable.