Protocols

The following protocols are available globally.

  • A type that represents any Perl variable.

    There are two major cases when some class conforms to this protocol:

    • An instance of a class contains a native Perl variable (some SV). In this case it is derived from PerlObject.
    • A class conforms to PerlBridgedObject and its instance contains a native Swift object which can be passed to Perl.

    Making your own custom types conforming to AnyPerl protocol is undesirable.

    Declaration

    Swift

    public protocol AnyPerl : class
  • A class having Perl representation.

    See more

    Declaration

    Swift

    public protocol PerlNamedClass : class
  • A Swift class which instances can be passed to Perl as a blessed SV.

    Implementing an object that conforms to PerlBridgedObject is simple. Declare a static var perlClassName that contains a name of the Perl class your Swift class should be bridged to. Use addPerlMethod method on startup to provide ability to access your methods and attributes from Perl.

    Declaration

    Swift

    public protocol PerlBridgedObject : AnyPerl, PerlNamedClass, PerlScalarConvertible