[Catalyst] A couple (probably dumb) questions about TT
This might not be the best list to ask on, but I'm subscribed, and hopefully somebody will know the answers. =) First question, is it possible to deep-copy a structure using TT? I have a place where I'm taking a hashref from the stash, passing it as args to the src of an img tag, and then changing a couple variables in it before passing it to [% c.uri_for( /blah, new_args) %], but changing a couple elements of new_args changes the same elements in args, as designed. Any way around this other than creating new_args as a new hashref and copying the elements by name one by one? Second question about encoding and javascript. (Blah) One of the values in the above args hash is a title that may or may not include a ' character. It is displayed on the page fine, and passed to things like the img src above correctly, but its also being used in a call to a href=# onClick=javascript:window.open('[% c.uri_for( /blah, args ) %]'); (simplified, there's more to it than that, but that's where the problem lies) Unfortunatly, the ' character causes a problem here, because its not quoted in any way and javascript barfs. If I use [% args.title.replace( '\'', '%27' ) %], then the error goes away, but I get exactly that in the params of the new window, and I'd really like it unquoted when it hits Catalyst on the new window. Any suggestions for how to get around this? I'm sure its something obvious, but I'm not coming up with anything miraculous. Thanks, Dylan ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] A couple (probably dumb) questions about TT
* Dylan Vanderhoof [EMAIL PROTECTED] [2006-09-07 22:50]: If I use [% args.title.replace( '\'', '%27' ) %], then the error goes away, but I get exactly that in the params of the new window, and I'd really like it unquoted when it hits Catalyst on the new window. Any suggestions for how to get around this? args.title.replace( '\'', '\'\\\'' ) Untested. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] A couple (probably dumb) questions about TT
Not sure why I didn't think of that, but no dice I'm afraid. TT quoted the backslash, but not the tick. Ended up with this: Who%5C's You did kinda set me on the right path though, it sounds like what I really need is an unquoted backslash. Just not sure how to convince TT to do that. -Dylan -Original Message- From: A. Pagaltzis [mailto:[EMAIL PROTECTED] Sent: Thursday, September 07, 2006 3:04 PM To: The elegant MVC web framework Subject: Re: [Catalyst] A couple (probably dumb) questions about TT * Dylan Vanderhoof [EMAIL PROTECTED] [2006-09-07 22:50]: If I use [% args.title.replace( '\'', '%27' ) %], then the error goes away, but I get exactly that in the params of the new window, and I'd really like it unquoted when it hits Catalyst on the new window. Any suggestions for how to get around this? args.title.replace( '\'', '\'\\\'' ) Untested. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/