|
10 | 10 |
|
11 | 11 | use Thrift::HttpClient; |
12 | 12 | use Thrift::BinaryProtocol; |
13 | | -# EDAMNoteStore::NoteStore の中などで使われているが, その中では use されていないので |
14 | | -# ここで use しなければならない |
15 | | -use EDAMTypes::Types; |
16 | | -use EDAMErrors::Types; |
17 | | -# $VAR1 = 'Undefined subroutine &EDAMTypes::Notebook called at modules/evernote-sdk-perl/lib//EDAMNoteStore/NoteStore.pm line 1137. |
18 | | -# みたいなエラーが出る |
| 13 | +use EDAMTypes::Types; # you must do `use' EDAMTypes::Types and EDAMErrors::Types |
| 14 | +use EDAMErrors::Types; # before doing `use' EDAMUserStore::UserStore or EDAMNoteStore::NoteStore |
19 | 15 | use EDAMUserStore::UserStore; |
20 | 16 | use EDAMNoteStore::NoteStore; |
21 | 17 | use EDAMUserStore::Constants; |
|
38 | 34 | my $user_store_url = 'https://' . $evernote_host . '/edam/user'; |
39 | 35 |
|
40 | 36 | my $user_store_client = Thrift::HttpClient->new( $user_store_url ); |
41 | | - # timeout のデフォルト値 (200 / 700) だと短すぎるので, 長くする |
| 37 | + # default timeout value may be too short |
42 | 38 | $user_store_client->setSendTimeout( 2000 ); |
43 | 39 | $user_store_client->setRecvTimeout( 10000 ); |
44 | 40 | my $user_store_prot = Thrift::BinaryProtocol->new( $user_store_client ); |
|
53 | 49 | } |
54 | 50 |
|
55 | 51 | my $note_store_url = $user_store->getNoteStoreUrl( $auth_token ); |
56 | | - #my $note_store_url = 'https://sandbox.evernote.com/edam/note/shard/s1'; |
57 | 52 |
|
58 | 53 | warn '[INFO] note store url : ' . $note_store_url; |
59 | 54 | my $note_store_client = Thrift::HttpClient->new( $note_store_url ); |
60 | | - # timeout のデフォルト値 (200 / 700) だと短すぎるので, 長くする |
| 55 | + # default timeout value may be too short |
61 | 56 | $note_store_client->setSendTimeout( 2000 ); |
62 | 57 | $note_store_client->setRecvTimeout( 10000 ); |
63 | 58 | my $note_store_prot = Thrift::BinaryProtocol->new( $note_store_client ); |
64 | 59 | my $note_store = EDAMNoteStore::NoteStoreClient->new( $note_store_prot, $note_store_prot ); |
65 | 60 |
|
66 | 61 | # List all of the notebooks in the user's account |
67 | | - my $notebooks = $note_store->listNotebooks( $auth_token ); # ARRAY[EDAMTypes::Notebook] |
| 62 | + my $notebooks = $note_store->listNotebooks( $auth_token ); # ARRAY of EDAMTypes::Notebook objects |
68 | 63 |
|
69 | 64 | printf "Found %d notebooks:\n", scalar(@$notebooks); |
70 | 65 | my $default_notebook = $notebooks->[0]; |
|
126 | 121 | my $created_note = $note_store->createNote( $auth_token, $note ); |
127 | 122 |
|
128 | 123 | printf "Successfully created a new note with GUID: %s\n", $created_note->guid; |
129 | | - |
130 | 124 | }; |
131 | 125 | if ( $@ ) { |
132 | 126 | warn 'ERROR'; |
|
0 commit comments