Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear Monks,

I am having a minor problem with a "Bad name After" error. I am using Strawberry Perl 5.12.1 on Windows XP. here is some dummy cope:
01: #!c:\Perl\bin\perl 02: use warnings; 03: use strict; 04: use CGI ':standard'; ED: use constant CONSTANT1 => '../perlscript1.pl'; ED: use constant CONSTANT2 => '../perlscript2.pl'; 05: my $htmlPage = CGI->new; 06: 07: print "\n<p>ID/&#65418;&#65439;&#65405;&#65436;&#65392;&#65412;&#6 +5438;&#12434;&#24536;&#12428;&#12383;&#26041;&#12399;"; 08: print $htmlPage->a( { -href => CONSTANT2 09: , -target => '_self' }, '&#12371;&#12385;&#12425;' ); 10: print "</p>\n<p>"; 11: print $htmlPage->a( { -href => CONSTANT1 12: , -target => '_self' }, '&#21033;&#29992;&#35215;&#32004;' + ); 13: print "</p>";


On Line 12 I get an error saying "Bad name after _self'". I have read that perl used to allow pkg'$var and this is still supported so I have tried:
12: , -target => ''_self'' }, '&#21033;&#29992;&#35215;&#32004 +;' ); 12: , -target => "_self" }, '&#21033;&#29992;&#35215;&#32004;' + ); 12: , -target => "'_self'" }, '&#21033;&#29992;&#35215;&#32004 +;' );
These other alternatives provide variations of the error. I am pretty certain also that it is not the Japanese characters causing the problem either, as I have tested the same characters in other places.

Now I say this is not a major problem as the code builds and runs fine, but I am still getting this error message and would like to understand why.

Thank you in advance for any help you can give.

Kind regards,
KyussRyn
P.S. The hashed codes are japanese characters.

****EDIT****
I am using Eclipse with EPIC, and the pages are coded into UTF-8 through the interface. I tried out the use utf8; line, and that created a recursion error. I have also retyped the troubled lines, copied it from Line 10, and used the same word as well, but to no avail.

In reply to Bad name after xxxx' by KyussRyn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found