Affix

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "Config" : "0",
            "File::Spec" : "0",
            "Sub::Util" : "0",
            "Text::ParseWords" : "0",
            "XSLoader" : "0",
            "perl" : "5.026000"
         }
      },
      "test" : {
         "requires" : {
            "Data::Dumper" : "0",
            "Devel::CheckBin" : "0",
            "Math::BigInt" : "0",
            "Test::More" : "0.98"
         }
      }
   },
   "provides" : {
      "Affix" : {
         "file" : "lib/Affix.pm",
         "version" : "0.11"

META.yml  view on Meta::CPAN

---
X_No_Archive: Yes
abstract: 'A Foreign Function Interface eXtension'
author:
  - 'Sanko Robinson <sanko@cpan.org>'
build_requires:
  Data::Dumper: '0'
  Devel::CheckBin: '0'
  Math::BigInt: '0'
  Test::More: '0.98'
configure_requires:
  Archive::Tar: '0'
  CPAN::Meta: '0'
  Devel::CheckBin: '0'
  ExtUtils::Config: '0.003'
  ExtUtils::Helpers: '0.02'
  ExtUtils::Install: '0'

README.md  view on Meta::CPAN


If you want to call a function that's already loaded, either from the standard
library or from your own program, you can omit the library value or pass and
explicit `undef`.

For example on a UNIX-like operating system, you could use the following code
to print the home directory of the current user:

```perl
use Affix;
use Data::Dumper;
typedef PwStruct => Struct [
    name  => Str,     # username
    pass  => Str,     # hashed pass if shadow db isn't in use
    uuid  => UInt,    # user
    guid  => UInt,    # group
    gecos => Str,     # real name
    dir   => Str,     # ~/
    shell => Str      # bash, etc.
];
sub getuid : Native : Signature([]=>Int);

cpanfile  view on Meta::CPAN

requires 'perl', '5.026000';
requires 'File::Spec';
requires 'Config';
requires 'XSLoader';
requires 'Sub::Util';
requires 'Text::ParseWords';
requires 'Attribute::Handlers';
#
on 'test' => sub {
    requires 'Test::More' => 0.98;
    requires 'Data::Dumper';
    requires 'Math::BigInt';
    requires 'Devel::CheckBin';
};
on 'configure' => sub {
    requires 'Archive::Tar';
    requires 'CPAN::Meta';
    requires 'Devel::CheckBin';
    requires 'ExtUtils::Config'  => 0.003;
    requires 'ExtUtils::Helpers' => 0.020;
    requires 'ExtUtils::Install';

lib/Affix.pm  view on Meta::CPAN

=head2 Calling into the standard library

If you want to call a function that's already loaded, either from the standard
library or from your own program, you can omit the library value or pass and
explicit C<undef>.

For example on a UNIX-like operating system, you could use the following code
to print the home directory of the current user:

    use Affix;
    use Data::Dumper;
    typedef PwStruct => Struct [
        name  => Str,     # username
        pass  => Str,     # hashed pass if shadow db isn't in use
        uuid  => UInt,    # user
        guid  => UInt,    # group
        gecos => Str,     # real name
        dir   => Str,     # ~/
        shell => Str      # bash, etc.
    ];
    sub getuid : Native : Signature([]=>Int);

t/51_affix_sizeof_offsetof.t  view on Meta::CPAN

    l => LongLong,
    L => ULongLong,
    f => Float,
    d => Double,
    p => Pointer [Int],
    Z => Str,
    A => Struct [ i => Int ],
    u => Union [ i => Int, structure => Struct [ ptr => Pointer [Void], l => Long ] ]
];

#use Data::Dumper;
#diag Dumper massive();
subtest 'array' => sub {
    is sizeof( ArrayRef [ Char, 3 ] ), 3, 'sizeof(ArrayRef [ Char, 3 ])';
    is sizeof( ArrayRef [ Pointer [Void], 1 ] ), wrap( $lib, 's_pointer_array', [], Size_t )->(),
        'sizeof(ArrayRef [ Pointer[Void], 1 ])';
    is sizeof( ArrayRef [ Str, 3 ] ), wrap( $lib, 's_string_array', [], Size_t )->(),
        'sizeof(ArrayRef [ Str, 3 ])';
};
subtest 'aggregates' => sub {
    is sizeof( Struct [] ), 0, 'empty struct is 0 bytes';
    my $struct1 = Struct [ c => ArrayRef [ Char, 3 ] ];
    my $struct2 = Struct [ c => ArrayRef [ Int,  3 ] ];
    my $struct3 = Struct [ d => Double, c => ArrayRef [ Int, 3 ] ];
    my $struct4 = Struct [ y => $struct3 ];    # Make sure we are padding cached size data
    my $struct5 = Struct [ y => Struct [ d => Double, c => ArrayRef [ Int, 3 ] ] ];
    my $struct6 = Struct [ y => $struct3, s => $struct4, c => Char ];
    my $struct7 = Struct [ i => Int,    Z => Str ];
    my $struct8 = Struct [ d => Double, c => ArrayRef [ Int, 4 ] ];
    subtest 'structs' => sub {

        #use Data::Dumper;
        #diag Dumper $struct1;
        is sizeof($struct1), wrap( $lib, 's_struct1', [], Size_t )->(), 'sizeof(struct1)';
        is sizeof($struct2), wrap( $lib, 's_struct2', [], Size_t )->(), 'sizeof(struct2)';
        is sizeof($struct3), wrap( $lib, 's_struct3', [], Size_t )->(), 'sizeof(struct3)';
        is sizeof($struct4), wrap( $lib, 's_struct4', [], Size_t )->(), 'sizeof(struct4)';
        is sizeof($struct5), wrap( $lib, 's_struct5', [], Size_t )->(), 'sizeof(struct5)';
    SKIP: {
            #skip 'perl defined bad var sizes with -Duselongdouble before 5.36.x', 2
            #    if ( $Config{uselongdouble} || $Config{usequadmath} ) && $^V lt v5.36.1;
            is sizeof($struct6),    wrap( $lib, 's_struct6', [], Size_t )->(), 'sizeof(struct6)';

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 2.146 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )