##
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2;
my @formats = Gtk2::Gdk::Pixbuf->get_formats();
my @exts;
foreach my $format ( @formats ) {
foreach my $key ( keys( %$format ) ) {
next unless $key eq 'extensions';
foreach my $elem ( @{ $format->{ $key } } ) {
push @exts, $elem;
}
}
}
print "@exts\n";
####
And finally, [the original message from [aristotle]:
OT: I like to partition things like into smaller scopes:
my $pixbuf = do {
my $loader = Gtk2::Gdk::PixbufLoader->new();
$loader->write( $image_data );
$loader->close();
$loader->get_pixbuf();
};
So the next guy who looks at it doesn't have to wonder if $loader
is used anywhere later, and can see that the entire point of this
mumbo jumbo is to load something into $pixbuf.
Regards,
#Aristotle