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