… | |
… | |
121 | but configures the coder object to be safe to use with untrusted |
121 | but configures the coder object to be safe to use with untrusted |
122 | data. Currently, this is equivalent to: |
122 | data. Currently, this is equivalent to: |
123 | |
123 | |
124 | my $cbor = CBOR::XS |
124 | my $cbor = CBOR::XS |
125 | ->new |
125 | ->new |
|
|
126 | ->validate_utf8 |
126 | ->forbid_objects |
127 | ->forbid_objects |
127 | ->filter (\&CBOR::XS::safe_filter) |
128 | ->filter (\&CBOR::XS::safe_filter) |
128 | ->max_size (1e8); |
129 | ->max_size (1e8); |
129 | |
130 | |
130 | But is more future proof (it is better to crash because of a change than |
131 | But is more future proof (it is better to crash because of a change than |
… | |
… | |
133 | =cut |
134 | =cut |
134 | |
135 | |
135 | sub new_safe { |
136 | sub new_safe { |
136 | CBOR::XS |
137 | CBOR::XS |
137 | ->new |
138 | ->new |
|
|
139 | ->validate_utf8 |
138 | ->forbid_objects |
140 | ->forbid_objects |
139 | ->filter (\&CBOR::XS::safe_filter) |
141 | ->filter (\&CBOR::XS::safe_filter) |
140 | ->max_size (1e8) |
142 | ->max_size (1e8) |
141 | } |
143 | } |
142 | |
144 | |