Glib::FindMinVersion - Find minimum version of GLib needed to compile C source
use Glib::FindMinVersion; print Glib::FindMinVersion::with('g_get_num_processors'); # 2.36 print scalar Glib::FindMinVersion::for_file('source.c'); # 2.18 my %symbols = Glib::FindMinVersion::for_file('source.c' => 2.10); # ( # 2.18 => [qw[g_set_error_literal]], # 2.12 => [qw[g_ascii_strtoll g_base64_decode]], # )
Symbol use is detected quite crudely with
/ \s* (?<symbol>\w+) \s* \( /x. Symbols introduced prior to 2.0 are labelled as 2.0.
METHODS AND ARGUMENTS
Returns minimum GLib version which exports all
- for_source($source [, $version])
denotes an optional argument. In list context, returns a listing of all found glib symbols grouped by version. If
$versionis given, the list is limited to symbols newer than
$versionis a string of the form
In scalar context, returns the maximum version in the list, which is the minimum version required to use all the symbols.
- for_file($filename [, $version])
Helper function that reads in
$filenameand passes it to
Official casing is GLib, but there's a Glib module already on CPAN, so this follows suit. This and the Glib module are unrelated though.
This module was inspired by Wireshark's tools/checkAPIs.pl.
COPYRIGHT AND LICENSE
Copyright (C) 2017 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.