xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm continuing to Catalyst program, I found server.pl built-in in catalyst module can not parse jqGrid correctly.

Below is error messages:

Error: syntax error Source File: http://localhost:3000/site/static/js/i18n/grid.locale-en. +js Line: 2 Source Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w +3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Error: syntax error Source File: http://localhost:3000/site/static/js/jquery.jqGrid.min.js Line: 2 Source Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w +3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
But it could parse jquery and jquery-UI perfectly. and There is no any problem if I save it as html page(don't parse by Catalyst server.pl,just open it by Firefox)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w +3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>My First Grid</title> <link rel="stylesheet" type="text/css" media="screen" href="static/css +/ui-lightness/jquery-ui-1.8.1.custom.css" /> <link rel="stylesheet" type="text/html" media="screen" href="static/cs +s/ui.jqgrid.css" /> <style> html, body { margin: 0; padding: 0; font-size: 75%; } </style> <script src="static/js/jquery-1.4.2.min.js" type="text/javascript"></s +cript> <script src="static/js/i18n/grid.locale-en.js" ></script> <script src="static/js/jquery.jqGrid.min.js" type="text/javascript"></ +script> ....... .........
Any help are appreciated! Thanks.

UPDATE Sorry for my stupid fault. waste monks' time.





I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: syntax error! jqGrid problem parsed by Catalyst server.pl
by Your Mother (Archbishop) on Jun 26, 2010 at 04:46 UTC

    That is unusual—static files aren't parsed, they're just "shipped"—and the errors don't make sense—they don't seem to be Catalyst specific errors but generic perl errors. You also apparently posted this question twice :(

    Examine the contents of root/static/js/jquery.jqGrid.min.js to ensure it's just JS as a start and then maybe set Catalyst::Plugin::Static::Simple to use debug and give the actual output of the *_server.pl when visiting /static/js/jquery.jqGrid.min.js while running under debug.

      I'm shameful for my stupid fault. I set a default sub in controller, and it lead to server ship default page when it can't find jqGrid.min.js. How delete my post?! ;)




      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

        It's not shameful. It's the road we're on. I once spent, seriously, almost two hours trying to debug an “impossible” bug caused by fat-fingering ) with } in a place perl couldn't accurately tell me what was going on. The problem was obvious but I was sure it was something else so I kept debugging and swapping lines and messing around with print statements and applying the keyboard to my forehead… We’ve all got at least one of those.