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

XS::Check - check XS for problems

SYNOPSIS

    use XS::Check;
    my $check = XS::Check->new ();
    $check->check_file ('some.xs');

VERSION

This documents version 0.01 of XS::Check corresponding to git commit bb1e5bda10f571666976e42ac3a6c44ddc1c291e released on Wed Aug 16 09:49:59 2017 +0900.

DESCRIPTION

Check XS files for errors.

METHODS

new

    my $check = XS::Check->new ();

check

    $check->check ($xs);

See "SUGGESTIONS" for what this reports.

check_file

    $check->check ($xs_file);

Convenience method to read in $xs_file then run "check" on it.

This assumes UTF-8 encoding of $xs_file.

SUGGESTIONS

This section details the possible suggestions made by the module and the motivations behind them.

Use STRLEN in SvPV

Using an int type for the second argument to SvPV may cause errors on 64-bit Perls.

Use const char * for return value of SvPV

Be careful to not overwrite Perl's own buffer, which SvPV returns.

Don't use malloc/calloc/realloc/free

Replace with Newx etc.

These cause "free to wrong pool" errors on multithreaded Windows Perls.

DEPENDENCIES

"read_text" in File::Slurper

This is used by "check_file".

Text::LineNumber

This is used to get the line numbers.

Carp

SEE ALSO

Perl XS modules and CPAN testers

A collection of more or less obscure bugs found by CPAN testers, the original inspiration for this module.

AUTHOR

Ben Bullock, <bkb@cpan.org>

COPYRIGHT & LICENCE

This package and associated files are copyright (C) 2017 Ben Bullock.

You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.