Skip to content

Commit

Permalink
Rename to_string to inspect
Browse files Browse the repository at this point in the history
And provide a stupid to_string implementation
  • Loading branch information
hoelzro committed Jun 12, 2012
1 parent bc157b1 commit 56d899b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Extension.pm
Expand Up @@ -21,7 +21,7 @@ sub filter {
return $resource->name =~ /$re/;
}

sub to_string {
sub inspect {
my ( $self ) = @_;

my $re = ${$self};
Expand Down
20 changes: 20 additions & 0 deletions Filter.pm
Expand Up @@ -102,9 +102,29 @@ sub is_inverted {
return 0;
}

=head2 $filter->to_string
Converts the filter to a string. This method is also
called implicitly by stringification.
=cut

sub to_string {
my ( $self ) = @_;

return "(unimplemented to_string)";
}

=head2 $filter->inspect
Prints a human-readable debugging string for this filter. Useful for,
you guessed it, debugging.
=cut

sub inspect {
my ( $self ) = @_;

return ref($self);
}

Expand Down
2 changes: 1 addition & 1 deletion FirstLineMatch.pm
Expand Up @@ -28,7 +28,7 @@ sub filter {
return /$re/;
}

sub to_string {
sub inspect {
my ( $self ) = @_;

my $re = ${$self};
Expand Down
2 changes: 1 addition & 1 deletion Inverse.pm
Expand Up @@ -27,7 +27,7 @@ sub is_inverted {
return 1;
}

sub to_string {
sub inspect {
my ( $self ) = @_;

my $filter = ${$self};
Expand Down
2 changes: 1 addition & 1 deletion Is.pm
Expand Up @@ -21,7 +21,7 @@ sub filter {
return $base eq $filename;
}

sub to_string {
sub inspect {
my ( $self ) = @_;

my $filename = ${$self};
Expand Down
2 changes: 1 addition & 1 deletion Match.pm
Expand Up @@ -24,7 +24,7 @@ sub filter {
return $base =~ /$re/;
}

sub to_string {
sub inspect {
my ( $self ) = @_;

my $re = ${$self};
Expand Down

0 comments on commit 56d899b

Please sign in to comment.