Questions tagged [mason]

HTML::Mason, or Mason for short, is a Perl-based templating system for generating dynamic HTML or other content.

HTML::Mason or it's successor Mason 2 (simply called Mason), is a Perl-based templating system for generating HTML or other content.

Its features make it a suitable backend for high load sites serving dynamic content, such as online newspapers or database driven e-commerce sites.

Official home page: http://www.masonhq.com/

Mason book: https://masonbook.houseabsolute.com/

143 questions
2
votes
1 answer

Perl Mason2 passing arrays and hashes

I'm trying to use Mason2 with Dancer and trivial cases like passing string to the template are working fine: get '/foo', sub { template 'foo' => { title => 'bar' }; }; <%args> $.title

<% $.title…

draxtor
  • 104
  • 6
2
votes
1 answer

What do these numbers before and after mason responses mean?

I am using mod_perl 2, mason, and apache 2.2 on Ubuntu 10.10 (x86) (standard packages from apt). When I send a HTTP request to my server, I get the following: $ nc localhost 80 < ~/Desktop/test.http HTTP/1.1 200 OK Date: Mon, 22 Nov 2010 00:32:02…
Joe Bane
  • 1,556
  • 1
  • 15
  • 30
2
votes
2 answers

Execute perl script using mason template

I have installed Mason module from cpan. Now i am executing my first program using mason template. first_mason.mc % my $name = "Mason"; Hello world! Welcome to <% $name %>. first_mason.pl #!/usr/local/bin/perl use Mason; my $mason =…
2
votes
1 answer

How to construct and redirect to a url in perl mason

From my .mi file, I want to do a redirect to a relative url and pass parameters 'x' and 'y'. Redirection should happen to - /a/b/c?x=1&y=2 Please suggest how can this be done. I am trying $m->redirect((url =>…
Andy897
  • 6,915
  • 11
  • 51
  • 86
2
votes
1 answer

how call filter 'h' in mason?

As doc says I may apply H filter by next code <% $message_body | h %> But calling filter is not covered when I inside <%perl> tag. Yes, doc says that I can call $m->filter(..., but this produce next error: Error during compilation of /.../input:…
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
2
votes
1 answer

Multiple method overrides in Mason2

Building a website using Mason2. Each page should call 3 filters (methods, called by content): <% $.filter1(args...) {{ %> <% $.filter2(args...) {{ %> <% $.filter3(args...) {{ %> I have 3 different implementation of those filters (methods). The…
cajwine
  • 3,100
  • 1
  • 20
  • 41
2
votes
2 answers

How to find out the HTTP method of the current request?

I have no idea how to get the HTTP headers with Mason. I only know that $m is the Mason Request Class.
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
2
votes
1 answer

How to call multiple methods defined in an Mason component?

Have two components: test.mc from I need call two methods defined in the component name.mi. the component /name.mi <%class> has 'name'; <%method text>
Some text here
<%method showname> NAME: <% $.name…
kobame
  • 5,766
  • 3
  • 31
  • 62
2
votes
1 answer

mason how to call outside WEB API

I am using mason to call an API(web based, I can use GET to call it) so that a json file can be returned. I know m->comp() can be used inside. But what function can be used externally?
2
votes
1 answer

How to "use" another module in perl mason?

In a regular perl script you can write use Foo::Crypt::Employee qw(foo); at the top of your file to use the foo subroutine throughout the rest of your script. How can I do this in a perl mason file? Where would I put such a line of code?
Nosrettap
  • 10,940
  • 23
  • 85
  • 140
2
votes
1 answer

How to create a constant string in a perl mason file?

Simple question: Is there a way that I can create a constant string inside a perl mason file? I want to be able to assign a hard coded string to a variable at the top of my perl file and then be able to use it throughout the rest of the file. …
Nosrettap
  • 10,940
  • 23
  • 85
  • 140
2
votes
0 answers

Why would value passed through $m->comp() lose its value irregularly?

I have a perl mason component which is called to display an html page containing threaded comments. It uses Class DBI for loading from a MySQL database. The problem is that sometimes, and I mean sometimes, very irregularly a variable loses its…
cesoid
  • 990
  • 10
  • 12
2
votes
1 answer

Why IPC::Run3 cannot capture any standard output in Apache environment?

%use IPC::Run3; %my $a; %run3 ['echo','hello'],\undef,\$a; <% $a %> Above mason code works very well when I use Mason from a standalone script, as descriped in HTML::Mason::Admin. Unfortunately, when running with perl_mode, $a is an empty string.…
wcy
  • 875
  • 11
  • 12
2
votes
3 answers

Why isn't my `my` variable accessible inside a sub?

I'm writing a Mason 1.x component page, and it's not behaving like I'm expecting. The perlsub man page indicates that a my variable should be accessible inside a sub. But the following code: my @myOrderBy = @orderBy; sub sortAll { my $ret = 0; …
Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408
2
votes
1 answer

RequestTracker and Mason destroying my class over and over again

I'm hacking on Request Tracker, which is written in perl and uses Mason for the web interface. I'm trying to make a customized page, that involves an autohandler, an html page, and pulls in some methods in other comps. I have a simple class that I…
Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408
1 2
3
9 10