NAME
LaunchDarkly::Server - Perl server side SDK for LaunchDarkly
SYNOPSIS
use
LaunchDarkly::Server;
my
$config_builder
= new LaunchDarkly::Server::ConfigBuilder(
"my-sdk-key"
);
my
$config
=
$config_builder
->Build();
my
$client
= new LaunchDarkly::Server::Client(
$config
);
my
$status
=
$client
->StartAsync()->WaitFor(10000);
die
"Could not connect"
unless
$status
== LaunchDarkly::Status::Ready();
my
$builder
= new LaunchDarkly::ContextBuilder();
my
$kind
=
$builder
->Kind(
"user"
,
"user123"
);
$kind
->Set(
"myattribute"
, LaunchDarkly::Value::NewString(
"abc"
));
my
$context
=
$builder
->Build();
my
$result
=
$client
->StringVariation(
$context
,
"myflag"
,
"default-value"
);
DESCRIPTION
A minimum implementation of the LaunchDarkly server side SDK in Perl as a wrapper to the official C++ SDK. See https://launchdarkly.com/docs/sdk/server-side/c-c--
Make sure your LaunchDarkly library is compiled with the LD_BUILD_EXPORT_ALL_SYMBOLS flag so that the C++ symbols are exported. Tested with version 3.8.x.
EXPORT
None by default.
Exportable constants
None.
Exportable functions
LaunchDarkly::Server::ConfigBuilder * LaunchDarkly::Server::ConfigBuilder::new(std::string sdk_key)
LaunchDarkly::Server::Config * LaunchDarkly::Server::ConfigBuilder::Build()
LaunchDarkly::Server::Client * LaunchDarkly::Server::Client::new(LaunchDarkly::Server::Config *config)
LaunchDarkly::Future * LaunchDarkly::Server::Client::StartAsync()
bool LaunchDarkly::Server::Client::BoolVariation(LaunchDarkly::Context *context, std::string key, bool default_value)
std::string LaunchDarkly::Server::Client::StringVariation(LaunchDarkly::Context *context, std::string key, std::string default_value)
double LaunchDarkly::Server::Client::DoubleVariation(LaunchDarkly::Context *context, std::string key, double default_value)
int LaunchDarkly::Server::Client::IntVariation(LaunchDarkly::Context *context, std::string key, int default_value)
void LaunchDarkly::Future::Wait()
LaunchDarkly::Status LaunchDarkly::Future::WaitFor(int milliseconds)
int LaunchDarkly::Status::Ready()
int LaunchDarkly::Status::Timeout()
int LaunchDarkly::Status::Deferred()
LaunchDarkly::ContextBuilder * LaunchDarkly::ContextBuilder::new()
LaunchDarkly::AttributesBuilder * LaunchDarkly::ContextBuilder::Kind(std::string kind, std::string key)
LaunchDarkly::Context * LaunchDarkly::ContextBuilder::Build()
void LaunchDarkly::AttributesBuilder::Set(std::string name, LaunchDarkly::Value *value)
LaunchDarkly::Value * LaunchDarkly::Value::NewInt(int num)
LaunchDarkly::Value * LaunchDarkly::Value::NewDouble(double num)
LaunchDarkly::Value * LaunchDarkly::Value::NewString(std::string str)
LaunchDarkly::Value * LaunchDarkly::Value::NewBool(bool b)
SEE ALSO
AUTHOR
Miklos Tirpak, <miklos.tirpak@emnify.com>
COPYRIGHT AND LICENSE
Copyright (C) 2025 by EMnify
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.32.1 or, at your option, any later version of Perl 5 you may have available.