trict;
use warnings;
use DDP ( show_unicode => 1 );
use Exporter qw(import);
use JSON::Path qw(jpath jpath1);
use JSON::XS;
use List::Util qw(any all);
use Test::BDD::Cucumber::Definitions qw(S :vali
use Try::Tiny;
our $VERSION = '0.41';
our @EXPORT_OK = qw(Struct);
# Enable JSONPath Embedded Perl Expressions
$JSON::Path::Safe = 0; ## no critic (Variables::ProhibitPackageVars)
## no critic
ntent_as_json {
my $self = shift;
S->{Struct} = __PACKAGE__;
# Clean data
S->{_Struct}->{data} = undef;
my $error;
S->{_Struct}->{data} = try {
decode_json( S->{HTT
JSON
Given qr/read http response content as JSON/, sub {
Struct->read_http_response_content_as_json();
};
# read file content as JSON
Given qr/read file content as JSON
/, sub {
Struct->read_file_content_as_json();
};
# read zip archive members as list
Given qr/read zip archive members as list/, sub {
Struct->read_zip_archive_membe
Struct (Ru)
Работа с perl-структурами данных
Scenario: HTTP->JSON->Struct
When HTTP-запрос "GET" отправлен на "https://fastapi.metacpan.or
umber-Definitions"
Given содержимое HTTP-ответа прочитано как JSON
Then элемент структуры данных "$.name" совпадает с "Test-
тать JSON из L<HTTP-ответа|Test::BDD::Cucumber::Definitions::HTTP::Ru>
в perl-структуру:
Given содержимое HTTP-ответа прочитано как JSON
=cut