Re: [Catalyst] Catalyst - any good AJAX tutes?

2009-03-07 Thread David Dorward
kakim...@tpg.com.au wrote:
> hello, all :)
> 
>  thanks for the responses to help me out. I was wondering if there are
> any good tutes that can be recommended for a perl programmer to
> 
> 1) learn enough to set up the javascript itself ( be it in jQuery, dojo
> or anything you prefer)

The book JavaScript: The Good Parts  by Douglas Crockford is great for
learning the JavaScript language. Beginning JavaScript with DOM
Scripting and Ajax: From Novice to Professional by Christian Heilmann
covers a lot of non-core language things that you'll want if you are
going to use Ajax.

> 2) learn enough about how to intercept the ajax request in the
> controller

It is exactly the same as intercepting any other request. Here is a
short, non-Catalyst example:
http://github.com/dorward/simple-ajax-demo/blob/b86a9ce37f2ebed207b50cac0004ff849d544c58/webroot/demo.pl

> and send it back to the page ( ie JSON)?

There's virtually nothing to JSON - http://json.org/ - it is just a
simple data format. You can use any format you like - a simple string,
XML, whatever. JSON just happens to be simple, powerful, and easy to
parse in JavaScript.

> With AJAX,i  guess we hope to cut down on development time 

Reusing other people's code might help with this, but adding Ajax
functionality won't. It increases the amount of work as (assuming you do
things properly - with progressive enhancement) you have to create two
outputs for each activity you want to perform with Ajax.


-- 
David Dorward   

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst - any good AJAX tutes?

2009-03-07 Thread kakimoto

hello, Ashley, 

 Thanks for that! Yep, i will have a look at it soon. 

Basically, I am a web developer who hates JS and want to do minimal with
it. Whatever I could get away with coding in perl, i would do it cause i
know the language better and that it's more reliable. Js is dirty (or
well, the newer incarnations might be good but heck).

 Thanks again, Ash. You rock.

K. akimoto.


[ snip - start ]
Quoting Ashley :
> 
> 
> You ask, I deliver (sort of): The shortest Ajax+Catalyst tutorial in
> the world — http://sedition.com/a/2670
> 
> That is minimalistic but it does work and gives a jumping
> off place. Much easier to hack from a working piece than
> getting frustrated trying to make a thing work.
> 
> The only thing needed to set up jQuery is shown in the XHTML
> template in the examples. Here's a short version; Google hosts
> it and you just wrap it in the document ready function like so-
> 
> 
> 
> http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ 
> jquery.js"
>type="text/javascript">
> // jQuery(function($) {
>// your jQuery code goes here!
> });
> //]]> 
> 
> 
> Once you have this running, hit the docs. They'll make more sense
> after you follow through this simplistic example.
> 
> Have fun!
> -Ashley
> 
> 
> __

[ snip - end ]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Authentication Confusion

2009-03-07 Thread Ruan Kendall
So, I'm attempting to make use of
Catalyst::Authentication::Store::Htpasswd. I've added the following
stuff to my config file:


default_realm MyApp



class Password
password_type self_check


class Htpasswd
file passwd





as the CPAN page for the module suggested. Only when I run
script/MyApp_server.pl, it falls over with this error:

no file specified at
/usr/local/share/perl/5.8.4/Catalyst/Plugin/Authentication/Store/Htpasswd/Backend.pm
line 17
Compilation failed in require at script/MyApp_server.pl line 55.

Now, I didn't ask to use the Plugin version... as far as I can tell
the non-Plugin Htpasswd is siginifcantly newer. I can only imagine
that the older one was hanging around from my previous forays into
catalyst development. The MyApp.pm file contains this:

use Catalyst qw/-Debug
ConfigLoader
Static::Simple

Authentication
Authentication::Credential::Password
Authentication::Store::Htpasswd

Session Session::Store::FastMmap
Session::State::Cookie/;

So my question is, how can I stop it trying to load the older and
unwanted version of the module? I'm not particularly familiar with the
workings of CPAN, so my ham handed attempts to destroy the older
module caused far more errors.

Any advice?

Thanks in advance,

  - Ruan

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Authentication Confusion

2009-03-07 Thread Peter Karman
Ruan Kendall wrote on 3/7/09 6:19 AM:

> Authentication::Credential::Password
> Authentication::Store::Htpasswd

get rid of those.

The Auth plugin loads the right classes based on your config.


Peter Karman  .  http://peknet.com/  .  pe...@peknet.com

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Authentication Confusion

2009-03-07 Thread Ruan Kendall
Ahh, excellent. That sorted it out.

Cheers!

  - Ruan

On Sat, Mar 7, 2009 at 1:41 PM, Peter Karman  wrote:
> Ruan Kendall wrote on 3/7/09 6:19 AM:
>
>>                 Authentication::Credential::Password
>>                 Authentication::Store::Htpasswd
>
> get rid of those.
>
> The Auth plugin loads the right classes based on your config.
>
>
> Peter Karman  .  http://peknet.com/  .  pe...@peknet.com
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] OT: JS no longer sucks, (was Catalyst - any good AJAX tutes?)

2009-03-07 Thread Ashley

On Mar 7, 2009, at 12:55 AM, kakim...@tpg.com.au wrote:
Basically, I am a web developer who hates JS and want to do minimal  
with
it. Whatever I could get away with coding in perl, i would do it  
cause i

know the language better and that it's more reliable. Js is dirty (or
well, the newer incarnations might be good but heck).


I used to feel the same about JS. The language itself has improved  
(I'm discovering ActionScript 3 is pretty damn cool too) and the kits  
to wrap it in a cross-browser fashion are awesome. Even the ones I  
think are not so great (like prototype) are still, objectively, quite  
nice. And there are several that are great and just a matter of taste  
or need. These are what I consider the best: Dojo (newer versions),  
MooTools, YUI, ExtJs (I'm starting to not like it as much now that  
the honeymoon is over), jQuery. The last being my personal choice:  
write less, do more.


jQuery reminds me the most of Perl while actually looking nothing  
like it. It's terse and immensely powerful. It gets out of your way  
and for a CSS/XHTML dev, it's second nature.


The hide/show on the "tutorial" for example is done with two jQuery  
commands — it could be chained as one but it decreases readability —  
and gracefully degrading layout. This is the markup, two PREs, with  
classes of "command" and "result."


j...@jasper[71]~>whoami
jinx

This is the jQuery-
  // Find what comes after a .command and hide it.
  $(".command").next().hide();
  // Put a click toggler on the .command elements to slideDown
  // and slideUp.
  $(".command").toggle(
   function(){ $(this).next().slideDown() },
   function(){ $(this).next().slideUp() }
   );

And that's it! The markup is untouched if there's no JS enabled. So  
it's just command/result. If there is JS, you get the neat show/hide.  
Once you get the functional/callback style of code jQuery is  
completely easy to sling.



 Thanks again, Ash. You rock.


Catalyst and jQuery make it easy, as I hope the example shows. By the  
way, the site, sedition.com, is Catalyst powered and has been since  
Friday, 1 December 2006. I'm trying, *again*, to rewrite the app  
beneath in a general and robust way for CPAN release. :)




___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/