Developer-Dashboard

 view release on metacpan or  search on metacpan

t/126-attribute-escaping.t  view on Meta::CPAN

    find(
        {
            no_chdir => 1,
            wanted   => sub {
                return if $File::Find::name !~ /\.pm\z/;
                open my $fh, '<', $File::Find::name
                  or die "Unable to read $File::Find::name: $!";
                my $line_number = 0;
                while ( my $line = <$fh> ) {
                    $line_number++;
                    next if $line !~ /(?:href|src|action|data-[a-z-]+)="\$[A-Za-z_][A-Za-z0-9_]*"/;
                    my $rel = File::Spec->abs2rel( $File::Find::name, $repo_root );
                    push @offenders, "$rel:$line_number";
                }
                close $fh or die "Unable to close $File::Find::name: $!";
            },
        },
        File::Spec->catdir( $repo_root, 'lib' ),
    );
    is_deeply( \@offenders, [], 'no lib/ module interpolates an unescaped variable into a quoted HTML attribute' )
      or diag( join "\n", @offenders );



( run in 0.826 second using v1.01-cache-2.11-cpan-14f38c9f855 )