I have installed Mason module from cpan. Now i am executing my first program using mason template.
% my $name = "Mason";
Hello world! Welcome to <% $name %>.
my $mason = Mason->new(comp_root => '...');
first_mason.mc is not an absolute path at C:/Perl/site/lib/Mason/Request.pm line 256**
perldoc -l Mason
@stevenl fully answers your question. Simply don't blindly copy the Synopsis from the Mason docs, need read the docs too. :) E.g. in the example code:
#!/usr/local/bin/perl use Mason; my $mason = Mason->new(comp_root => '...'); print $mason->run('/foo')->output;
you need replace
#!/usr/local/bin/perlwith the real path to your perl interpreter
'...'with the real path in the filesystem, where your component are, e.g.
comp_root => '/some/real/path/here/where/my/component/root/is'
However, I wrote this answer mainly with a reason: if you want use the Mason for the web-app development, check the Poet module too. It GREATLY simplifies the whole process, and you will not need care about many-many things. E.g. after installing the
Poet you can simply:
poet new MyApp myapp/bin/run.pl
and you will immediately get (without any configuration) an WORKING web-app, and you could access it in your browser at http://localhost:5000. Your
component_root will be inside of the
myapp directory as