The code you have posted seems to be a mish mash of the code from the modules synopsis, and different parts of the documentation.
my $code = "I didn't find in documentation, what is this code, and how
+ do I get it";
$instagram->code($code);
Both the instagram docs and the example code for the new constructor show how to specify the response type, which I suggest you try:
use API::Instagram;
my $instagram = API::Instagram->new({
client_id => 'xxxxxxxxxx',
client_secret => 'xxxxxxxxxx',
redirect_uri => 'http://localhost',
scope => 'basic',
response_type => 'code'
granty_type => 'authorization_code',
});
print $instagram->get_auth_url;
In fact the lines following your attempt match those that follow this type of usage.