home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / plnk065.arj / PLNK065.ZIP / pilot-link.0.6.5 / Perl5 / PDAPilot / Pilot.pm < prev    next >
Encoding:
Perl POD Document  |  1997-05-23  |  14.1 KB  |  476 lines

  1. package PDA::Pilot;
  2.  
  3. require Exporter;
  4. require DynaLoader;
  5. require AutoLoader;
  6.  
  7. @ISA = qw(Exporter DynaLoader);
  8. # Items to export into callers namespace by default. Note: do not export
  9. # names by default without a very good reason. Use EXPORT_OK instead.
  10. # Do not simply export all your public functions/methods/constants.
  11. @EXPORT = qw(
  12.     PI_AF_SLP
  13.     PI_PF_LOOP
  14.     PI_PF_PADP
  15.     PI_PF_SLP
  16.     PI_PilotSocketConsole
  17.     PI_PilotSocketDLP
  18.     PI_PilotSocketDebugger
  19.     PI_PilotSocketRemoteUI
  20.     PI_SOCK_DGRAM
  21.     PI_SOCK_RAW
  22.     PI_SOCK_SEQPACKET
  23.     PI_SOCK_STREAM
  24. );
  25. # Other items we are prepared to export if requested
  26. @EXPORT_OK = qw(
  27. );
  28.  
  29. sub AUTOLOAD {
  30.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  31.     # XS function.  If a constant is not found then control is passed
  32.     # to the AUTOLOAD in AutoLoader.
  33.  
  34.     # NOTE: THIS AUTOLOAD FUNCTION IS FLAWED (but is the best we can do for now).
  35.     # Avoid old-style ``&CONST'' usage. Either remove the ``&'' or add ``()''.
  36.     if (@_ > 0) {
  37.     $AutoLoader::AUTOLOAD = $AUTOLOAD;
  38.     goto &AutoLoader::AUTOLOAD;
  39.     }
  40.     local($constname);
  41.     ($constname = $AUTOLOAD) =~ s/.*:://;
  42.     $val = constant($constname, @_ ? $_[0] : 0);
  43.     if ($! != 0) {
  44.     if ($! =~ /Invalid/) {
  45.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  46.         goto &AutoLoader::AUTOLOAD;
  47.     }
  48.     else {
  49.         ($pack,$file,$line) = caller;
  50.         die "Your vendor has not defined PDA::Pilot macro $constname, used at $file line $line.
  51. ";
  52.     }
  53.     }
  54.     eval "sub $AUTOLOAD { $val }";
  55.     goto &$AUTOLOAD;
  56. }
  57.  
  58. bootstrap PDA::Pilot;
  59.  
  60. # Preloaded methods go here.
  61.  
  62. %PDA::Pilot::DBPackers = (    MemoDB => [    \&PDA::Pilot::Memo::Pack,
  63.                                         \&PDA::Pilot::Memo::Unpack,
  64.                                         \&PDA::Pilot::Memo::PackAppBlock,
  65.                                         \&PDA::Pilot::Memo::UnpackAppBlock],
  66.                             ToDoDB => [    \&PDA::Pilot::ToDo::Pack,
  67.                                         \&PDA::Pilot::ToDo::Unpack,
  68.                                         \&PDA::Pilot::ToDo::PackAppBlock,
  69.                                         \&PDA::Pilot::ToDo::UnpackAppBlock]
  70.                         );
  71.  
  72. #%PDA::Pilot::PrefPackers = ( 'memo' => [\&PDA::Pilot::Memo::PackPref,
  73. #                                        \&PDA::Pilot::Memo::UnpackPref]
  74. #                        );
  75.  
  76. # Autoload methods go after __END__, and are processed by the autosplit program.
  77.  
  78. 1;
  79. __END__
  80.  
  81. =head1
  82.  
  83. Commands include:
  84.  
  85. =over 4
  86.  
  87. =item PDA::Pilot::Appointment::Unpack(buffer) 
  88.  
  89. Returns hash reference containing appointment (datebook entry) in a usable
  90. format, given a record from a .pdb file or a Pilot database.
  91.  
  92. =item PDA::Pilot::Appointment::Pack(buffer) 
  93.  
  94. Given a hash reference in the form that the previous call generates, returns 
  95. a single string suitable for storing in a Pilot's database.
  96.  
  97. =item PDA::Pilot::Appointment::UnpackAppInfo(buffer) 
  98.  
  99. Returns hash reference containing appointment (datebook entry) in a usable
  100. format, given the AppInfo record from a .pdb file or a Pilot database.
  101.  
  102. =item PDA::Pilot::Appointment::PackAppInfo(buffer) 
  103.  
  104. Given a hash reference in the form that the previous call generates, returns 
  105. a single string suitable for storing in a Pilot's database AppInfo block.
  106.  
  107. =item PDA::Pilot::Memo::Unpack(buffer) 
  108.  
  109. Returns hash reference containing appointment (datebook entry) in a usable
  110. format, given a record from a .pdb file or a Pilot database.
  111.  
  112. =item PDA::Pilot::Memo::Pack(buffer) 
  113.  
  114. Given a hash reference in the form that the previous call generates, returns 
  115. a single string suitable for storing in a Pilot's database.
  116.  
  117. =item PDA::Pilot::Memo::UnpackAppInfo(buffer) 
  118.  
  119. Returns hash reference containing appointment (datebook entry) in a usable
  120. format, given the AppInfo record from a .pdb file or a Pilot database.
  121.  
  122. =item PDA::Pilot::Memo::PackAppInfo(buffer) 
  123.  
  124. Given a hash reference in the form that the previous call generates, returns 
  125. a single string suitable for storing in a Pilot's database AppInfo block.
  126.  
  127. =item PDA::Pilot::ToDo::Unpack(buffer) 
  128.  
  129. Returns hash reference containing appointment (datebook entry) in a usable
  130. format, given a record from a .pdb file or a Pilot database.
  131.  
  132. =item PDA::Pilot::ToDo::Pack(buffer) 
  133.  
  134. Given a hash reference in the form that the previous call generates, returns 
  135. a single string suitable for storing in a Pilot's database.
  136.  
  137. =item PDA::Pilot::ToDo::UnpackAppInfo(buffer) 
  138.  
  139. Returns hash reference containing appointment (datebook entry) in a usable
  140. format, given the AppInfo record from a .pdb file or a Pilot database.
  141.  
  142. =item PDA::Pilot::ToDo::PackAppInfo(buffer) 
  143.  
  144. Given a hash reference in the form that the previous call generates, returns 
  145. a single string suitable for storing in a Pilot's database AppInfo block.
  146.  
  147. =item PDA::Pilot::Address::Unpack(buffer) 
  148.  
  149. Returns hash reference containing appointment (datebook entry) in a usable
  150. format, given a record from a .pdb file or a Pilot database.
  151.  
  152. =item PDA::Pilot::Address::Pack(buffer) 
  153.  
  154. Given a hash reference in the form that the previous call generates, returns 
  155. a single string suitable for storing in a Pilot's database.
  156.  
  157. =item PDA::Pilot::Address::UnpackAppInfo(buffer) 
  158.  
  159. Returns hash reference containing appointment (datebook entry) in a usable
  160. format, given the AppInfo record from a .pdb file or a Pilot database.
  161.  
  162. =item PDA::Pilot::Address::PackAppInfo(buffer) 
  163.  
  164. Given a hash reference in the form that the previous call generates, returns 
  165. a single string suitable for storing in a Pilot's database AppInfo block.
  166.  
  167. =item PDA::Pilot::Mail::Unpack(buffer) 
  168.  
  169. Returns hash reference containing appointment (datebook entry) in a usable
  170. format, given a record from a .pdb file or a Pilot database.
  171.  
  172. =item PDA::Pilot::Mail::Pack(buffer) 
  173.  
  174. Given a hash reference in the form that the previous call generates, returns 
  175. a single string suitable for storing in a Pilot's database.
  176.  
  177. =item PDA::Pilot::Mail::UnpackAppInfo(buffer) 
  178.  
  179. Returns hash reference containing appointment (datebook entry) in a usable
  180. format, given the AppInfo record from a .pdb file or a Pilot database.
  181.  
  182. =item PDA::Pilot::Mail::PackAppInfo(buffer) 
  183.  
  184. Given a hash reference in the form that the previous call generates, returns 
  185. a single string suitable for storing in a Pilot's database AppInfo block.
  186.  
  187. =item PDA::Pilot::Socket::socket(domain, type, protocol)
  188.  
  189. Same as pi-link routine called pi_socket.
  190.  
  191. =item PDA::Pilot::Socket::close(socket)
  192.  
  193. Same as pi-link routine called pi_close.
  194.  
  195. =item PDA::Pilot::Socket::write(socket, string)
  196.  
  197. Same as pi-link routine called pi_write.
  198.  
  199. =item PDA::Pilot::Socket::read(socket, len)
  200.  
  201. Same as pi-link routine called pi_write (returns read data as result.)
  202.  
  203. =item PDA::Pilot::Socket::listen(socket, backlog)
  204.  
  205. Same as pi-link routine called pi_listen.
  206.  
  207. =item PDA::Pilot::Socket::bind(socket, sockaddr)
  208.  
  209. Same as pi-link routine called pi_bind. Sockaddr may either be a packed
  210. string containing a pi_sockaddr structure, or a hash reference containing
  211. "device", "family", and "port" keys.
  212.  
  213. =item PDA::Pilot::Socket::accept(socket)
  214.  
  215. Same as pi-link routine called pi_accept. If connection is successfull, returns
  216. reference to hash containing remote address, as described above. If failed, returns
  217. undef.
  218.  
  219. =item PDA::Pilot::DLP::errno()
  220.  
  221. Returns last DLP error, resetting error to zero.
  222.  
  223. =item PDA::Pilot::DLP::GetSysDateTime(socket)
  224.  
  225. Same as DLP call dlp_GetSysDateTime. If successfull, returns time, otherwise
  226. returns undef.
  227.  
  228. =item PDA::Pilot::DLP::SetSysDateTime(socket, time)
  229.  
  230. Same as DLP call dlp_SetSysDateTime. time must be a time_t value.
  231.  
  232. =item PDA::Pilot::DLP::ReadSysInfo(socket)
  233.  
  234. Same as DLP call dlp_ReadSysInfo. If successfull, returns reference to hash
  235. containing system information.
  236.  
  237. =item PDA::Pilot::DLP::ReadStorageInfo(socket, cardno)
  238.  
  239. Same as DLP call dlp_ReadStorageInfo. If successfull, returns reference to hash
  240. containing information on given memory card.
  241.  
  242. =item PDA::Pilot::DLP::ReadUserInfo(socket)
  243.  
  244. Same as DLP call dlp_ReadUserInfo. If successfull, returns reference to hash
  245. containing information about user settings.
  246.  
  247. =item PDA::Pilot::DLP::WriteUserInfo(socket, info)
  248.  
  249. Same as DLP call dlp_WriteUserInfo. info must be a reference to a hash
  250. containing data similar to that returned by ReadUserInfo (Note: the password
  251. can not be set through this call.)
  252.  
  253. =item PDA::Pilot::DLP::OpenDB(socket, cardno, mode, name)
  254.  
  255. Same as DLP call dlp_OpenDB. If successfull returns database handle,
  256. otherwise returns undef.
  257.  
  258. =item PDA::Pilot::DLP::CloseDB(socket, handle)
  259.  
  260. Same as DLP call dlp_CloseDB. 
  261.  
  262. =item PDA::Pilot::DLP::EndOfSync(socket, status)
  263.  
  264. Same as DLP call dlp_EndOfSync. 
  265.  
  266. =item PDA::Pilot::DLP::AbortSync(socket)
  267.  
  268. Same as DLP call dlp_AbortSync. 
  269.  
  270. =item PDA::Pilot::DLP::MoveCategory(socket, handle, fromcat, tocat)
  271.  
  272. Same as DLP call dlp_MoveCategory. 
  273.  
  274. =item PDA::Pilot::DLP::ResetSystem(socket)
  275.  
  276. Same as DLP call dlp_ResetSystem. 
  277.  
  278. =item PDA::Pilot::DLP::OpenConduit(socket)
  279.  
  280. Same as DLP call dlp_OpenConduit. 
  281.  
  282. =item PDA::Pilot::DLP::AddSyncLogEntry(socket, message)
  283.  
  284. Same as DLP call dlp_AddSyncLogEntry 
  285.  
  286. =item PDA::Pilot::DLP::CleanUpDatabase(socket, handle)
  287.  
  288. Same as DLP call dlp_CleanUpDatabase. 
  289.  
  290. =item PDA::Pilot::DLP::ResetSyncFlags(socket, handle)
  291.  
  292. Same as DLP call dlp_ResetSyncFlags. 
  293.  
  294. =item PDA::Pilot::DLP::ResetDBIndex(socket, handle)
  295.  
  296. Same as DLP call dlp_ResetDBIndex. 
  297.  
  298. =item PDA::Pilot::DLP::ResetLastSyncPC(socket)
  299.  
  300. Same as DLP call dlp_ResetLastSyncPC. 
  301.  
  302. =item PDA::Pilot::DLP::DeleteCategory(socket, handle, category)
  303.  
  304. Same as DLP call dlp_DeleteCategory. 
  305.  
  306. =item PDA::Pilot::DLP::DeleteRecord(socket, handle, all, id)
  307.  
  308. Same as DLP call dlp_DeleteRecord. 
  309.  
  310. =item PDA::Pilot::DLP::ReadDBList(socket, cardno, flags, start)
  311.  
  312. Same as DLP call dlp_ReadDBList. If successfull, returns reference
  313. to hash containing DB information. If failed, returns undef.
  314.  
  315. =item PDA::Pilot::DLP::FindDBInfo(socket, cardno, flags, name, type, creator)
  316.  
  317. Same as DLP call dlp_FindDBInfo. If successfull, returns reference
  318. to hash containing DB information. If failed, returns undef.
  319.  
  320. =item PDA::Pilot::DLP::ReadFeature(socket, creator, number)
  321.  
  322. Same as DLP call dlp_ReadFeature. If successfull, returns feature value. If
  323. failed, returns undef.
  324.  
  325. =item PDA::Pilot::DLP::ReadAppBlock(socket, handle)
  326.  
  327. Same as DLP call dlp_ReadAppBlock. If successfull, returns app block. If
  328. failed, returns undef.
  329.  
  330. =item PDA::Pilot::DLP::ReadSortBlock(socket, handle)
  331.  
  332. Same as DLP call dlp_ReadSortBlock. If successfull, returns app block. If
  333. failed, returns undef.
  334.  
  335. =item PDA::Pilot::DLP::WriteAppBlock(socket, handle, block)
  336.  
  337. Same as DLP call dlp_WriteAppBlock.
  338.  
  339. =item PDA::Pilot::DLP::WriteSortBlock(socket, handle, block)
  340.  
  341. Same as DLP call dlp_WriteSortBlock.
  342.  
  343. =item PDA::Pilot::DLP::ReadOpenDBInfo(socket, handle)
  344.  
  345. Same as DLP call dlp_ReadOpenDBInfo.
  346.  
  347. =item PDA::Pilot::DLP::ReadRecordByIndex(socket, handle, index)
  348.  
  349. Same as DLP call dlp_ReadRecordByIndex. If call fails, it returns undef.
  350. Otherwise, in scalar context it returns the read record, in array it returns
  351. the record, id, index, attr, and category, in that order.
  352.  
  353. =item PDA::Pilot::DLP::ReadRecordById(socket, handle, id)
  354.  
  355. Same as DLP call dlp_ReadRecordById. If call fails, it returns undef.
  356. Otherwise, in scalar context it returns the read record, in array it returns
  357. the record, id, index, attr, and category, in that order.
  358.  
  359. =item PDA::Pilot::DLP::ReadNextModifiedRec(socket, handle)
  360.  
  361. Same as DLP call dlp_ReadNextModifiedRec. If call fails, it returns undef.
  362. Otherwise, in scalar context it returns the read record, in array it returns
  363. the record, id, index, attr, and category, in that order.
  364.  
  365. =item PDA::Pilot::DLP::ReadNextRecInCategory(socket, handle, category)
  366.  
  367. Same as DLP call dlp_ReadNextRecInCategory. If call fails, it returns undef.
  368. Otherwise, in scalar context it returns the read record, in array it returns
  369. the record, id, index, attr, and category, in that order.
  370.  
  371. =item PDA::Pilot::DLP::ReadNextModifiedRecInCategory(socket, handle, category)
  372.  
  373. Same as DLP call dlp_ReadNextModifiedRecInCategory. If call fails, it returns undef.
  374. Otherwise, in scalar context it returns the read record, in array it returns
  375. the record, id, index, attr, and category, in that order.
  376.  
  377. =item PDA::Pilot::DLP::WriteRecord(socket, handle, record, id, attr, category)
  378.  
  379. Same as DLP call dlp_WriteRecord.
  380.  
  381. =item PDA::Pilot::DLP::ReadResourceByType(socket, handle, type, id)
  382.  
  383. Same as DLP call dlp_ReadResourceByType. If call fails, it returns undef.
  384. Otherwise, in scalar context it returns the read record, in array it returns
  385. the record, type, id, and index, in that order.
  386.  
  387. =item PDA::Pilot::DLP::ReadResourceByIndex(socket, handle, index)
  388.  
  389. Same as DLP call dlp_ReadResourceByIndex. If call fails, it returns undef.
  390. Otherwise, in scalar context it returns the read record, in array it returns
  391. the record, type, id, and index, in that order.
  392.  
  393. =item PDA::Pilot::DLP::WriteResource(socket, handle, record, type, id)
  394.  
  395. Same as DLP call dlp_WriteResource.
  396.  
  397. =item PDA::Pilot::DLP::DeleteResource(socket, handle, all, type, id)
  398.  
  399. Same as DLP call dlp_DeleteResource.
  400.  
  401. =item PDA::Pilot::DLP::CallApplication(socket, creator, type, action, data)
  402.  
  403. Same as DLP call dlp_CallApplication.
  404.  
  405. =item PDA::Pilot::File::open(name)
  406.  
  407. Same as pi_file_open. Returns a PDA::Pilot::File object on success.
  408.  
  409. =item PDA::Pilot::File::close(file)
  410.  
  411. Same as pi_file_close.
  412.  
  413. =item PDA::Pilot::File::get_app_info(file)
  414.  
  415. Same as pi_file_get_app_info.
  416.  
  417. =item PDA::Pilot::File::get_sort_info(file)
  418.  
  419. Same as pi_file_get_sort_info.
  420.  
  421. =item PDA::Pilot::File::get_entries(file)
  422.  
  423. Same as pi_file_get_entries.
  424.  
  425. =item PDA::Pilot::File::read_resource(file, index)
  426.  
  427. Same as pi_file_read_resource. Returns (record, type, id, index).
  428.  
  429. =item PDA::Pilot::File::read_record(file, index)
  430.  
  431. Same as pi_file_read_record. Returns (record, id, index, attr, category).
  432.  
  433. =item PDA::Pilot::File::read_record_by_id(file, type, id)
  434.  
  435. Same as pi_file_read_record_by_id. Returns (record, id, index, attr, category).
  436.  
  437. =item PDA::Pilot::File::create(name, info)
  438.  
  439. Same as pi_file_create. Info is reference to hash containg dbinfo data.
  440.  
  441. =item PDA::Pilot::File::get_info(file)
  442.  
  443. Same as pi_file_get_info.
  444.  
  445. =item PDA::Pilot::File::set_info(file, info)
  446.  
  447. Same as pi_file_set_info.
  448.  
  449. =item PDA::Pilot::File::set_app_info(file, data)
  450.  
  451. Same as pi_file_set_app_info.
  452.  
  453. =item PDA::Pilot::File::set_sort_info(file, data)
  454.  
  455. Same as pi_file_set_sort_info.
  456.  
  457. =item PDA::Pilot::File::append_resource(file, data, type, id)
  458.  
  459. Same as pi_file_append_resource.
  460.  
  461. =item PDA::Pilot::File::append_record(file, data, attr, category, id)
  462.  
  463. Same as pi_file_append_record.
  464.  
  465. =item PDA::Pilot::File::install(file, socket, cardno)
  466.  
  467. Same as pi_file_install.
  468.  
  469. =item PDA::Pilot::File::retrieve(file, socket, cardno)
  470.  
  471. Same as pi_file_retrieve.
  472.  
  473. =back
  474.  
  475. =cut
  476.