Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use v5.32; use warnings;
- use FFI::Platypus;
- my $ffi = FFI::Platypus->new(qw'api 1');
- $ffi->find_lib(qw'lib pwquality');
- $ffi->mangler(sub { 'pwquality_'.$_[0] });
- $ffi->attach(default_settings => [] => 'opaque');
- $ffi->attach(free_settings => [qw'opaque'] => 'void');
- $ffi->attach(check => [qw'opaque string string string opaque*'] => 'int');
- $ffi->attach(strerror => [qw'opaque size_t int opaque'] => 'string');
- my $def = default_settings;
- say my $score = check($def, 'yourpass', (undef) x 2, \ my $err);
- say strerror(undef, 0, $score, $err) if $score < 0;
- free_settings($def);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement