Hello All, I am using perl DBI in a perl script to pull information from an api, parse it and then enter it into a database.My code is as follows: So I put the api results in $api_results

$api_results=`curl -H "Authorization: token 5FEFAQ1W4" https://www.bom +/api/v2/organizations/company/admin/groups/"$groid"/installations?pag +e=1 > "$valid"; cat "$valid" | jq -r '(.[]|[.id, .slug, .name, .provi +der.id, .provider.name,.provider.capabilities.has_saml,.configuration +.saml,.configuration.login, .configuration.install_type, .created, .k +eyvault, .requires_mfa_code) | \@csv` ; ##insert statement $app_insert = $dbh->prepare("INSERT IGNORE INTO apps(id, app_slug, app +_Name, provider_id, provider_slug, provider_saml, config_saml, config +_login, config_url, created_date, status, key_vault, mfa_code) VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?") or die $dbh->errstr; ##Insert execution while (my @api = $api_results->fetchrow_arr +ay()) { $app_insert->execute(@api) or die $app_inse +rt->errstr; } print "Done inserting \n"; exit; }

But after I execute the script, I get the following error, I think it is because i dont have api_results->execute() , but there is no statement to execute, so how can I make this work? Thank you

Total % Received % Xferd Average Speed Time Time Time Cu +rrent Dload Upload Total Spent Left + Speed 100 15573 100 15573 0 0 13102 0 0:00:01 0:00:01 --:--: +-- 83278 Can't call method "fetchrow_array" without a package or object referen +ce at bitium.pl line 70, <> line 2.

In reply to Perl Database Entries by cbtshare

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.