1. shlomif_rsip
  2. perl-Config-IniFiles

Commits

shlomif_rsip  committed 6b2c27b

Extract the _calc_eot_mark method.

  • Participants
  • Parent commits 712d4b8
  • Branches default

Comments (0)

Files changed (1)

File config-inifiles/lib/Config/IniFiles.pm

View file
 
 =cut
 
+sub _calc_eot_mark
+{
+    my ($self, $sect, $parm, $val) = @_;
+
+    my $eotmark = $self->{EOT}{$sect}{$parm} || 'EOT';
+
+    # Make sure the $eotmark does not occur inside the string.
+    my @letters = ('A' .. 'Z');
+    my $joined_val = join(q{ }, @$val);
+    while (index($joined_val, $eotmark) >= 0)
+    {
+        $eotmark .= $letters[rand(@letters)];
+    }
+
+    return $eotmark;
+}
+
 sub _OutputParam {
     my ($self, $sect, $parm, $val, $end_comment, $output_cb) = @_;
 
     }
     else
     {
-        my $eotmark = $self->{EOT}{$sect}{$parm} || 'EOT';
-
-        # Make sure the $eotmark does not occur inside the string.
-        my @letters = ('A' .. 'Z');
-        my $joined_val = join(q{ }, @$val);
-        while (index($joined_val, $eotmark) >= 0)
-        {
-            $eotmark .= $letters[rand(@letters)];
-        }
+        my $eotmark = $self->_calc_eot_mark($sect, $parm, $val);
 
         $output_cb->("$parm= <<$eotmark");
         $line_loop->(sub { my ($line) = @_; return $line; });