开发者

Perl <<EOP is generating an indent before the reCapctha box. How do I get rid of it?

I have the following code in my reCapctha.pm file and it is resulting in an indent of the capctha box to the left. I have double checked by html files more than 10 time and there is no reason for the indent there. So I am assuming following code is responsible specially the <<EOP part.

I am not very good with perl can some one please help me get rid of this indent/space? It really looks unprofessional for a landing page the way it is. Thanks in advance for your help.

sub get_html
{
my ($self,$pubkey) = @_;
my $html = <<EOP
<script type="text/javascript">
var RecaptchaOptions = {theme: 'red'};
<开发者_JAVA技巧/script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=$pubkey"> </script>
EOP
;
}


If you have something like

my $foo = <<'__EOI__';
   foo
   bar
__EOI__

You can remove the leading spaces using

$foo =~ s/^\s+//mg;

You could even combine the stripping and the assignment.

( my $foo = <<'__EOI__' ) =~ s/^\s+//mg;
   foo
   bar
__EOI__
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