PerlValue
open class PerlValue : AnyPerl, CustomDebugStringConvertible
Provides a safe wrapper for any SV, which can contain any Perl value, not only scalars. Performs reference counting on initialization and deinitialization.
-
Unsafely creates an instance without incrementing a reference counter of a SV. Performs no type checks and should be used only if compatibility is known.
Declaration
Swift
public required init(noincUnchecked svc: UnsafeSvContext)
-
Unsafely creates an instance incrementing a reference counter of a SV. Performs no type checks and should be used only if compatibility is known.
Declaration
Swift
public required init(incUnchecked svc: UnsafeSvContext)
-
Unsafely creates an instance without incrementing a reference counter of a SV. Performs type checks and throws an error unless compatible.
Declaration
Swift
public convenience init(noinc svc: UnsafeSvContext) throws
-
Unsafely creates an instance incrementing a reference counter of a SV. Performs type checks and throws an error unless compatible.
Declaration
Swift
public convenience init(inc svc: UnsafeSvContext) throws
-
Dereferences
ref
.Declaration
Swift
public convenience init(dereferencing ref: PerlScalar) throws
-
Invokes the given closure on the unsafe context containing pointers to the SV and the Perl interpreter.
The
withUnsafeSvContext(_:)
method ensures that the SV’s lifetime extends through the execution ofbody
.Declaration
Swift
public final func withUnsafeSvContext<R>(_ body: (UnsafeSvContext) throws -> R) rethrows -> R
Parameters
body
A closure that takes
UnsafeSvContext
as its argument. If the closure has a return value, it is used as the return value of thewithUnsafeSvContext(_:)
method.Return Value
The return value of the
body
closure, if any. -
Dumps the contents of the underlying SV to the
STDERR
filehandle.Declaration
Swift
public func dump()
-
A textual representation of the SV, suitable for debugging.
Declaration
Swift
public var debugDescription: String