Lines Matching refs:opt

27 my $opt = XMLin(q(<opt name1="value1" name2="value2"></opt>));
35 ok(defined($opt), 'and it returned a value');
37 is(ref($opt), 'HASH', 'and a hasref at that');
38 is_deeply($opt, $expected, 'matches expectations (attributes)');
43 $opt = XMLin(<<__XML);
50 is_deeply($opt, $expected, 'same again with nested elements');
55 $opt = XMLin(q(<opt name1="value1" name2="value2" />));
56 is_deeply($opt, $expected, 'attributes in empty element');
61 $opt = XMLin(<<__XML);
72 is_deeply($opt, {
80 $opt = XMLin(<<__XML);
86 is_deeply($opt, { item => { name1 => 'value1', name2 => 'value2' } }, 'nested element gives hash');
91 $opt = XMLin(q(
97 is_deeply($opt, {
119 $opt = XMLin($string);
120 is_deeply($opt, $target, "array folded on default key 'name'");
132 $opt = XMLin($string, keyattr => [], @cont_key);
133 is_deeply($opt, $target, 'not folded when keyattr turned off');
138 $opt = XMLin($string, keyattr => {}, @cont_key);
139 is_deeply($opt, $target, 'still works when keyattr is empty hash');
144 $opt = XMLin(q(
150 is_deeply($opt, {
158 $opt = XMLin(q(
164 is_deeply($opt, {
187 $opt = XMLin($xml, keyattr => [qw(xname)], @cont_key);
188 is_deeply($opt, $target, "folded on non-default key 'xname'");
193 $opt = XMLin($xml, keyattr => { 'item' => 'xname' }, @cont_key);
194 is_deeply($opt, $target, 'same again but keyattr set with hash');
199 $opt = XMLin($xml, keyattr => [qw(wibble xname)], @cont_key);
200 is_deeply($opt, $target, 'keyattr as array with value in second position');
205 $opt = XMLin($xml, keyattr => qw(xname), @cont_key);
206 is_deeply($opt, $target, 'keyattr as scalar');
211 $opt = XMLin($xml, KeyAttr => qw(xname), @cont_key);
212 is_deeply($opt, $target, 'KeyAttr as scalar');
217 $opt = XMLin($xml, key_attr => qw(xname), @cont_key);
218 is_deeply($opt, $target, 'key_attr as scalar');
239 $opt = XMLin($xml, @cont_key);
240 is_deeply($opt, $target, 'fold same array on two different keys');
251 $opt = XMLin($xml, keyattr => { 'item' => 'id' }, @cont_key);
252 is_deeply($opt, $target, 'same again but with priority switch');
291 $opt = XMLin($xml, forcearray => 1,
293 is_deeply($opt, $target, 'folded on multi-key keyattr hash');
324 $opt = XMLin($xml, forcearray => 1, keyattr => { 'car' => '+license', 'option' => '-pn' }, @cont_ke…
325 is_deeply($opt, $target, "same again but with '+' prefix to copy keys");
354 $opt = XMLin($xml, @cont_key);
355 is_deeply($opt, $target, "did not fold on default key with non-scalar value");
359 $opt = XMLin($xml, keyattr => { item => 'name' }, @cont_key);
360 is_deeply($opt, $target, "did not fold on specific key with non-scalar value");
368 $opt = XMLin($xml, keyattr => [ 'name' ], @cont_key);
369 is_deeply($opt, $target, "same again but with keyattr as array");
378 $opt = XMLin($xml, keyattr => {item => 'name'}, @cont_key);
379 is_deeply($opt, $target, "did not fold on specific key with non-scalar value");
396 $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
397 is_deeply($opt, $items, "did not fold when element missing key attribute");
403 $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
404 is_deeply($opt, $items, "same again");
422 $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
423 is_deeply($opt, $items, "folded elements despite non-unique key attribute");
428 $opt = XMLin($xitems, keyattr => [ 'name' ], @cont_key);
429 is_deeply($opt, $items, "same again but with keyattr as array");
435 $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
436 is_deeply($opt, $items, "same again");
447 $opt = XMLin( $xml, forcearray => 1, keeproot => 1,
451 is_deeply($opt, $target, 'keeproot option works');
457 $opt = XMLin($xml, @cont_key);
458 is_deeply($opt, {
463 $opt = XMLin($xml, @cont_key);
464 is_deeply($opt, {
472 $opt = eval{ XMLin($XMLFile); };
474 is_deeply($opt, {
482 $opt = eval { XMLin(); };
484 is_deeply($opt, {location => 't/10XMLin.xml'}, 'and contents parsed as expected');
489 $opt = eval {
496 is_deeply($opt, {
504 $opt = undef;
505 $opt = eval {
508 is($opt, undef, 'XMLin choked on nonexistant file');
515 $opt = undef;
516 $opt = eval { XMLin('bogusfile.xml'); };
517 is($opt, undef, 'nonexistant file not found in current directory');
524 $opt = undef;
525 $opt = eval {
528 is($opt, undef, 'search path ignored when pathname supplied');
539 $opt = XMLin($fh, @cont_key);
542 is($opt->{location}, 't/10XMLin.xml', 'and it parsed the right file');
551 $opt = XMLin('-');
554 is($opt->{location}, 't/10XMLin.xml', 'and data parsed correctly');
581 $opt = XMLin($xml, @cont_key);
582 is_deeply($opt, $expected, 'anonymous arrays parsed correctly');
586 $opt = XMLin($xml, keyattr => [], @cont_key);
587 is_deeply($opt, $expected, 'anonymous arrays parsed correctly');
592 $opt = XMLin(q{
599 is_deeply($opt, [
604 $opt = XMLin(q(
616 is_deeply($opt, [
632 $opt = XMLin($xml);
633 is_deeply($opt, {
643 $opt = XMLin($xml, contentkey => 'text_content');
644 is_deeply($opt, {
656 $opt = XMLin($xml, forcearray => 1);
657 is_deeply($opt, {
666 $opt = XMLin($xml, forcecontent => 1);
667 is_deeply($opt, {
675 $opt = XMLin($xml, forcecontent => 1, contentkey => '0');
676 is_deeply($opt, {
685 $opt = XMLin($xml, forcearray => [ 'x' ], keyattr => {x => 'y'});
686 is_deeply($opt, {
697 $opt = XMLin(
700 is_deeply($opt, {
734 $opt = XMLin($string);
735 is_deeply($opt, {
746 $opt = XMLin($string, forcearray => 1, @cont_key);
747 is_deeply($opt, {
754 $opt = XMLin($string, forcearray => 0, @cont_key);
755 is_deeply($opt, {
771 $opt = XMLin($xml, forcearray => [ 'two' ], @cont_key);
772 is_deeply($opt, {
791 $opt = XMLin($xml, forcearray => [ qr/^f/, 'two', qr/n/ ], @cont_key);
792 is_deeply($opt, {
804 $opt = XMLin($xml, forcearray => qr/^f|e$/, @cont_key);
805 is_deeply($opt, {
822 $opt = XMLin($xml, noattr => 1, @cont_key);
823 is_deeply($opt, { nest => 'text' }, 'attributes successfully skipped');
836 $opt = XMLin($xml, noattr => 1, @cont_key);
837 is_deeply($opt, {
856 $opt = XMLin($xml, noattr => 1, @cont_key);
857 is_deeply($opt, {
877 $opt = XMLin($xml);
878 is_deeply($opt, {
898 $opt = XMLin($xml, grouptags => {dirs => 'dir'} );
899 is_deeply($opt, {
922 $opt = XMLin($xml, grouptags => {dirs => 'dir', terms => 'term'} );
923 is_deeply($opt, {
943 $opt = XMLin($xml, keyattr => {dir => 'name'}, grouptags => {dirs => 'dir'} );
944 is_deeply($opt, {
965 $opt = XMLin($xml,
970 is_deeply($opt, {
990 $opt = XMLin($xml,
995 is_deeply($opt, {
1012 $opt = XMLin($xml,
1019 is_deeply($opt, {
1037 $opt = XMLin($xml, grouptags => {dirs => 'dir'} );
1038 is_deeply($opt, {
1073 $opt = XMLin($xml, KeyAttr => [ 'name' ], NormaliseSpace => 1);
1074 ok(ref($opt->{user}) eq 'HASH', "NS-1: folding OK");
1075 ok(exists($opt->{user}->{'Joe Bloggs'}), "NS-2: space normalised in hash key");
1076 ok(exists($opt->{user}->{'Jane Doe'}), "NS-3: space normalised in hash key");
1077 like($opt->{user}->{'Jane Doe'}->{id}, qr{^\s\s+three\s\s+four\s\s+$}s,
1080 $opt = XMLin($xml, KeyAttr => { user => 'name' }, NormaliseSpace => 1);
1081 ok(ref($opt->{user}) eq 'HASH', "NS-1a: folding OK");
1082 ok(exists($opt->{user}->{'Joe Bloggs'}), "NS-2a: space normalised in hash key");
1083 ok(exists($opt->{user}->{'Jane Doe'}), "NS-3a: space normalised in hash key");
1084 like($opt->{user}->{'Jane Doe'}->{id}, qr{^\s\s+three\s\s+four\s\s+$}s,
1087 $opt = XMLin($xml, KeyAttr => [ 'name' ], NormaliseSpace => 2);
1088 ok(ref($opt->{user}) eq 'HASH', "NS-5: folding OK");
1089 ok(exists($opt->{user}->{'Joe Bloggs'}), "NS-6: space normalised in hash key");
1090 like($opt->{user}->{'Joe Bloggs'}->{id}, qr{^one\stwo$}s,
1092 ok(exists($opt->{user}->{'Jane Doe'}), "NS-8: space normalised in hash key");
1093 like($opt->{user}->{'Jane Doe'}->{id}, qr{^three\sfour$}s,
1103 $opt = XMLin($xml, NormaliseSpace => 2);
1104 is_deeply($opt, [ 'one two', 'three four five', 'six', 'seveneightnine' ],
1109 $opt = XMLin($xml, NormalizeSpace => 2);
1110 is_deeply($opt, [ 'one two', 'three four five', 'six', 'seveneightnine' ],
1122 $opt = XMLin($xml);
1124 is_deeply($opt, {
1133 $opt = XMLin($xml, ValueAttr => [ 'value' ]);
1135 is_deeply($opt, {
1151 $opt = XMLin($xml, ValueAttr => [ qw(xxx yyy zzz) ]);
1153 is_deeply($opt, {
1169 $opt = XMLin($xml,
1177 is_deeply($opt, {
1193 $opt = XMLin($xml, ValueAttr => { 'today' => 'value' });
1195 is_deeply($opt, {
1206 $opt = XMLin(File::Spec->catfile('t', 'srt.xml'),
1292 is_deeply($opt, $target, 'successfully read an SRT config file');