Mason::Plugin::DollarDot(3pm) User Contributed Perl Documentation Mason::Plugin::DollarDot(3pm)NAME
Mason::Plugin::DollarDot - Allow $. as substitution for $self-> and in attribute names
SYNOPSIS
<%class>
has 'name';
has 'date';
</%class>
<%method greet>
Hello, <% $.name %>. Today is <% $.date %>.
</%method>
...
% $.greet();
<%init>
# Set the date
$.date(scalar(localtime));
# or, if combined with LvalueAttributes
$.date = scalar(localtime);
</%init>
DESCRIPTION
This plugin substitutes "$.identifier" for "$self->identifier" in all Perl code inside components, so that $. can be used when referring to
attributes and calling methods. The actual regex is
s/ $.([^Wd]w*) / $self->$1 /gx;
RATIONALE
In Mason 2, components have to write "$self->" a lot to refer to attributes that were simple scalars in Mason 1. This eases the transition
pain. $. was chosen because of its similar use in Perl 6.
This plugin falls under the heading of gratuitous source filtering, which the author generally agrees is Evil. That said, this is a very
limited filter, and seems unlikely to break any legitimate Perl syntax other than use of the $. special variable (input line number).
BUGS
Will not interpolate as expected inside double quotes:
"My name is $.name" # nope
instead you have to do
"My name is " . $.name
SEE ALSO
Mason
AUTHOR
Jonathan Swartz <swartz@pobox.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-02 Mason::Plugin::DollarDot(3pm)
Check Out this Related Man Page
Mason::Component::Moose(3pm) User Contributed Perl Documentation Mason::Component::Moose(3pm)NAME
Mason::Component::Moose - Moose policies and exports for Mason components
DESCRIPTION
This module is automatically included in each generated Mason component class, and is equivalent to
use CLASS;
use Moose;
use MooseX::HasDefaults::RW;
use Method::Signatures::Simple;
OVERRIDING
To override the default behavior, subclass this class and specify it as "base_component_moose_class" to Mason::Interp.
For example, to use MooseX::StrictConstructor in every component:
package My::Mason::Component::Moose;
use Moose::Exporter;
use MooseX::StrictConstructor ();
use base qw(Mason::Component::Moose);
sub init_meta {
my $class = shift;
$class->SUPER::init_meta(@_);
MooseX::StrictConstructor->init_meta(@_);
}
...
my $interp = Mason::Interp->new(..., base_component_moose_class => 'My::Mason::Component::Moose');
SEE ALSO
Mason
AUTHOR
Jonathan Swartz <swartz@pobox.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-02 Mason::Component::Moose(3pm)
How to print current date of the Unix system accessing thru C++ program ?
I wrote like this
#include <time.h>
.......
time_t tt;
struct tm *tod;
....
time(&tt);
tod = localtime(&tt);
cout << tod->tm_mon + 1 << "/"
<< tod->tm_mday << "/"
... (6 Replies)
Dear forum, i am trying to write a little programme which should greet the user, tell him/her the current path and visualize the directories (NO FILES, JUST DIRECTORIES). what follows is chosen interactively by the user. what i've tried so far is:
echo "Hi $LOGNAME"
echo "You are in $PWD. Do... (2 Replies)
Hi All,
I am finding it difficult to use the date funtion inside another perl program.
system('perl -e 'print time(localtime() - 86400) . "\n" ' ' )
The above gives yesterday's date when running from the command prompt.
When I call it inside another perl script the it is showing... (1 Reply)
hi there, I have a question about a snippet of code i have which runs localtime() to convert the current date/time into a mysql happy format
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
printf "%4d-%02d-%02d ... (4 Replies)
hi, i am a really new to Perl. i have a following code that is working well.
"
i know this is really simple, but i cant figure out a way to do this. can someone help me please?:( (1 Reply)
Hi Experts,
I know how to handle normal date changes in perl. Most of my requirement are full filled with following:
$date1 = strftime "%Y%m%d",localtime;
$date2 = strftime "%Y%m%d",localtime(time -24 * 60 * 60);
$date3 = strftime "%Y%m%d",localtime(time +24 * 60 * 60);
$date4 = strftime... (4 Replies)
the following was taken from a perl script:
my $date = strftime "%B %d %H:%M:%S", localtime;
how can i modify it so this date outputs the date in the form of the date of the messages file. for example:
Sep 20 11:48:44
As it is right now, the perl script outputs the date like this:
... (1 Reply)