1 /* Gearman Perl front end
2  * Copyright (C) 2009-2010 Dennis Schoen
3  * All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or modify
6  * it under the same terms as Perl itself, either Perl version 5.8.9 or,
7  * at your option, any later version of Perl 5 you may have available.
8  */
9 
10 #include "gearman_xs.h"
11 
12 typedef struct gearman_task_st gearman_xs_task;
13 
14 MODULE = Gearman::XS::Task    PACKAGE = Gearman::XS::Task
15 
16 PROTOTYPES: ENABLE
17 
18 const char *
19 job_handle(self)
20     gearman_xs_task *self
21   CODE:
22     RETVAL= gearman_task_job_handle(self);
23   OUTPUT:
24     RETVAL
25 
26 SV *
27 data(self)
28     gearman_xs_task *self
29   CODE:
30     RETVAL= newSVpvn(gearman_task_data(self), gearman_task_data_size(self));
31   OUTPUT:
32     RETVAL
33 
34 int
35 data_size(self)
36     gearman_xs_task *self
37   CODE:
38     RETVAL= gearman_task_data_size(self);
39   OUTPUT:
40     RETVAL
41 
42 const char *
43 function_name(self)
44     gearman_xs_task *self
45   CODE:
46     RETVAL= gearman_task_function_name(self);
47   OUTPUT:
48     RETVAL
49 
50 uint32_t
51 numerator(self)
52     gearman_xs_task *self
53   CODE:
54     RETVAL= gearman_task_numerator(self);
55   OUTPUT:
56     RETVAL
57 
58 uint32_t
59 denominator(self)
60     gearman_xs_task *self
61   CODE:
62     RETVAL= gearman_task_denominator(self);
63   OUTPUT:
64     RETVAL
65 
66 const char *
67 unique(self)
68     gearman_xs_task *self
69   CODE:
70     RETVAL= gearman_task_unique(self);
71   OUTPUT:
72     RETVAL
73 
74 void
75 is_known(self)
76     gearman_xs_task *self
77   PPCODE:
78     if (gearman_task_is_known(self))
79       XSRETURN_YES;
80     else
81       XSRETURN_NO;
82 
83 void
84 is_running(self)
85     gearman_xs_task *self
86   PPCODE:
87     if (gearman_task_is_running(self))
88       XSRETURN_YES;
89     else
90       XSRETURN_NO;
91