[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: variable_dump ($varname) => $var->dump
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: variable_dump ($varname) => $var->dump |
Date: |
Sun, 27 Jul 2003 23:24:55 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
I'm installing this. This turns variable_dump into a method. This
is required because dump is called from rdef(), and I want to move
rdef in a superclass (shared by variables and rules).
2003-07-27 Alexandre Duret-Lutz <address@hidden>
* lib/Automake/Variable.pm (@EXPORT): Remove variable_dump.
(variable_dump): Replace by ...
(dump): ... this method.
(rdef, _check_ambiguous_condition): Adjust to use ->dump.
(define, variables_dump): Adjust to use Automake::Variable::dump
Index: lib/Automake/Variable.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Variable.pm,v
retrieving revision 1.11
diff -u -r1.11 Variable.pm
--- lib/Automake/Variable.pm 10 Jul 2003 23:39:09 -0000 1.11
+++ lib/Automake/Variable.pm 27 Jul 2003 21:21:51 -0000
@@ -36,7 +36,7 @@
scan_variable_expansions check_variable_expansions
condition_ambiguous_p
variable_delete
- variable_dump variables_dump
+ variables_dump
set_seen
require_variables require_variables_for_variable
variable_value
@@ -461,7 +461,7 @@
my ($self, $cond) = @_;
my $d = $self->def ($cond);
prog_error ("undefined condition `" . $cond->human . "' for `"
- . $self->name . "'\n" . variable_dump ($self->name))
+ . $self->name . "'\n" . $self->dump)
unless $d;
return $d;
}
@@ -513,7 +513,7 @@
{
msg 'syntax', $where, "$message ...", partial => 1;
msg_var ('syntax', $var, "... `$var' previously defined here");
- verb (variable_dump ($var));
+ verb ($self->dump);
}
}
@@ -810,6 +810,34 @@
}
+=item C<$string = $var-E<gt>dump>
+
+=item C<$string = Automake::Variable::dump ($varname)>
+
+Return a string describing all we know about C<$var> (or C<$varname>).
+For debugging.
+
+=cut
+
+sub dump ($)
+{
+ my ($self) = @_;
+
+ my $v = ref $self ? $self : var $self;
+
+ return "$self does not exist\n"
+ unless $v;
+
+ my $text = $v->name . ": \n {\n";
+ foreach my $vcond ($v->conditions->conds)
+ {
+ $text .= " " . $vcond->human . " => " . $v->rdef ($vcond)->dump;
+ }
+ $text .= " }\n";
+ return $text;
+}
+
+
=back
=head2 Utility functions
@@ -1130,7 +1158,7 @@
"... overrides Automake variable `$var' defined here");
}
verb ("refusing to override the user definition of:\n"
- . variable_dump ($var)
+ . Automake::Variable::dump $var
."with `" . $cond->human . "' => `$value'");
}
else
@@ -1196,39 +1224,6 @@
}
}
-=item C<$str = variable_dump ($varname)>
-
-Return a string describing all we know about C<$varname>.
-For debugging.
-
-=cut
-
-# &variable_dump ($VAR)
-# ---------------------
-sub variable_dump ($)
-{
- my ($var) = @_;
- my $text = '';
-
- my $v = var $var;
-
- if (!$v)
- {
- $text = " $var does not exist\n";
- }
- else
- {
- $text .= "$var: \n {\n";
- foreach my $vcond ($v->conditions->conds)
- {
- $text .= " " . $vcond->human . " => " . $v->rdef ($vcond)->dump;
- }
- $text .= " }\n";
- }
- return $text;
-}
-
-
=item C<$str = variables_dump ($varname)>
Return a string describing all we know about all variables.
@@ -1241,9 +1236,9 @@
my ($var) = @_;
my $text = "All variables:\n{\n";
- foreach my $var (sort (variables()))
+ foreach my $var (sort variables)
{
- $text .= variable_dump ($var);
+ $text .= Automake::Variable::dump $var;
}
$text .= "}\n";
return $text;
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: variable_dump ($varname) => $var->dump,
Alexandre Duret-Lutz <=