Skip to content

Instantly share code, notes, and snippets.

@memowe
Created July 18, 2010 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memowe/480241 to your computer and use it in GitHub Desktop.
Save memowe/480241 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojolicious/Plugin/DefaultHelpers.pm b/lib/Mojolicious/Plugin/DefaultHelpers.pm
index 77717a8..e807bf5 100644
--- a/lib/Mojolicious/Plugin/DefaultHelpers.pm
+++ b/lib/Mojolicious/Plugin/DefaultHelpers.pm
@@ -7,6 +7,7 @@ use warnings;
use base 'Mojolicious::Plugin';
+use Mojo::ByteStream;
require Data::Dumper;
# You're watching Futurama,
@@ -48,6 +49,9 @@ sub register {
# Add "stash" helper
$app->renderer->add_helper(stash => sub { shift->stash(@_) });
+ # Add stream helper
+ $app->renderer->add_helper(stream => sub { Mojo::ByteStream->new($_[1]) });
+
# Add "url_for" helper
$app->renderer->add_helper(url_for => sub { shift->url_for(@_) });
}
@@ -112,6 +116,10 @@ Access session values.
Access stash values.
+=item stream
+
+Create a L<Mojo::ByteStream> object from a string
+
=item url_for
Generate URLs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment