!!!! UPDATE: Solved by stevieb !!!! Hello! A little background: I am developing a solution for my organization to automate Data Integration from Salesforce to Teradata. I wrote the whole thing already, mainly in bash, and I picked up Perl along the way. Now I am trying to recreate the process purely in Perl. I came across the WWW::Salesforce module which seems powerful but there really isn't much information out there. This is what I'm trying to do: I run an API called describeGlobal(). It returns a HUGE amount of data, most of which I don't need. I have been able to narrow down the result to the data that is relevant to me using ->result->{sobjects}. What I end up with is ALMOST an Array of Hashes, except for one difference (*I think): There are brackets instead of parentheses.
#!/usr/bin/perl use warnings; use strict; use diagnostics; use WWW::Salesforce; use Data::Dumper; my $sforce = eval { WWW::Salesforce->login( username => 'xxxxxxx', password => 'xxxxxxx', serverurl=> 'https://xxxxxxx.salesforce.com/servic +es/Soap/u/34.0'); }; die "Could not login to SFDC: $@" if $@; my @tableattribute_ref=$sforce->describeGlobal()->result->{sobjects};
Here is a sample of a Dumper output. See what I mean? Does it matter that there are brackets here instead of parentheses?
[ { 'custom' => 'true', 'deletable' => 'false', 'retrieveable' => 'true', 'layoutable' => 'true', 'queryable' => 'true', 'createable' => 'false', 'customSetting' => 'false', 'deprecatedAndHidden' => 'false', 'undeletable' => 'false', 'triggerable' => 'true', 'keyPrefix' => 'a0k', 'name' => 'x1', 'updateable' => 'false', 'feedEnabled' => 'false', 'mergeable' => 'false', 'searchable' => 'true', 'replicateable' => 'true', 'labelPlural' => 'x1s', 'activateable' => 'false', 'label' => 'x1' }, { 'custom' => 'true', 'deletable' => 'false', 'retrieveable' => 'true', 'layoutable' => 'true', 'queryable' => 'true', 'createable' => 'false', 'customSetting' => 'true', 'deprecatedAndHidden' => 'false', 'undeletable' => 'false', 'triggerable' => 'false', 'keyPrefix' => 'a16', 'name' => 'x2', 'updateable' => 'false', 'feedEnabled' => 'false', 'mergeable' => 'false', 'searchable' => 'true', 'replicateable' => 'true', 'labelPlural' => 'x2s', 'activateable' => 'false', 'label' => 'x2' }, { 'custom' => 'false', 'deletable' => 'true', 'retrieveable' => 'true', 'layoutable' => 'false', 'queryable' => 'true', 'createable' => 'true', 'customSetting' => 'false', 'deprecatedAndHidden' => 'false', 'undeletable' => 'false', 'triggerable' => 'false', 'keyPrefix' => '083', 'name' => 'x3', 'updateable' => 'false', 'feedEnabled' => 'false', 'mergeable' => 'false', 'searchable' => 'false', 'replicateable' => 'true', 'labelPlural' => 'x3s', 'activateable' => 'false', 'label' => 'x3' } ];
I need to pull the names out of this to create an array. Here's an alternative, I can pull the names just fine 1 by 1.
my $tableattribute_ref=$sforce->describeGlobal()->result->{sobjects}[# +]{name};
Then I can add it to a loop... I haven't added the piece that will kill the loop yet, just testing it out.
my $count; $count = 0; while ($count >= 0) { $tableattribute_ref=$sforce->describeGlobal()->result->{sobjects}[$cou +nt]{name}; #This is where I can push names to an array $count++; }
Problem is this solution takes forever... (like 10 minutes). I already have an alternative where I bypass WWW::Salesforce completely and just use WWW::Curl::Share. It runs super fast but there's a lot more lines of code because I'm continually creating and submitting XML forms via Curl. I'd much rather use a packaged approach like WWW::Salesforce. Any advice would be much appreciated! Thank you so much for your time. -bigdatageek

In reply to Salesforce Data Parser by bigdatageek

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.