Changeset 1549 in ProjectBuilder for devel/pb/lib
- Timestamp:
- May 21, 2012, 2:17:30 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/Filter.pm
r1434 r1549 119 119 while(<CONF>) { 120 120 if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) { 121 pb_log(3,"DEBUG creating entry $1, key $2, value $3\n"); 122 $h{$1}{$2}=$3; 121 my ($what, $var, $value) = ($1, $2, $3); 122 pb_log(3,"DEBUG creating entry $what, key $var, value $value\n"); 123 # Add support for multi-lines 124 while ($value =~ s/\\\s*$//o) { 125 $_ = <CONF>; 126 die "Still processing continuations for $what $var at EOF" if (not defined $_); 127 s/[\r\n]//go; 128 $value .= "\n$_"; 129 } 130 $h{$what}{$var}=$value; 131 } elsif ((/^\s*#/o) || (/^\s*$/o)) { 132 # ignore 133 } else { 134 chomp(); 135 warn "unexpected line '$_' in $f"; 123 136 } 124 137 } … … 126 139 } 127 140 $ptr = $h{"filter"}; 141 142 # TODO: find a place to document it. Why not in this file as pod and also documenting filters ? 143 # Handle transform 144 if (defined $h{transform}) { 145 while (my ($out_key,$spec) = each %{$h{transform}}) { 146 die "Unknown transform for $out_key '$spec' expected <out-key> <transform>" unless $spec =~ /^([\w\-]+)\s+(.+)$/; 147 my ($in_key, $expr) = ($1, $2); 148 local $_ = $ptr->{$in_key} || ''; 149 eval $expr; 150 die "Error evaluating tranform for $out_key ($expr): $@" if $@; 151 $ptr->{$out_key} = $_; 152 pb_log(2, "Transform $in_key to $out_key\n$ptr->{$in_key}\n$ptr->{$out_key}\n"); 153 } 154 } 128 155 } 129 156 pb_log(2,"DEBUG f:".Dumper($ptr)."\n") if (defined $ptr);
Note:
See TracChangeset
for help on using the changeset viewer.