lib/auto/share/dist/MOSES-MOBY/samples/Service/HelloBiomobyWorld.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
process_it
2.0
BEGIN
2.0
CRAP 2.0
1  
2 #-----------------------------------------------------------------
3 # Service name: HelloBiomobyWorld
4 # Authority: samples.jmoby.net
5 # Created: 14-Oct-2006 14:42:51 BST
6 # Contact: martin.senger@gmail.com
7 # Description: This is a cult service, known to an exclusive group of persons sharing an esoteric interest. One of their
8 # believes is that a word started on January, 1 1970.
9 #
10 #-----------------------------------------------------------------
11  
12 package Service::HelloBiomobyWorld;
13  
14 use FindBin qw( $Bin );
15 use lib $Bin;
16  
17 #-----------------------------------------------------------------
18 # This is a mandatory section - but you can still choose one of
19 # the two options (keep one and commented out the other):
20 #-----------------------------------------------------------------
21 use MOSES::MOBY::Base;
22 # --- (1) this option loads dynamically everything
23 BEGIN {
24 use MOSES::MOBY::Generators::GenServices;
25 new MOSES::MOBY::Generators::GenServices->load
26 (authority => 'samples.jmoby.net',
27 service_names => ['HelloBiomobyWorld']);
28 }
29  
30 # --- (2) this option uses pre-generated module
31 # You can generate the module by calling a script:
32 # cd jMoby/src/Perl
33 # ../scripts/generate-services.pl -b samples.jmoby.net HelloBiomobyWorld
34 # then comment out the whole option above, and uncomment
35 # the following line (and make sure that Perl can find it):
36 #use net::jmoby::samples::HelloBiomobyWorldBase;
37  
38 # (this to stay here with any of the options above)
39 use vars qw( @ISA );
40 @ISA = qw( net::jmoby::samples::HelloBiomobyWorldBase );
41 use MOSES::MOBY::Package;
42 use MOSES::MOBY::ServiceException;
43 use strict;
44  
45 #-----------------------------------------------------------------
46 # process_it
47 # This method is called for every job in the client request.
48 # Input data are in $request, this method creates a response
49 # into $response. The $context tells about all other jobs
50 # from the same request, and it can be used to fill there
51 # exceptions and service notes.
52 #-----------------------------------------------------------------
53 sub process_it {
54 my ($self, $request, $response, $context) = @_;
55  
56 # fill the response:
57  
58 # this is the long way...
59 # my $greeting = new MOSES::MOBY::Data::String
60 # (
61 # value => "Hello, BioMoby!",
62 # );
63 # $response->greeting ($greeting);
64  
65 # ...but for basic data types, you can use a shortcut:
66 $response->greeting ("Hello, BioMoby!");
67  
68 # fill service notes (if you wish)
69 $context->serviceNotes
70 ('Response created at ' . gmtime() . ' (GMT), by the service \'HelloBiomobyWorld\'.');
71 }
72  
73 1;
74 __END__