« blib/lib/Test/BDD/Cucumber/Model/Dataset.pm
↑ Summary
blib/lib/Test/BDD/Cucumber/Model/Scenario.pm »
| 1 | 22 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 22 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | package Test::BDD::Cucumber::Util 0.87; | ||
| 5 | |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Test::BDD::Cucumber::Util - Some functions used throughout the code | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | version 0.87 | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | Some functions used throughout the code | ||
| 18 | |||
| 19 | =head1 FUNCTIONS | ||
| 20 | |||
| 21 | =head2 bs_quote | ||
| 22 | |||
| 23 | =head2 bs_unquote | ||
| 24 | |||
| 25 | C<bs_quote()> "makes safe" strings with backslashed characters in it, so other | ||
| 26 | operations can be done on them. C<bs_unquote> goes the other way. | ||
| 27 | |||
| 28 | $string = "foo \<bar\> <baz>"; | ||
| 29 | $string = bs_quote( $string ); | ||
| 30 | $string =~ s/<([^>]+)>/"$1"/g; | ||
| 31 | $string = bs_unquote( $string ); | ||
| 32 | $string eq 'foo <bar> "baz"'; | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | 22 | my $marker_start = ';;;TEST_BDD_TEMP_MARKER_OPEN;;;'; | |
| 37 | 22 | my $marker_end = ';;;TEST_BDD_TEMP_MARKER_END;;;'; | |
| 38 | |||
| 39 | 829 | ▶ | sub bs_quote { |
|
Subroutine
bs_quote: called CC=1 SCAR=0.2
Pod
documented
| |||
| 40 | 829 | my $string = shift; | |
| 41 | 0 | $string =~ s/\\(.)/${marker_start} . ord($1) . ${marker_end}/ge; | |
| 42 | 829 | return $string; | |
| 43 | } | ||
| 44 | |||
| 45 | 829 | ▶ | sub bs_unquote { |
|
Subroutine
bs_unquote: called CC=1 SCAR=0.2
Pod
documented
| |||
| 46 | 829 | my $string = shift; | |
| 47 | 0 | $string =~ s/$marker_start(\d+)$marker_end/chr($1)/ge; | |
| 48 | 829 | return $string; | |
| 49 | } | ||
| 50 | |||
| 51 | =head1 AUTHOR | ||
| 52 | |||
| 53 | Peter Sergeant C<pete@clueball.com> | ||
| 54 | |||
| 55 | =head1 LICENSE | ||
| 56 | |||
| 57 | Copyright 2019-2023, Erik Huelsmann | ||
| 58 | Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | 22 | 1; | |