I'm currently working with an API, and I wrote a short script to get details of a project I created. I'm able tu successfuly display the whole content with Data::Dumper but I cannot display a specific element or assign it to a variable. Here is my short code :
# !/usr/bin/perl
use strict;
use warnings;
use TestLink::API;
use Data::Dumper;
my $tl=TestLink::API->new('http://127.0.0.1/testlink-1.9.16/lib/api/xmlrpc/v1/xmlrpc.php', 'a64aaa61db4e9f65d4e52745b86e3d8f');
print Dumper($tl->getProjectByName('Created_With_API'));
my %hachage = $tl->getProjectByName('Created_With_API');
And this code display my information, ie :
$VAR1 = {
'prefix' => 'CWAPI',
'notes' => 'res ipsa loquiter',
'opt' => {
'inventoryEnabled' => '1',
'testPriorityEnabled' => '1',
'automationEnabled' => '1',
'requirementsEnabled' => '1'
},
'options' => 'O:8:"stdClass":4:{s:19:"requirementsEnabled";i:1;s:19:"testPriorityEnabled";i:1;s:17:"automationEnabled";i:1;s:16:"inventoryEnabled";i:1;}',
'color' => '',
'option_priority' => '0',
'issue_tracker_enabled' => '0',
'id' => '14',
'is_public' => '1',
'option_reqs' => '0',
'type' => 'project',
'api_key' => '9bc99494a418140a1a625257da91d9f855b452c05f498ac2db94cbbbb331db58',
'name' => 'Created_With_API',
'option_automation' => '0',
'reqmgr_integration_enabled' => '0',
'tc_counter' => '0',
'active' => '1'
};
But I can't display a specific element, when I write
print "$hachage{id}";
I get an error. I KNOW, I'm probably doing something wrong, I started learning Perl a few days ago for this API and there must be awfull things. But I'd just like to know what am I doing wrong. Thanks for your help for those who will take time to answer me ;)