Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: While Loops

by Anonymous Monk
on Jan 08, 2013 at 20:29 UTC ( #1012337=note: print w/ replies, xml ) Need Help??


in reply to Re: While Loops
in thread While Loops

I'm not really trying to print, I was just using that as an example. I apologize for not being specific enough. My code is below and I'm basically opening a file and storing it into an array. I then take the first column and query our Quickbase database to return the primary key, then I map that primary key to @data and import back into Quickbase.

The problem is I can only do the gen_results_table call for a 100 stores at a time, so I have to run that gen_results_table statement once for every 100 stores.

#!/usr/bin/perl require 'c:/quickbase.pm';#REF Perl SDK use LWP; my $url = "http://somesite.com/forcast.txt"; my $ua = LWP::UserAgent->new(); $ua->proxy(['http'],'http://ourproxy.oursite.com:80'); $ua->credentials($netloc, $realm, $uname, $pass); my $response = $ua->get($url); open (FILE, ">C:\\snow.txt") || die "Can't open Snow.txt $!\n"; print FILE $response->content; close(FILE); open (FILE, "<C:\\snow.txt") || die "Can't open Snow.txt $!\n"; my $column=0; while ($line = <FILE>){ chomp($line); push @data, [split /\t/,$line]; } close(FILE); @column = map {$$_[0]} @data; shift(@column); $stores = join( ' OR ',@column); my $qdb = HTTP::QuickBase->new(); $qdb->proxy('http://ourproxy.oursite.com:80'); $qdb->url_prefix("https://www.quickbase.com/db"); $qdb->authenticate("MyUserName","MyPass"); $qdb->apptoken('bj6azdybdeg8akbcu5ggabfdedsi'); my $recid=$qdb->gen_results_table("babvce7n4",{query=>"{'6'.EX.$stores +}",clist=>"3",options=>"csv"}); my @recids = split /\n|\r\n/,$recid; my $i = 0; @data = map{unshift(@{$_},$recids[$i++]);$_} @data; $a = join( "\n", map {join(',',@{$_})} @data); my $import = $qdb->import_from_csv("bhabcde7f",$a,"6.7.8.9.10.11.12.13 +.14.15.16.17.18.19.20.21.22.23.24.25","1");

Keep in mind I am new to Perl


Comment on Re^2: While Loops
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-10-30 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls