The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::GrowthBook - sdk of growthbook

SYNOPSIS

    use WebService::GrowthBook;
    my $instance = WebService::GrowthBook->new(client_key => 'my key');
    $instance->load_features;
    if($instance->is_on('feature_name')){
        # do something
    }
    else {
        # do something else
    }
    my $string_feature = $instance->get_feature_value('string_feature');
    my $number_feature = $instance->get_feature_value('number_feature');
    # get decoded json
    my $json_feature = $instance->get_feature_value('json_feature');

DESCRIPTION

    This module is a sdk of growthbook, it provides a simple way to use growthbook features.

INHERITED METHODS

Object::Pad::UNIVERSAL

BUILDARGS

METHODS

load_features

load features from growthbook API

    $instance->load_features;

is_on

check if a feature is on

    $instance->is_on('feature_name');

Please note it will return undef if the feature does not exist.

is_off

check if a feature is off

    $instance->is_off('feature_name');

Please note it will return undef if the feature does not exist.

get_feature_value

get the value of a feature

    $instance->get_feature_value('feature_name');

Please note it will return undef if the feature does not exist.

set_features

set features

    $instance->set_features($features);

eval_feature

evaluate a feature to get the value

    $instance->eval_feature('feature_name');

SEE ALSO