File tree Expand file tree Collapse file tree 9 files changed +26
-19
lines changed
modules/swagger-codegen/src/main/resources/perl
samples/client/petstore/perl Expand file tree Collapse file tree 9 files changed +26
-19
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ use Log::Any qw($log);
17
17
use Carp;
18
18
use Module::Runtime qw(use_module);
19
19
20
+ use WWW::{ {invokerPackage} }::Configuration;
21
+
20
22
sub new
21
23
{
22
24
my $class = shift;
Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ use utf8;
7
7
use Log::Any qw($log);
8
8
use Carp;
9
9
10
+ use WWW::{ {invokerPackage} }::APIClient;
11
+
10
12
# class/static variables
11
- my $api_client = WWW::SwaggerClient::APIClient->new ;
12
- my $http_timeout = 180;
13
- my $http_user_agent = 'Perl-Swagger';
13
+ our $api_client;
14
+ our $http_timeout = 180;
15
+ our $http_user_agent = 'Perl-Swagger';
14
16
15
17
16
18
1;
Original file line number Diff line number Diff line change @@ -27,19 +27,18 @@ use Exporter;
27
27
use Carp qw( croak );
28
28
use Log::Any qw($log);
29
29
30
-
31
- { {#operations} }
32
-
33
30
use WWW::{ {invokerPackage} }::APIClient;
31
+ use WWW::{ {invokerPackage} }::Configuration;
34
32
33
+ { {#operations} }
35
34
our @EXPORT_OK = qw(
36
35
{ {#operation} }{ {{nickname} }}
37
36
{ {/operation} }
38
37
);
39
38
40
39
sub new {
41
40
my $class = shift;
42
- my $default_api_client = WWW::{{invokerPackage} }::APIClient->new;
41
+ my $default_api_client = $ WWW ::{{invokerPackage } }::Configuration::api_client ? $WWW:: { {invokerPackage } }::Configuration::api_client : WWW::{ {invokerPackage} }::APIClient->new;
43
42
my (%self) = (
44
43
'api_client' => $default_api_client,
45
44
@_
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ use Log::Any qw($log);
17
17
use Carp;
18
18
use Module::Runtime qw( use_module) ;
19
19
20
+ use WWW::SwaggerClient::Configuration;
21
+
20
22
sub new
21
23
{
22
24
my $class = shift ;
Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ use utf8;
7
7
use Log::Any qw( $log) ;
8
8
use Carp;
9
9
10
+ use WWW::SwaggerClient::APIClient;
11
+
10
12
# class/static variables
11
- my $api_client = WWW::SwaggerClient::APIClient -> new ;
12
- my $http_timeout = 180;
13
- my $http_user_agent = ' Perl-Swagger' ;
13
+ our $api_client ;
14
+ our $http_timeout = 180;
15
+ our $http_user_agent = ' Perl-Swagger' ;
14
16
15
17
16
18
1;
Original file line number Diff line number Diff line change @@ -27,9 +27,8 @@ use Exporter;
27
27
use Carp qw( croak ) ;
28
28
use Log::Any qw( $log) ;
29
29
30
-
31
-
32
30
use WWW::SwaggerClient::APIClient;
31
+ use WWW::SwaggerClient::Configuration;
33
32
34
33
our @EXPORT_OK = qw(
35
34
update_pet
@@ -45,7 +44,7 @@ our @EXPORT_OK = qw(
45
44
46
45
sub new {
47
46
my $class = shift ;
48
- my $default_api_client = WWW::SwaggerClient::APIClient-> new;
47
+ my $default_api_client = $WWW::SwaggerClient::Configuration::api_client ? $WWW::SwaggerClient::Configuration::api_client : WWW::SwaggerClient::APIClient-> new;
49
48
my (%self ) = (
50
49
' api_client' => $default_api_client ,
51
50
@_
Original file line number Diff line number Diff line change @@ -27,9 +27,8 @@ use Exporter;
27
27
use Carp qw( croak ) ;
28
28
use Log::Any qw( $log) ;
29
29
30
-
31
-
32
30
use WWW::SwaggerClient::APIClient;
31
+ use WWW::SwaggerClient::Configuration;
33
32
34
33
our @EXPORT_OK = qw(
35
34
get_inventory
@@ -41,7 +40,7 @@ our @EXPORT_OK = qw(
41
40
42
41
sub new {
43
42
my $class = shift ;
44
- my $default_api_client = WWW::SwaggerClient::APIClient-> new;
43
+ my $default_api_client = $WWW::SwaggerClient::Configuration::api_client ? $WWW::SwaggerClient::Configuration::api_client : WWW::SwaggerClient::APIClient-> new;
45
44
my (%self ) = (
46
45
' api_client' => $default_api_client ,
47
46
@_
Original file line number Diff line number Diff line change @@ -27,9 +27,8 @@ use Exporter;
27
27
use Carp qw( croak ) ;
28
28
use Log::Any qw( $log) ;
29
29
30
-
31
-
32
30
use WWW::SwaggerClient::APIClient;
31
+ use WWW::SwaggerClient::Configuration;
33
32
34
33
our @EXPORT_OK = qw(
35
34
create_user
@@ -45,7 +44,7 @@ our @EXPORT_OK = qw(
45
44
46
45
sub new {
47
46
my $class = shift ;
48
- my $default_api_client = WWW::SwaggerClient::APIClient-> new;
47
+ my $default_api_client = $WWW::SwaggerClient::Configuration::api_client ? $WWW::SwaggerClient::Configuration::api_client : WWW::SwaggerClient::APIClient-> new;
49
48
my (%self ) = (
50
49
' api_client' => $default_api_client ,
51
50
@_
Original file line number Diff line number Diff line change 6
6
use warnings;
7
7
use WWW::SwaggerClient::PetApi;
8
8
use WWW::SwaggerClient::APIClient;
9
+ use WWW::SwaggerClient::Configuration;
9
10
use WWW::SwaggerClient::Object::Pet;
10
11
use WWW::SwaggerClient::Object::Tag;
11
12
use WWW::SwaggerClient::Object::Category;
12
13
use JSON;
13
14
use Data::Dumper;
14
15
use DateTime;
15
16
17
+ $WWW::SwaggerClient::Configuration::http_user_agent = ' Perl-Swagger-Test' ;
18
+
16
19
my $api = WWW::SwaggerClient::PetApi-> new();
17
20
18
21
my $pet_id = 10008;
You can’t perform that action at this time.
0 commit comments