Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

singingfish (7494)

singingfish
  (email not shown publicly)

Journal of singingfish (7494)

Friday June 01, 2007
06:36 AM

Catalyst Javascript Testbed

[ #33398 ]
Quick way to get a javascript testbed going:

$ catalyst.pl MyApp
$ cd MyApp

# put this in MyApp::Controller::Root

sub default : Path {
        my ( $self, $c, $arg ) = @_;

        unless ($arg =~ /boo|hoo|snoo/) {
                $c->res->status('404');
                $c->res->body('404 not found');
        }
        else {
                $c->config->{$arg}++;
                $c->res->header('Content-Type', 'text/plain');
                $c->res->body($c->config->{$arg});
        }
}

sub index : Private {
        my ($self, $c) = @_;
        $c->res->redirect($c->uri_for('/static/index.htm'));
}

# download your js libraries of choice (jquery here) to root/static/js (create dir as nescessary)
# And in /static/index.htm <-- NOTE the lack of 'l' at the end - there is a reason for this!

<html><head></head><body>
<script src="/static/js/jquery-1.1.2.pack.js"></script>
<script type="text/javascript">
    jq = jQuery.noConflict(); // your stuff here :-)
<script>
# your html here pre-written or inserted with js debugger
</body></html>

Woosh, off we go...
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.