mark_raw_in_place?

22 views
Skip to first unread message

Robert Messer

unread,
Apr 16, 2014, 7:31:49 PM4/16/14
to xsl...@googlegroups.com
I've noticed that the mark_raw function makes a copy of the data you pass it.  Sometimes if you have a large bit of text, you don't want to make a copy of it, since you'll just wind up throwing away the original data anyway.

So we've found we can do this (in the application, not the mark_raw method available in templates, although I don't know if they are one and the same):

sub mark_raw_in_place { return bless \$_[0], 'Text::Xslate::Type::Raw' }

I don't see any problem with this, it seems to work fine.  Of course you've got to realize that if pass in a variable $x, and then later change it, you've changed the raw variable also, since it is just a blessed scalar ref.

But before we start using this more widely, I thought I'd ask... are there any potential problems with this approach?

Rob
Reply all
Reply to author
Forward
0 new messages