File Coverage

blib/lib/Perl/ToPerl6/Transformer.pm
Criterion Covered Total %
statement 117 191 61.2
branch 11 28 39.2
condition 1 3 33.3
subroutine 33 63 52.3
pod 24 25 96.0
total 186 310 60.0


line stmt bran cond sub pod time code
1             package Perl::ToPerl6::Transformer;
2              
3 1     1   15 use 5.006001;
  1         3  
4 1     1   5 use strict;
  1         3  
  1         17  
5 1     1   5 use warnings;
  1         2  
  1         24  
6              
7 1     1   3 use English qw< -no_match_vars >;
  1         2  
  1         9  
8 1     1   426 use Readonly;
  1         3  
  1         34  
9              
10 1     1   5 use File::Spec ();
  1         3  
  1         22  
11 1     1   767 use String::Format qw< stringf >;
  1         632  
  1         56  
12              
13 1     1   6 use overload ( q<""> => 'to_string', cmp => '_compare' );
  1         3  
  1         9  
14              
15 1         50 use Perl::ToPerl6::Utils qw<
16             :characters
17             :booleans
18             :severities
19             :data_conversion
20             interpolate
21             is_integer
22             transformer_long_name
23             transformer_short_name
24             necessity_to_number
25 1     1   85 >;
  1         3  
26 1     1   922 use Perl::ToPerl6::Utils::DataConversion qw< dor >;
  1         3  
  1         16  
27 1         85 use Perl::ToPerl6::Utils::POD qw<
28             get_module_abstract_for_module
29             get_raw_module_abstract_for_module
30 1     1   628 >;
  1         3  
31 1     1   7 use Perl::ToPerl6::Exception::AggregateConfiguration;
  1         2  
  1         37  
32 1     1   6 use Perl::ToPerl6::Exception::Configuration;
  1         2  
  1         33  
33 1     1   5 use Perl::ToPerl6::Exception::Configuration::Option::Transformer::ExtraParameter;
  1         2  
  1         39  
34 1     1   4 use Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue;
  1         3  
  1         39  
35             use Perl::ToPerl6::Exception::Fatal::TransformerDefinition
36 1     1   5 qw< throw_transformer_definition >;
  1         2  
  1         41  
37 1     1   5 use Perl::ToPerl6::TransformerConfig qw<>;
  1         2  
  1         14  
38 1     1   542 use Perl::ToPerl6::TransformerParameter qw<>;
  1         2  
  1         22  
39 1     1   537 use Perl::ToPerl6::Transformation qw<>;
  1         3  
  1         20  
40              
41 1     1   102 use Exception::Class; # this must come after "use P::C::Exception::*"
  1         3  
  1         9  
