1Language::Prolog::TypesU:s:eCronCvoenrttreirb(u3t)ed PerLlanDgoucaugmee:n:tPartoiloong::Types::Converter(3)
2
3
4

NAME

6       Language::Prolog::Types::Converter - Converts from Perl objects to
7       Prolog terms
8

SYNOPSIS

10         package MyModule;
11
12         use Language::Prolog::Types::Converter;
13         our @ISA=qw(Language::Prolog::Types::Converter);
14
15         sub hash2prolog {
16             ...
17         }
18
19         sub scalar2prolog {
20             ...
21         }
22
23         etc.
24

ABSTRACT

26       This module implements a class to be used from interfaces to Prolog
27       systems (SWI-Prolog, XSB, etc.) to transform complex Perl data types to
28       Prolog types.
29

DESCRIPTION

31       You should use this module if you want to change the default
32       conversions performed when passing data between Perl and Prolog.
33
34   METHODS
35       "Language::Prolog::Types::Converter-">new()>
36           returns a new converter object.
37
38       "$self->pass_as_opaque($class1, $class2, ...)"
39           instruct the converter object to pass objects belonging to classes
40           class1, class2, etc. to Prolog as opaque objects. The Prolog
41           interpreter will not touch them but just use them in Perl call
42           backs.
43
44       To override the default conversions performed, you have to redefine the
45       method "perl_ref2prolog".
46
47       If you make your converter class inherit
48       Language::Prolog::Types::Converter, you can change conversions only for
49       selected types overriding those methods:
50
51       "$conv->hash2prolog($hash_ref)"
52           converts a Perl hash reference to a Prolog term.
53
54           It creates a list of functors '=>/2' with the key/value pairs as
55           arguments:
56
57             [ '=>'(key0, value0), '=>'(key1, value1), ... ]
58
59       "$conv->scalar2prolog($scalar_ref)"
60           converts a Perl scalar reference to a Prolog term.
61
62       "$conv->glob2prolog($glob_ref)"
63           converts a Perl glob reference to a Prolog term.
64
65       "$conv->code2prolog($code_ref)"
66           converts a Perl sub reference to a Prolog term.
67
68       "$conv->object2prolog($object_ref)"
69           converts any other Perl object to a Prolog term.
70
71           Default implementation looks for a method called
72           "convert2prolog_term" in the object class.
73
74           If this fails, it reverts to dump the internal representation of
75           the object as the functor:
76
77             perl_object(class, state)
78
79           "state" is the conversion of the perl datatype used to represent
80           the object (array, hash, scalar, glob or sub).
81
82   EXPORT
83       None by default. This module has an OO interface.
84

SEE ALSO

86       Language::Prolog::Types, Language::XSB::Base,
87       Language::Prolog::Yaswi::Low.
88

AUTHOR

90       Salvador Fandiño, <sfandino@yahoo.com>
91
93       Copyright 2002 by Salvador Fandiño
94
95       This library is free software; you can redistribute it and/or modify it
96       under the same terms as Perl itself.
97

POD ERRORS

99       Hey! The above document had some coding errors, which are explained
100       below:
101
102       Around line 210:
103           Non-ASCII character seen before =encoding in 'Fandiño,'. Assuming
104           CP1252
105
106
107
108perl v5.38.0                      2023-07-L2a0nguage::Prolog::Types::Converter(3)
Impressum