[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5243] addons/1.3/report_framework/trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[5243] addons/1.3/report_framework/trunk/LedgerSMB
- From: ..hidden..
- Date: Fri, 23 Nov 2012 02:14:35 +0000
Revision: 5243
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5243&view=rev
Author: einhverfr
Date: 2012-11-23 02:14:34 +0000 (Fri, 23 Nov 2012)
Log Message:
-----------
Updating reporting backport
Modified Paths:
--------------
addons/1.3/report_framework/trunk/LedgerSMB/DBObject_Moose.pm
Added Paths:
-----------
addons/1.3/report_framework/trunk/LedgerSMB/MooseTypes.pm
Modified: addons/1.3/report_framework/trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- addons/1.3/report_framework/trunk/LedgerSMB/DBObject_Moose.pm 2012-11-22 08:06:55 UTC (rev 5242)
+++ addons/1.3/report_framework/trunk/LedgerSMB/DBObject_Moose.pm 2012-11-23 02:14:34 UTC (rev 5243)
@@ -10,7 +10,7 @@
=cut
package LedgerSMB::DBObject_Moose;
-use Moose;
+use Moose::Role;
use LedgerSMB::DBObject;
use LedgerSMB;
use Scalar::Util;
@@ -138,6 +138,4 @@
=cut
-__PACKAGE__->meta->make_immutable;
-
1;
Copied: addons/1.3/report_framework/trunk/LedgerSMB/MooseTypes.pm (from rev 5237, trunk/LedgerSMB/MooseTypes.pm)
===================================================================
--- addons/1.3/report_framework/trunk/LedgerSMB/MooseTypes.pm (rev 0)
+++ addons/1.3/report_framework/trunk/LedgerSMB/MooseTypes.pm 2012-11-23 02:14:34 UTC (rev 5243)
@@ -0,0 +1,77 @@
+=head1 NAME
+
+LedgerSMB::MooseTypes - Moose subtypes and coercions for LedgerSMB
+
+=cut
+
+package LedgerSMB::MooseTypes;
+use Moose;
+use Moose::Util::TypeConstraints;
+use LedgerSMB::PGDate;
+use LedgerSMB::PGNumber;
+
+=head1 SYNPOSIS
+
+ has 'date_from' => (is => 'rw',
+ isa => 'LedgerSMB::Moose::Date',
+ coerce => 1
+ );
+
+ has 'amount_from' => (is => 'rw',
+ isa => 'LedgerSMB::Moose::Number',
+ coerce => 1
+ );
+
+=head1 DESCRIPTION
+
+This includes a general set of wrapper types, currently limited to dates and
+numbers, for automatic instantiation from strings.
+
+=head1 SUBTYPES
+
+=head2 LedgerSMB::Moose::Date
+
+This wraps the LedgerSMB::PGDate class for automagic handling of i18n and
+date formats.
+
+=cut
+
+subtype 'LedgerSMB::Moose::Date', as 'LedgerSMB::PGDate';
+
+
+
+=head3 Coercions
+
+The only coercion provided is from a string, and it calls the PGDate class's
+from_input method. A second coercian is provided for
+Maybe[LedgerSMB::Moose::Date].
+
+=cut
+
+coerce 'LedgerSMB::Moose::Date'
+ => from 'Str'
+ => via { LedgerSMB::PGDate->from_input($_) };
+
+=head2 LedgerSMB::Moose::Number
+
+This wraps the LedgerSMB::PGNumber class for automagic handling if i18n and
+number formats.
+
+=cut
+
+subtype 'LedgerSMB::Moose::Number', as 'LedgerSMB::PGNumber';
+
+
+=head3 Coercions
+
+The only coercion provided is from a string and it calls the PGNumber class's
+from_input method. A second coercian is provided for
+Maybe[LedgerSMB::Moose::Number]
+
+=cut
+
+coerce 'LedgerSMB::Moose::Number',
+ from 'Str',
+ via { LedgerSMB::PGNumber->from_input($_) };
+
+1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.