]>
Commit | Line | Data |
---|---|---|
a1d229d1 DM |
1 | package Xdgmime; |
2 | ||
94212449 | 3 | use 5.036000; |
a1d229d1 DM |
4 | use strict; |
5 | use warnings; | |
6 | use Carp; | |
7 | ||
8 | require Exporter; | |
9 | use AutoLoader; | |
10 | ||
11 | our @ISA = qw(Exporter); | |
12 | ||
13 | # Items to export into callers namespace by default. Note: do not export | |
14 | # names by default without a very good reason. Use EXPORT_OK instead. | |
15 | # Do not simply export all your public functions/methods/constants. | |
16 | ||
17 | # This allows declaration use Xdgmime ':all'; | |
18 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | |
19 | # will save memory. | |
20 | our %EXPORT_TAGS = ( 'all' => [ qw( | |
21 | XDG_MIME_TYPE_EMPTY | |
22 | XDG_MIME_TYPE_TEXTPLAIN | |
23 | XDG_MIME_TYPE_UNKNOWN | |
a1d229d1 | 24 | xdg_mime_dump |
a1d229d1 | 25 | xdg_mime_get_max_buffer_extents |
a1d229d1 DM |
26 | xdg_mime_get_mime_type_for_data |
27 | xdg_mime_get_mime_type_for_file | |
28 | xdg_mime_get_mime_type_from_file_name | |
a1d229d1 DM |
29 | xdg_mime_is_valid_mime_type |
30 | xdg_mime_list_mime_parents | |
31 | xdg_mime_media_type_equal | |
32 | xdg_mime_mime_type_equal | |
33 | xdg_mime_mime_type_subclass | |
a1d229d1 | 34 | xdg_mime_shutdown |
a1d229d1 DM |
35 | ) ] ); |
36 | ||
37 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
38 | ||
39 | our @EXPORT = qw( | |
40 | XDG_MIME_TYPE_EMPTY | |
41 | XDG_MIME_TYPE_TEXTPLAIN | |
42 | XDG_MIME_TYPE_UNKNOWN | |
a1d229d1 | 43 | xdg_mime_dump |
a1d229d1 | 44 | xdg_mime_get_max_buffer_extents |
a1d229d1 DM |
45 | xdg_mime_get_mime_type_for_data |
46 | xdg_mime_get_mime_type_for_file | |
47 | xdg_mime_get_mime_type_from_file_name | |
a1d229d1 DM |
48 | xdg_mime_is_valid_mime_type |
49 | xdg_mime_list_mime_parents | |
50 | xdg_mime_media_type_equal | |
51 | xdg_mime_mime_type_equal | |
52 | xdg_mime_mime_type_subclass | |
a1d229d1 | 53 | xdg_mime_shutdown |
a1d229d1 DM |
54 | ); |
55 | ||
94212449 | 56 | our $VERSION = '1.1'; |
a1d229d1 DM |
57 | |
58 | sub AUTOLOAD { | |
59 | # This AUTOLOAD is used to 'autoload' constants from the constant() | |
60 | # XS function. | |
61 | ||
62 | my $constname; | |
63 | our $AUTOLOAD; | |
64 | ($constname = $AUTOLOAD) =~ s/.*:://; | |
65 | croak "&Xdgmime::constant not defined" if $constname eq 'constant'; | |
66 | my ($error, $val) = constant($constname); | |
67 | if ($error) { croak $error; } | |
68 | { | |
69 | no strict 'refs'; | |
70 | # Fixed between 5.005_53 and 5.005_61 | |
71 | #XXX if ($] >= 5.00561) { | |
72 | #XXX *$AUTOLOAD = sub () { $val }; | |
73 | #XXX } | |
74 | #XXX else { | |
75 | *$AUTOLOAD = sub { $val }; | |
76 | #XXX } | |
77 | } | |
78 | goto &$AUTOLOAD; | |
79 | } | |
80 | ||
81 | require XSLoader; | |
82 | XSLoader::load('Xdgmime', $VERSION); | |
83 | ||
84 | # Preloaded methods go here. | |
85 | ||
e66585f4 | 86 | # Autoload methods go after __END__, and are processed by the autosplit program. |
a1d229d1 DM |
87 | |
88 | 1; | |
89 | __END__ |