PerlInterpreter
public struct PerlInterpreter
A Perl interpreter.
This type hides a pointer to the underlying C Perl interpreter and provides a clean Swifty interface to it. It doesn’t provide any guarantees about a Perl interpreter instance aliveness and should be used only while they are provided by outer conditions. Generally it is not a problem because a Perl interpreter is only created once on startup and destroyed on shutdown of a process. In the case of an XS module an interpreter aliveness is guaranteed during the scope of an XSUB call.
Embedding a Perl interpreter
let perl = PerlInterpreter.new()
try perl.eval("print qq/OK\\n/") // Do something interesting with Perl
perl.destroy()
Writting an XS module
@_cdecl("boot_Your__Module__Name")
public func boot(_ perl: PerlInterpreter.Pointer) {
let perl = PerlInterpreter(perl)
// Create XSUBs
PerlSub(name: "test", perl: perl) { () -> Void in
print("OK")
}
}
-
A type of the pointer to the underlying C
PerlInterpreter.Declaration
Swift
public typealias Pointer = UnsafeMutablePointer<CPerl.PerlInterpreter> -
A pointer to the underlying C
PerlInterpreterstructure.Declaration
Swift
public let pointer: Pointer -
Wrap a pointer to the C
PerlInterpreterstructure.Declaration
Swift
public init(_ pointer: Pointer) -
A Perl interpreter stored in the thread local storage.
Declaration
Swift
public static var current: PerlInterpreter -
The main Perl interpreter of the process.
Declaration
Swift
public static var main: PerlInterpreter -
Loads the module by name. It is analogous to Perl code
eval "require $module"and even implemented that way.Declaration
Swift
public func require(_ module: String) throws -
Loads the module by its file name. It is analogous to Perl code
eval "require '$file'"and even implemented that way.Declaration
Swift
public func require(file: String) throws
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: String, args: [PerlScalarConvertible?], context: PerlSub.VoidContext = .void) throws -> VoidParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.VoidContext = .void) throws -> VoidParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.VoidContext = .void) throws -> VoidParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.VoidContext = .void) throws -> VoidParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> RParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> R?Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(sub: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(sub: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> PerlSub.ReturnValuesParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(sub: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> PerlSub.ReturnValuesParameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl subroutine.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
subThe name of the subroutine.
argsArguments to pass to the Perl sub.
contextContext of the call.
Return Value
Values returned by the Perl sub converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: String, args: [PerlScalarConvertible?], context: PerlSub.VoidContext = .void) throws -> VoidParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.VoidContext = .void) throws -> VoidParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.VoidContext = .void) throws -> VoidParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.VoidContext = .void) throws -> VoidParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ScalarContext = .scalar) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> RParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R : PerlScalarConvertible>(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> R?Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(method: String, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(method: String, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext = .array) throws -> (R0, R1)Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: PerlScalar, args: [PerlScalarConvertible?], context: PerlSub.ArrayContext) throws -> PerlSub.ReturnValuesParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Parameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Calls the Perl method.
The arguments of the call will be automagically converted to mortalized Perl scalar values with the lifetime of the scope of this call. The similar thing will happen to the Perl return values: they will be destroyed before the call returns (but after conversion to Swift values was done).
Declaration
Swift
public func call(method: PerlScalar, _ args: PerlScalarConvertible?..., context: PerlSub.ArrayContext) throws -> PerlSub.ReturnValuesParameters
methodThe name of the method.
argsArguments to pass to the Perl method.
contextContext of the call.
Return Value
Values returned by the Perl method converted to requested Swift types.
-
Tells Perl to
eval
the string.Declaration
Swift
public func eval(_ string: String, context: PerlSub.VoidContext = .void) throws -> Void -
Tells Perl to
eval
the string.Declaration
Swift
public func eval(_ string: PerlScalar, context: PerlSub.VoidContext = .void) throws -> Void -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: String, context: PerlSub.ScalarContext = .scalar) throws -> R -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: PerlScalar, context: PerlSub.ScalarContext = .scalar) throws -> R -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: String, context: PerlSub.ScalarContext = .scalar) throws -> R? -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: PerlScalar, context: PerlSub.ScalarContext = .scalar) throws -> R? -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: String, context: PerlSub.ArrayContext) throws -> R -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: PerlScalar, context: PerlSub.ArrayContext) throws -> R -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: String, context: PerlSub.ArrayContext) throws -> R? -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R : PerlScalarConvertible>(_ string: PerlScalar, context: PerlSub.ArrayContext) throws -> R? -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(_ string: String, context: PerlSub.ArrayContext = .array) throws -> (R0, R1) -
Tells Perl to
eval
the string.Declaration
Swift
public func eval<R0 : PerlScalarConvertible, R1 : PerlScalarConvertible>(_ string: PerlScalar, context: PerlSub.ArrayContext = .array) throws -> (R0, R1) -
Tells Perl to
eval
the string.Declaration
-
Tells Perl to
eval
the string.Declaration
Swift
public func eval(_ string: PerlScalar, context: PerlSub.ArrayContext) throws -> PerlSub.ReturnValues
-
Creates a new embedded Perl interpreter.
Declaration
Swift
public static func new() -> PerlInterpreter -
Shuts down the Perl interpreter.
Declaration
Swift
public func destroy()
View on GitHub
PerlInterpreter Struct Reference