summaryrefslogtreecommitdiff
path: root/lib/WWW/Curl/Form.pm
blob: 67aa1b1c8547f855e9a10c17187bc7c78dbc502f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package WWW::Curl::Form;
use strict;
use warnings;
use Carp;

our $VERSION = '4.17';

use WWW::Curl ();
use Exporter  ();

our @ISA = qw(Exporter);

our @EXPORT = qw(
CURLFORM_FILE
CURLFORM_COPYNAME
CURLFORM_CONTENTTYPE
);

sub AUTOLOAD {
    our $AUTOLOAD;
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.

    ( my $constname = $AUTOLOAD ) =~ s/.*:://;
    my $value = constant( $constname );
    if($!) {
        croak("Undefined subroutine &$AUTOLOAD caclled");
    }

    {
        no strict 'refs';
        *{$AUTOLOAD} = sub { $value };
    }
    return $value;
}

1;

__END__