Memcached-libmemcached

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    # write 
    my $func_pm = "lib/Memcached/libmemcached/func_hash.pl";
    warn "Writing $func_pm\n";
    open my $func_pm_fh, ">$func_pm" or die "Can't open $func_pm: $!";
    local $\ = "\n";
    print $func_pm_fh "# DO NOT EDIT! GENERATED BY $0\n";
    print $func_pm_fh "".Data::Dumper->Dump([\%libmemcached_func], [qw(libmemcached_func)]);
    close $func_pm_fh or die "Error closing $func_pm: $!";

    # sanity check the generated file
    my $loaded = require $func_pm;
    die "$func_pm didn't return a HASH reference ($loaded)"
        unless ref $loaded eq 'HASH';
}

sub extract_libmemcached_constants {
    my %libmemcached_const;

    # find all MEMCACHED_* constants (#define and enum)
    my $in_enum = 0;
    my @const;

Makefile.PL  view on Meta::CPAN

    # write raw hash of const names
    my $const_pl = "lib/Memcached/libmemcached/const_hash.pl";
    warn "Writing $const_pl\n";
    open my $const_pl_fh, ">$const_pl" or die "Can't open $const_pl: $!";
    local $\ = "\n";
    print $const_pl_fh "# DO NOT EDIT! GENERATED BY $0\n";
    print $const_pl_fh "".Data::Dumper->Dump([\%libmemcached_const], [qw(libmemcached_const)]);
    close $const_pl_fh or die "Error closing $const_pl: $!";

    # sanity check the generated file
    my $loaded = require $const_pl;
    die "$const_pl didn't return a HASH reference ($loaded)"
        unless ref $loaded eq 'HASH';

    # write raw hash of const names
    my $const_xs = "const-xs.inc";
    warn "Writing $const_xs\n";
    open my $const_xs_fh, ">$const_xs" or die "Can't open $const_xs: $!";
    local $\ = "\n";
    print $const_xs_fh "# DO NOT EDIT! GENERATED BY $0\n";
    print $const_xs_fh "IV\nconstant()";

lib/Memcached/libmemcached/API.pm  view on Meta::CPAN

=cut

use base qw(Exporter);
our @EXPORT = qw(
    libmemcached_functions
    libmemcached_constants
    libmemcached_tags
);

# load hash of libmemcached functions created by Makefile.PL
my $libmemcached_funcs = require "Memcached/libmemcached/func_hash.pl";
die "Memcached/libmemcached/func_hash.pl failed sanity check"
    unless ref $libmemcached_funcs eq 'HASH'
        and keys %$libmemcached_funcs > 20;

# extra functions provided by Memcached::libmemcached
my %libmemcached_extra_functions = (
    memcached_errstr => 1,
    memcached_mget_into_hashref => 1,
    memcached_set_callback_coderefs => 1,
);

lib/Memcached/libmemcached/API.pm  view on Meta::CPAN

    my %funcs = (
        %$libmemcached_funcs,
        %libmemcached_extra_functions,
        %libmemcached_unimplemented_functions
    );
    grep { $funcs{$_} } sort keys %funcs;
};


# load hash of libmemcached functions created by Makefile.PL
my $libmemcached_consts = require "Memcached/libmemcached/const_hash.pl";
die "Memcached/libmemcached/const_hash.pl failed sanity check"
    unless ref $libmemcached_consts eq 'HASH'
        and keys %$libmemcached_consts > 20;

our @libmemcached_consts = sort keys %$libmemcached_consts;


=head2 libmemcached_functions

  @names = libmemcached_functions();



( run in 0.280 second using v1.01-cache-2.11-cpan-0d8aa00de5b )