42              
43             #-----------------------------------------------------------------------------
44              
45             Readonly::Scalar my $NO_LIMIT => 'no_limit';
46              
47             #-----------------------------------------------------------------------------
48              
49             my $format = "%p\n"; #Default stringy format
50              
51             #-----------------------------------------------------------------------------
52              
53             sub new {
54 44     44 1 57034 my ($class, %config) = @_;
55              
56 44         92 my $self = bless {}, $class;
57              
58 44         51 my $config_object;
59 44 50       98 if ($config{_config_object}) {
60 0         0 $config_object = $config{_config_object};
61             }
62             else {
63 44         171 $config_object =
64             Perl::ToPerl6::TransformerConfig->new(
65             $self->get_short_name(),
66             \%config,
67             );
68             }
69              
70 44         192 $self->__set_config( $config_object );
71              
72 44         46 my @parameters;
73 44         46 my $parameter_metadata_available = 0;
74              
75 44 100       589 if ( $class->can('supported_parameters') ) {
76 43         50 $parameter_metadata_available = 1;
77             @parameters =
78             map
79 43         213 { Perl::ToPerl6::TransformerParameter->new($_) }
  1         10  
80             $class->supported_parameters();
81             }
82 44         87 $self->{_parameter_metadata_available} = $parameter_metadata_available;
83 44         78 $self->{_parameters} = \@parameters;
84              
85 44         157 my $errors = Perl::ToPerl6::Exception::AggregateConfiguration->new();
86 44         20467 foreach my $parameter ( @parameters ) {
87             eval {
88 1         6 $parameter->parse_and_validate_config_value( $self, $config_object );
89             }
90 1 50       3 or do {
91 1         9 $errors->add_exception_or_rethrow($EVAL_ERROR);
92             };
93              
94 1         4 $config_object->remove( $parameter->get_name() );
95             }
96              
97 44 100       96 if ($parameter_metadata_available) {
98 43         124 $config_object->handle_extra_parameters( $self, $errors );
99             }
100              
101 44 50       118 if ( $errors->has_exceptions() ) {
102 0         0 $errors->rethrow();
103             }
104              
105 44         1044 return $self;
106             }
107              
108             #-----------------------------------------------------------------------------
109              
110             sub initialize_if_enabled {
111 37     37 1 98 return $TRUE;
112             }
113              
114             #-----------------------------------------------------------------------------
115              
116             sub prepare_to_scan_document {
117 0     0 1 0 return $TRUE;
118             }
119              
120             #-----------------------------------------------------------------------------
121              
122             sub __get_parameter_name {
123 1     1   2 my ( $self, $parameter ) = @_;
124              
125 1         4 return '_' . $parameter->get_name();
126             }
127              
128             #-----------------------------------------------------------------------------
129              
130             sub __set_parameter_value {
131 1     1   3 my ( $self, $parameter, $value ) = @_;
132              
133 1         6 $self->{ $self->__get_parameter_name($parameter) } = $value;
134              
135 1         3 return;
136             }
137              
138             #-----------------------------------------------------------------------------
139              
140             sub __set_base_parameters {
141 37     37   47 my ($self) = @_;
142              
143 37         140 my $config = $self->__get_config();
144 37         109 my $errors = Perl::ToPerl6::Exception::AggregateConfiguration->new();
145              
146 37         18272 my $user_necessity = $config->get_necessity();
147 37 50       79 if ( defined $user_necessity ) {
148 0         0 my $normalized_necessity = necessity_to_number( $user_necessity );
149 0         0 $self->set_necessity( $normalized_necessity );
150             }
151              
152 37         87 my $user_set_themes = $config->get_set_themes();
153 37 50       77 if ( defined $user_set_themes ) {
154 0         0 my @set_themes = words_from_string( $user_set_themes );
155 0         0 $self->set_themes( @set_themes );
156             }
157              
158 37         77 my $user_add_themes = $config->get_add_themes();
159 37 50       67 if ( defined $user_add_themes ) {
160 0         0 my @add_themes = words_from_string( $user_add_themes );
161 0         0 $self->add_themes( @add_themes );
162             }
163              
164 37 50       89 if ( $errors->has_exceptions() ) {
165 0         0 $errors->rethrow();
166             }
167              
168 37         946 return;
169             }
170              
171             #-----------------------------------------------------------------------------
172              
173             # Unparsed configuration, P::C::TransformerConfig. Compare with get_parameters().
174             sub __get_config {
175 74     74   91 my ($self) = @_;
176              
177 74         191 return $self->{_config};
178             }
179              
180             sub __set_config {
181 81     81   99 my ($self, $config) = @_;
182              
183 81         2045 $self->{_config} = $config;
184              
185 81         180 return;
186             }
187              
188             #-----------------------------------------------------------------------------
189              
190             sub get_long_name {
191 0     0 1 0 my ($self) = @_;
192              
193 0         0 return transformer_long_name(ref $self);
194             }
195              
196             #-----------------------------------------------------------------------------
197              
198             sub get_short_name {
199 340     340 1 414 my ($self) = @_;
200              
201 340         885 return transformer_short_name(ref $self);
202             }
203              
204             #-----------------------------------------------------------------------------
205              
206             sub is_enabled {
207 0     0 1 0 my ($self) = @_;
208              
209 0         0 return $self->{_enabled};
210             }
211              
212             #-----------------------------------------------------------------------------
213              
214             sub __set_enabled {
215 37     37   54 my ($self, $new_value) = @_;
216              
217 37         57 $self->{_enabled} = $new_value;
218              
219 37         71 return;
220             }
221              
222             #-----------------------------------------------------------------------------
223              
224             sub applies_to {
225 0     0 1 0 return qw(PPI::Element);
226             }
227              
228             #-----------------------------------------------------------------------------
229              
230             sub set_necessity {
231 0     0 1 0 my ($self, $necessity) = @_;
232 0         0 $self->{_necessity} = $necessity;
233 0         0 return $self;
234             }
235              
236             #-----------------------------------------------------------------------------
237              
238             sub get_necessity {
239 37     37 1 46 my ($self) = @_;
240 37   33     209 return $self->{_necessity} || $self->default_necessity();
241             }
242              
243             #-----------------------------------------------------------------------------
244              
245             sub default_necessity {
246 0     0 1 0 return $NECESSITY_LOWEST;
247             }
248              
249             #-----------------------------------------------------------------------------
250              
251             sub set_themes {
252 0     0 1 0 my ($self, @themes) = @_;
253 0         0 $self->{_themes} = [ sort @themes ];
254 0         0 return $self;
255             }
256              
257             #-----------------------------------------------------------------------------
258              
259             sub get_themes {
260 0     0 1 0 my ($self) = @_;
261 0 0       0 my @themes = defined $self->{_themes} ? @{ $self->{_themes} } : $self->default_themes();
  0         0  
262 0         0 my @sorted_themes = sort @themes;
263 0         0 return @sorted_themes;
264             }
265              
266             #-----------------------------------------------------------------------------
267              
268             sub add_themes {
269 0     0 1 0 my ($self, @additional_themes) = @_;
270             #By hashifying the themes, we squish duplicates
271 0         0 my %merged = hashify( $self->get_themes(), @additional_themes);
272 0         0 $self->{_themes} = [ keys %merged];
273 0         0 return $self;
274             }
275              
276             #-----------------------------------------------------------------------------
277              
278             sub default_themes {
279 0     0 1 0 return ();
280             }
281              
282             #-----------------------------------------------------------------------------
283              
284             sub get_abstract {
285 0     0 1 0 my ($self) = @_;
286              
287 0         0 return get_module_abstract_for_module( ref $self );
288             }
289              
290             #-----------------------------------------------------------------------------
291              
292             sub get_raw_abstract {
293 0     0 1 0 my ($self) = @_;
294              
295 0         0 return get_raw_module_abstract_for_module( ref $self );
296             }
297              
298             #-----------------------------------------------------------------------------
299              
300             sub parameter_metadata_available {
301 0     0 1 0 my ($self) = @_;
302              
303 0         0 return $self->{_parameter_metadata_available};
304             }
305              
306             #-----------------------------------------------------------------------------
307              
308             sub get_parameters {
309 0     0 1 0 my ($self) = @_;
310              
311 0         0 return $self->{_parameters};
312             }
313              
314             #-----------------------------------------------------------------------------
315              
316             sub transform {
317 0     0 0 0 my ($self) = @_;
318              
319 0         0 return throw_transformer_definition(
320             $self->get_short_name() . q/ does not implement transform()./ );
321             }
322              
323             #-----------------------------------------------------------------------------
324              
325             sub transformation {
326 0     0 1 0 my ( $self, $desc, $expl, $elem ) = @_;
327             # HACK!! Use goto instead of an explicit call because P::C::V::new() uses caller()
328 0         0 my $sev = $self->get_necessity();
329 0         0 @_ = ('Perl::ToPerl6::Transformation', $desc, $expl, $elem, $sev );
330 0         0 goto &Perl::ToPerl6::Transformation::new;
331             }
332              
333             #-----------------------------------------------------------------------------
334              
335             sub new_parameter_value_exception {
336 0     0 1 0 my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_;
337              
338 0         0 return Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue->new(
339             transformer => $self->get_short_name(),
340             option_name => $option_name,
341             option_value => $option_value,
342             source => $source,
343             message_suffix => $message_suffix
344             );
345             }
346              
347             #-----------------------------------------------------------------------------
348              
349             sub throw_parameter_value_exception {
350 0     0 1 0 my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_;
351              
352 0         0 $self->new_parameter_value_exception(
353             $option_name, $option_value, $source, $message_suffix
354             )
355             ->throw();
356             }
357             ## use mogrify
358              
359              
360             #-----------------------------------------------------------------------------
361              
362             # Static methods.
363              
364 0     0 1 0 sub set_format { return $format = $_[0] }
365 296     296 1 1122 sub get_format { return $format }
366              
367             #-----------------------------------------------------------------------------
368              
369             sub to_string {
370 296     296 1 3599 my ($self, @args) = @_;
371              
372             # Wrap the more expensive ones in sub{} to postpone evaluation
373             my %fspec = (
374 0     0   0 'P' => sub { $self->get_long_name() },
375 296     296   8325 'p' => sub { $self->get_short_name() },
376 0     0   0 'a' => sub { dor($self->get_abstract(), $EMPTY) },
377 0     0   0 'O' => sub { $self->_format_parameters(@_) },
378 0     0   0 'U' => sub { $self->_format_lack_of_parameter_metadata(@_) },
379 0     0   0 'S' => sub { $self->default_necessity() },
380 0     0   0 's' => sub { $self->get_necessity() },
381 0     0   0 'T' => sub { join $SPACE, $self->default_themes() },
382 0     0   0 't' => sub { join $SPACE, $self->get_themes() },
383 296         3243 );
384 296         666 return stringf(get_format(), %fspec);
385             }
386              
387             sub _format_parameters {
388 0     0     my ($self, $parameter_format) = @_;
389              
390 0 0         return $EMPTY if not $self->parameter_metadata_available();
391              
392 0           my $separator;
393 0 0         if ($parameter_format) {
394 0           $separator = $EMPTY;
395             } else {
396 0           $separator = $SPACE;
397 0           $parameter_format = '%n';
398             }
399              
400             return
401             join
402             $separator,
403 0           map { $_->to_formatted_string($parameter_format) } @{ $self->get_parameters() };
  0            
  0            
404             }
405              
406             sub _format_lack_of_parameter_metadata {
407 0     0     my ($self, $message) = @_;
408              
409 0 0         return $EMPTY if $self->parameter_metadata_available();
410 0 0         return interpolate($message) if $message;
411              
412             return
413 0           'Cannot programmatically discover what parameters this transformer takes.';
414             }
415              
416             #-----------------------------------------------------------------------------
417             # Apparently, some perls do not implicitly stringify overloading
418             # objects before doing a comparison. This causes a couple of our
419             # sorting tests to fail. To work around this, we overload C<cmp> to
420             # do it explicitly.
421             #
422             # 20060503 - More information: This problem has been traced to
423             # Test::Simple versions <= 0.60, not perl itself. Upgrading to
424             # Test::Simple v0.62 will fix the problem. But rather than forcing
425             # everyone to upgrade, I have decided to leave this workaround in
426             # place.
427              
428 0     0     sub _compare { return "$_[0]" cmp "$_[1]" }
429              
430             1;
431              
432             __END__
433              
434             #-----------------------------------------------------------------------------
435              
436             =pod
437              
438             =head1 NAME
439              
440             Perl::ToPerl6::Transformer - Base class for all Transformer modules.
441              
442              
443             =head1 DESCRIPTION
444              
445             Perl::ToPerl6::Transformer is the abstract base class for all Transformer
446             objects. If you're developing your own Transformers, your job is to
447             implement and override its methods in a subclass. To work with the
448             L<Perl::ToPerl6|Perl::ToPerl6> engine, your implementation must behave
449             as described below. For a detailed explanation on how to make new
450             Transformer modules, please see the
451             L<Perl::ToPerl6::DEVELOPER|Perl::ToPerl6::DEVELOPER> document included
452             in this distribution.
453              
454              
455             =head1 INTERFACE SUPPORT
456              
457             This is considered to be a public class. Any changes to its interface
458             will go through a deprecation cycle.
459              
460              
461             =head1 METHODS
462              
463             =over
464              
465             =item C<< new( ... ) >>
466              
467             Don't call this. As a Transformer author, do not implement this. Use the
468             C<initialize_if_enabled()> method for your Transformer setup. See the
469             L<developer|Perl::ToPerl6::DEVELOPER> documentation for more.
470              
471              
472             =item C<< initialize_if_enabled( $config ) >>
473              
474             This receives an instance of
475             L<Perl::ToPerl6::TransformerConfig|Perl::ToPerl6::TransformerConfig> as a
476             parameter, and is only invoked if this Transformer is enabled by the user.
477             Thus, this is the preferred place for subclasses to do any
478             initialization.
479              
480             Implementations of this method should return a boolean value
481             indicating whether the Transformer should continue to be enabled. For most
482             subclasses, this will always be C<$TRUE>. Transformers that depend upon
483             external modules or other system facilities that may or may not be
484             available should test for the availability of these dependencies and
485             return C<$FALSE> if they are not.
486              
487              
488             =item C<< prepare_to_scan_document( $document ) >>
489              
490             The parameter is about to be scanned by this Transformer. Whatever this
491             Transformer wants to do in terms of preparation should happen here.
492             Returns a boolean value indicating whether the document should be
493             scanned at all; if this is a false value, this Transformer won't be applied
494             to the document. By default, does nothing but return C<$TRUE>.
495              
496              
497             =item C< violates( $element, $document ) >
498              
499             Given a L<PPI::Element|PPI::Element> and a
500             L<PPI::Document|PPI::Document>, returns one or more
501             L<Perl::ToPerl6::Transformation|Perl::ToPerl6::Transformation> objects if the
502             C<$element> violates this Transformer. If there are no transformations, then it
503             returns an empty list. If the Transformer encounters an exception, then it
504             should C<croak> with an error message and let the caller decide how to
505             handle it.
506              
507             C<transform()> is an abstract method and it will abort if you attempt
508             to invoke it directly. It is the heart of all Transformer modules, and
509             your subclass B<must> override this method.
510              
511              
512             =item C< transformation( $description, $explanation, $element ) >
513              
514             Returns a reference to a new C<Perl::ToPerl6::Transformation> object. The
515             arguments are a description of the transformation (as string), an
516             explanation for the transformer (as string) or a series of page numbers in
517             PBP (as an ARRAY ref), a reference to the L<PPI|PPI> element that
518             caused the transformation.
519              
520             These are the same as the constructor to
521             L<Perl::ToPerl6::Transformation|Perl::ToPerl6::Transformation>, but without the
522             necessity. The Transformer itself knows the necessity.
523              
524              
525             =item C< new_parameter_value_exception( $option_name, $option_value, $source, $message_suffix ) >
526              
527             Create a
528             L<Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue|Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue>
529             for this Transformer.
530              
531              
532             =item C< throw_parameter_value_exception( $option_name, $option_value, $source, $message_suffix ) >
533              
534             Create and throw a
535             L<Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue|Perl::ToPerl6::Exception::Configuration::Option::Transformer::ParameterValue>.
536             Useful in parameter parser implementations.
537              
538              
539             =item C< get_long_name() >
540              
541             Return the full package name of this transformer.
542              
543              
544             =item C< get_short_name() >
545              
546             Return the name of this transformer without the "Perl::ToPerl6::Transformer::"
547             prefix.
548              
549              
550             =item C< is_enabled() >
551              
552             Answer whether this transformer is really active or not. Returns a true
553             value if it is, a false, yet defined, value if it isn't, and an
554             undefined value if it hasn't yet been decided whether it will be.
555              
556              
557             =item C< applies_to() >
558              
559             Returns a list of the names of PPI classes that this Transformer cares
560             about. By default, the result is C<PPI::Element>. Overriding this
561             method in Transformer subclasses should lead to significant performance
562             increases.
563              
564              
565             =item C< default_necessity() >
566              
567             Returns the default necessity for violating this Transformer. See the
568             C<$NECESSITY> constants in L<Perl::ToPerl6::Utils|Perl::ToPerl6::Utils>
569             for an enumeration of possible necessity values. By default, this
570             method returns C<$NECESSITY_LOWEST>. Authors of Perl::ToPerl6::Transformer
571             subclasses should override this method to return a value that they
572             feel is appropriate for their Transformer. In general, Polices that are
573             widely accepted or tend to prevent bugs should have a higher necessity
574             than those that are more subjective or cosmetic in nature.
575              
576              
577             =item C< get_necessity() >
578              
579             Returns the necessity of violating this Transformer. If the necessity has
580             not been explicitly defined by calling C<set_necessity>, then the
581             C<default_necessity> is returned. See the C<$NECESSITY> constants in
582             L<Perl::ToPerl6::Utils|Perl::ToPerl6::Utils> for an enumeration of
583             possible necessity values.
584              
585              
586             =item C< set_necessity( $N ) >
587              
588             Sets the necessity for violating this Transformer. Clients of
589             Perl::ToPerl6::Transformer objects can call this method to assign a
590             different necessity to the Transformer if they don't agree with the
591             C<default_necessity>. See the C<$NECESSITY> constants in
592             L<Perl::ToPerl6::Utils|Perl::ToPerl6::Utils> for an enumeration of
593             possible values.
594              
595              
596             =item C< default_themes() >
597              
598             Returns a sorted list of the default themes associated with this
599             Transformer. The default method returns an empty list. Transformer authors
600             should override this method to return a list of themes that are
601             appropriate for their transformer.
602              
603              
604             =item C< get_themes() >
605              
606             Returns a sorted list of the themes associated with this Transformer. If
607             you haven't added themes or set the themes explicitly, this method
608             just returns the default themes.
609              
610              
611             =item C< set_themes( @THEME_LIST ) >
612              
613             Sets the themes associated with this Transformer. Any existing themes are
614             overwritten. Duplicate themes will be removed.
615              
616              
617             =item C< add_themes( @THEME_LIST ) >
618              
619             Appends additional themes to this Transformer. Any existing themes are
620             preserved. Duplicate themes will be removed.
621              
622              
623             =item C< get_abstract() >
624              
625             Retrieve the abstract for this transformer (the part of the NAME section of
626             the POD after the module name), if it is available.
627              
628              
629             =item C< get_raw_abstract() >
630              
631             Retrieve the abstract for this transformer (the part of the NAME section of
632             the POD after the module name), if it is available, in the unparsed
633             form.
634              
635              
636             =item C< parameter_metadata_available() >
637              
638             Returns whether information about the parameters is available.
639              
640              
641             =item C< get_parameters() >
642              
643             Returns a reference to an array containing instances of
644             L<Perl::ToPerl6::TransformerParameter|Perl::ToPerl6::TransformerParameter>.
645              
646             Note that this will return an empty list if the parameters for this
647             transformer are unknown. In order to differentiate between this
648             circumstance and the one where this transformer does not take any
649             parameters, it is necessary to call C<parameter_metadata_available()>.
650              
651              
652             =item C<set_format( $format )>
653              
654             Class method. Sets the format for all Transformer objects when they are
655             evaluated in string context. The default is C<"%p\n">. See
656             L<"OVERLOADS"> for formatting options.
657              
658              
659             =item C<get_format()>
660              
661             Class method. Returns the current format for all Transformer objects when
662             they are evaluated in string context.
663              
664              
665             =item C<to_string()>
666              
667             Returns a string representation of the transformer. The content of the
668             string depends on the current value returned by C<get_format()>.
669             See L<"OVERLOADS"> for the details.
670              
671              
672             =back
673              
674              
675             =head1 DOCUMENTATION
676              
677             When your Transformer module first C<use>s
678             L<Perl::ToPerl6::Transformation|Perl::ToPerl6::Transformation>, it will try and
679             extract the DESCRIPTION section of your Transformer module's POD. This
680             information is displayed by Perl::ToPerl6 if the verbosity level is set
681             accordingly. Therefore, please include a DESCRIPTION section in the
682             POD for any Transformer modules that you author. Thanks.
683              
684              
685             =head1 OVERLOADS
686              
687             Perl::ToPerl6::Transformation overloads the C<""> operator to produce neat
688             little messages when evaluated in string context.
689              
690             Formats are a combination of literal and escape characters similar to
691             the way C<sprintf> works. If you want to know the specific formatting
692             capabilities, look at L<String::Format|String::Format>. Valid escape
693             characters are:
694              
695              
696             =over
697              
698             =item C<%P>
699              
700             Name of the Transformer module.
701              
702              
703             =item C<%p>
704              
705             Name of the Transformer without the C<Perl::ToPerl6::Transformer::> prefix.
706              
707              
708             =item C<%a>
709              
710             The transformer abstract.
711              
712              
713             =item C<%O>
714              
715             List of supported transformer parameters. Takes an option of a format
716             string for L<Perl::ToPerl6::TransformerParameter/"to_formatted_string">.
717             For example, this can be used like C<%{%n - %d\n}O> to get a list of
718             parameter names followed by their descriptions.
719              
720              
721             =item C<%U>
722              
723             A message stating that the parameters for the transformer are unknown if
724             C<parameter_metadata_available()> returns false. Takes an option of
725             what the message should be, which defaults to "Cannot programmatically
726             discover what parameters this transformer takes.". The value of this
727             option is interpolated in order to expand the standard escape
728             sequences (C<\n>, C<\t>, etc.).
729              
730              
731             =item C<%S>
732              
733             The default necessity level of the transformer.
734              
735              
736             =item C<%s>
737              
738             The current necessity level of the transformer.
739              
740              
741             =item C<%T>
742              
743             The default themes for the transformer.
744              
745              
746             =item C<%t>
747              
748             The current themes for the transformer.
749              
750              
751             =back
752              
753              
754             =head1 AUTHOR
755              
756             Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
757              
758              
759             =head1 COPYRIGHT
760              
761             Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
762              
763             This program is free software; you can redistribute it and/or modify
764             it under the same terms as Perl itself. The full text of this license
765             can be found in the LICENSE file included with this module.
766              
767             =cut
768              
769             # Local Variables:
770             # mode: cperl
771             # cperl-indent-level: 4
772             # fill-column: 78
773             # indent-tabs-mode: nil
774             # c-indentation-style: bsd
775             # End:
776             # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :