From 73b1451ebad641dec4617292e98de61425b4c285 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Mon, 10 Mar 2014 18:33:17 -0400 Subject: [PATCH] Add Perl SDK page. --- doc/_config.yml | 2 + doc/sdk/index.html.textile.liquid | 1 + doc/sdk/perl/index.html.textile.liquid | 101 +++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 doc/sdk/perl/index.html.textile.liquid diff --git a/doc/_config.yml b/doc/_config.yml index 8d4fd5e115..b600dda197 100644 --- a/doc/_config.yml +++ b/doc/_config.yml @@ -52,6 +52,8 @@ navbar: - sdk/python/sdk-python.html.textile.liquid - sdk/python/python.html.textile.liquid - sdk/python/crunch-utility-libraries.html.textile.liquid + - Perl: + - sdk/perl/index.html.textile.liquid api: - Concepts: - api/index.html.textile.liquid diff --git a/doc/sdk/index.html.textile.liquid b/doc/sdk/index.html.textile.liquid index b7a4ecd6c6..eba8e98eaa 100644 --- a/doc/sdk/index.html.textile.liquid +++ b/doc/sdk/index.html.textile.liquid @@ -7,3 +7,4 @@ title: "Arvados SDK Reference" This section documents how to access the Arvados API and Keep using various programming languages. * "Python SDK":python/sdk-python.html +* "Perl SDK":perl/index.html diff --git a/doc/sdk/perl/index.html.textile.liquid b/doc/sdk/perl/index.html.textile.liquid new file mode 100644 index 0000000000..c164d609ad --- /dev/null +++ b/doc/sdk/perl/index.html.textile.liquid @@ -0,0 +1,101 @@ +--- +layout: default +navsection: sdk +navmenu: Perl +title: "Perl SDK" + +... + +h1. Perl SDK + +The Perl SDK provides a generic set of wrappers so you can make API calls easily. + +It should be treated as alpha/experimental. Currently, limitations include: +* Verbose syntax. +* No native Keep client. +* No CPAN package. + +h3. Installation + + +
+$ sudo apt-get install libjson-perl libio-socket-ssl-perl libwww-perl
+$ git clone https://github.com/curoverse/arvados.git
+$ cd arvados/sdk/perl
+$ perl Makefile.PL
+$ sudo make install
+
+
+ +h4. Test installation + +If the SDK is installed, @perl -MArvados -e ''@ should produce no errors. + +If your @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ environment variables are set up correctly (see "api-tokens":{{site.baseurl}}/user/reference/api-tokens.html for details), the following test script should work: + + +
$ perl <<'EOF'
+use Arvados;
+my $arv = Arvados->new('apiVersion' => 'v1');
+my $me = $arv->{'users'}->{'current'}->execute;
+print ("arvados.v1.users.current.full_name = '", $me->{'full_name'}, "'\n");
+EOF
+arvados.v1.users.current.full_name = 'Your Name'
+
+
+ +h3. Examples + +Set up an API client user agent: + + +
my $arv = Arvados->new('apiVersion' => 'v1');
+
+
+ +Get the User object for the current user: + + +
my $current_user = $arv->{'users'}->{'current'}->execute;
+
+
+ +Get the UUID of an object that was retrieved using the SDK: + + +
my $current_user_uuid = $current_user->{'uuid'}
+
+
+ +Retrieve an object by ID: + + +
my $some_user = $arv->{'users'}->{'get'}->execute('uuid' => $current_user_uuid);
+
+
+ +Create an object: + + +
my $test_link = $arv->{'links'}->{'create'}->execute('link' => { 'link_class' => 'test', 'name' => 'test' });
+
+
+ +Update an object: + + +
my $test_link = $arv->{'links'}->{'update'}->execute(
+        'uuid' => $test_link->{'uuid'},
+        'link' => { 'properties' => { 'foo' => 'bar' } });
+
+
+ +Get a list of objects: + + +
my $repos = $arv->{'repositories'}->{'list'}->execute;
+print ("UUID of first repo returned is ", $repos->{'items'}->[0], "\n");
+
+
+ +The SDK retrieves the list of API methods from the server at run time. Therefore, the set of available methods is determined by the server version rather than the SDK version. -- 2.39.5