I’d like to call Glib::shell_quote from Perl, but the Glib module seemingly doesn’t provide any of Glibs functions that aren’t part of some struct.
While it’s possible to import the GLib typelib via Glib::Object::Introspection and call the function via that, it causes assertion failures during the import that are printed.
That’s not really true: there are plenty of global functions in the Glib bindings.
The issue is that g_shell_quote() does not have a Perl trampoline because nobody bothered to add one. You’re welcome to open a merge request for the bindings, but they are in very low maintenance mode, these days.
It’s strongly discouraged to use GLib and GObject API via introspection with Perl; the Glib module exists for a reason, outside of historical legacy: a lot of the Glib::Object::Introspection functionality is implemented on top of the Glib Perl module itself, both in Perl and C.
DB<4> Glib::Object::Introspection->setup(basename => 'GLib', version => '2.0', package => 'GlibGI');
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib/perl5/vendor_perl/5.40.0/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
at (eval 14)[/usr/lib/perl5/5.40.0/perl5db.pl:742] line 2.
eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $^D = $^D | $DB::db_stop;
Glib::Object::Introspection->setup(basename => \'GLib\', version => \'2.0\', package => \'GlibGI\');;
' called at /usr/lib/perl5/5.40.0/perl5db.pl line 742
DB::eval called at /usr/lib/perl5/5.40.0/perl5db.pl line 3449
DB::DB called at -e line 1
GLib-CRITICAL **: g_once_init_leave_pointer: assertion 'result != 0' failed at /usr/lib/perl5/vendor_perl/5.40.0/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
at (eval 14)[/usr/lib/perl5/5.40.0/perl5db.pl:742] line 2.
eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $^D = $^D | $DB::db_stop;
Glib::Object::Introspection->setup(basename => \'GLib\', version => \'2.0\', package => \'GlibGI\');;
' called at /usr/lib/perl5/5.40.0/perl5db.pl line 742
DB::eval called at /usr/lib/perl5/5.40.0/perl5db.pl line 3449
DB::DB called at -e line 1