| 1 | package WWW::Salesforce::Simple; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use base 'WWW::Salesforce'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | #handle versioning and exporting | ||
| 9 | 2 | our $VERSION = '0.304'; | |
| 10 | |||
| 11 | # alias these methods to the base class | ||
| 12 | |||
| 13 | 2 | 1; | |
| 14 | |||
| 15 | __END__ | ||
| 16 | |||
| 17 | =pod | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | WWW::Salesforce::Simple.pm - this class provides a simpler abstraction layer between WWW::Salesforce and Salesforce.com. | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | Because the Salesforce API is somewhat cumbersome to deal with, this class | ||
| 26 | was created to make it a little simpler to get information. | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | This class inherits all the methods from L<WWW::Salesforce> and adds the following new ones. | ||
| 31 | |||
| 32 | =head2 new( %parameters ) | ||
| 33 | |||
| 34 | Handles creating new Salesforce objects as well as the login process | ||
| 35 | to use the salesforce objects. | ||
| 36 | |||
| 37 | =head2 do_query( $sql_query_string ) | ||
| 38 | |||
| 39 | Executes a query against the information in Salesforce. Returns a reference | ||
| 40 | to an array of hash references keyed by the column names. Strict attention | ||
| 41 | should be paid to the case of the field names. | ||
| 42 | |||
| 43 | =head2 do_queryAll( $sql_query_string ) | ||
| 44 | |||
| 45 | Executes a query against the information in Salesforce. Returns a reference | ||
| 46 | to an array of hash references keyed by the column names that includes deleted | ||
| 47 | and archived objects. Strict attention should be paid to the case of the field | ||
| 48 | names. | ||
| 49 | |||
| 50 | =head2 get_field_list( $table_name ) | ||
| 51 | |||
| 52 | Gathers a list of fields contained in a given table. Returns a reference | ||
| 53 | to an array of hash references. The hash references have several keys | ||
| 54 | which provide information about the field's type, etc. The key 'name' | ||
| 55 | will provide the name of the field itself. | ||
| 56 | |||
| 57 | =head2 get_tables( ) | ||
| 58 | |||
| 59 | Gathers a list of tables available for use from salesforce. Returns a | ||
| 60 | reference to an array of strings representing each table name. | ||
| 61 | |||
| 62 | |||
| 63 | =head1 EXAMPLES | ||
| 64 | |||
| 65 | =head2 new() | ||
| 66 | |||
| 67 | use WWW::Salesforce::Simple; | ||
| 68 | |||
| 69 | my $sforce = WWW::Salesforce::Simple->new( | ||
| 70 | 'username' => $user, | ||
| 71 | 'password' => $pass | ||
| 72 | ); | ||
| 73 | |||
| 74 | =head2 do_query( $query ) | ||
| 75 | |||
| 76 | my $query = 'select Id from Account'; | ||
| 77 | |||
| 78 | my $res = $sforce->do_query( $query ); | ||
| 79 | |||
| 80 | foreach my $field ( @{ $res } ) { | ||
| 81 | print $field->{'Id'} . "\n"; | ||
| 82 | } | ||
| 83 | print "Found " . scalar @{$res} . " results\n"; | ||
| 84 | |||
| 85 | =head2 do_queryAll( $query ) | ||
| 86 | |||
| 87 | my $query = 'select Id from Account'; | ||
| 88 | |||
| 89 | my $res = $sforce->do_queryAll( $query ); | ||
| 90 | |||
| 91 | foreach my $field ( @{ $res } ) { | ||
| 92 | print $field->{'Id'} . "\n"; | ||
| 93 | } | ||
| 94 | print "Found " . scalar @{$res} . " results\n"; | ||
| 95 | |||
| 96 | =head2 get_field_list( $table_name ) | ||
| 97 | |||
| 98 | my $fields_ref = $sforce->get_field_list( 'Account' ); | ||
| 99 | |||
| 100 | foreach my $field( @{$fields_ref} ) { | ||
| 101 | print $field->{'name'} . "\n"; | ||
| 102 | foreach my $key ( keys %{$field} ) { | ||
| 103 | print "\t $key --> "; | ||
| 104 | print $field->{$key} if ( $field->{$key} ); | ||
| 105 | print "\n"; | ||
| 106 | } | ||
| 107 | print "\n"; | ||
| 108 | } | ||
| 109 | |||
| 110 | =head2 get_tables() | ||
| 111 | |||
| 112 | my $tables_ref = $sforce->get_tables(); | ||
| 113 | |||
| 114 | foreach my $table ( @{$tables_ref} ) { | ||
| 115 | print "$table\n"; | ||
| 116 | } | ||
| 117 | print "\n"; | ||
| 118 | |||
| 119 | =head1 SUPPORT | ||
| 120 | |||
| 121 | Please visit Salesforce.com's user/developer forums online for assistance with | ||
| 122 | this module. You are free to contact the author directly if you are unable to | ||
| 123 | resolve your issue online. | ||
| 124 | |||
| 125 | =head1 AUTHORS | ||
| 126 | |||
| 127 | Chase Whitener <F<capoeirab@cpan.org>> | ||
| 128 | |||
| 129 | Fred Moyer <fred at redhotpenguin dot com> | ||
| 130 | |||
| 131 | =head1 COPYRIGHT & LICENSE | ||
| 132 | |||
| 133 | Copyright 2003-2004 Byrne Reese, Chase Whitener, Fred Moyer. All rights reserved. | ||
| 134 | |||
| 135 | This program is free software; you can redistribute it and/or modify it | ||
| 136 | under the same terms as Perl itself. | ||
| 137 | |||
| 138 | =cut | ||