-
Notifications
You must be signed in to change notification settings - Fork 51
/
Bric.pm
963 lines (644 loc) · 22.6 KB
/
Bric.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
package Bric;
=head1 NAME
Bric - The Bricolage base class.
=head1 VITALS
=over 4
=item Version
$LastChangedRevision$
=item Release Version
1.9.2 - Development Track for 1.10.0
=cut
# Set the Version Number.
BEGIN {
our $VERSION = '1.9.2';
}
=item Date
$LastChangedDate$
=item Subversion ID
$Id$
=back
=head1 SYNOPSIS
use base qw(Bric);
=head1 DESCRIPTION
The Bric class is an abstract class should never be used directly. Instead new
classes should be derived from it.
=cut
##############################################################################
# Constants
##############################################################################
use constant FIELD_INVALID => 0x00;
use constant FIELD_NONE => 0x01;
use constant FIELD_READ => 0x02;
use constant FIELD_WRITE => 0x04;
use constant FIELD_RDWR => FIELD_READ | FIELD_WRITE;
use constant CAN_DO_LIST_IDS => 0;
use constant CAN_DO_LIST => 0;
use constant CAN_DO_LOOKUP => 0;
use constant HAS_CLASS_ID => 0;
use constant HAS_MULTISITE => 0;
##############################################################################
# Dependencies
##############################################################################
# Standard Dependencies
use strict;
##############################################################################
# Programmatic Dependencies
use Bric::Util::Fault qw(:all);
use Bric::Config qw(:qa :mod_perl CACHE_DEBUG_MODE);
# Load the Apache modules if we're in mod_perl.
if (defined MOD_PERL) {
require Apache;
require Apache::Request;
}
##############################################################################
# Public Instance Fields
# All subclasses should use the RegisterFields function rather than the below
# code
sub ACCESS {
return {# debug => FIELD_RDWR, # public field
_dirty => FIELD_NONE, # private field
};
}
##############################################################################
# Interface
##############################################################################
=head1 INTERFACE
=head2 Constructors
=head3 new
my $obj = Bric->new($init);
Call this constructor from all derived classes. This sets up some basic fields
and methods.
B<Throws:>
=over 4
=item Exception::Gen
=back
=cut
sub new {
my $self = shift;
my ($init) = @_;
# Instantiate object
$self = bless {}, $self unless ref $self;
# Fill in object state fields and configuration fields
$self->_set($init) if $init;
return $self;
}
##############################################################################
=head3 lookup
my $obj = Bric->lookup({ id => $obj_id });
This method is similar to C<new()> except it is used only to retrieve a
already existing object of this type from the database whereas C<new()>
creates a new, empty object. All subclasses should override this method in
order to look up their objects in the database. However, they must first call
C<cache_lookup()> to see if it can retrieve the object from the cache. If they
can, they should simply return the object. Otherwise, once they look up the
object in the database, they should cache it via the C<cache_me()> method. For
example:
sub lookup {
my $pkg = shift;
my $self = $pkg->cache_lookup(@_);
return $self if $self;
# ... Continue to look up object in the database. Then...
$self->cache_me;
}
B<Throws:>
=over
=item Exception::MNI
=back
=cut
sub lookup { throw_mni "lookup() method not implemented" }
##############################################################################
=head3 cache_lookup
my $obj = Bric->cache_lookup({ id => $obj_id });
Looks up an object in the cache and returns it if it exists. Otherwise it
returns C<undef>. This method is meant to be used by Bric subclasses in their
C<lookup()> methods. See C<lookup()> for an example.
=cut
sub cache_lookup {
if (defined MOD_PERL) {
my ($pkg, $param) = @_;
my $req = Apache->request;
# We may be called during Apache startup
return unless $req;
my $r = Apache::Request->instance($req);
$pkg = ref $pkg || $pkg;
while (my ($k, $v) = each %$param) {
if (my $obj = $r->pnotes("$pkg|$k|" . lc $v)) {
return $obj;
}
}
}
if(CACHE_DEBUG_MODE && $Bric::CACHE_DEBUG_MODE_RUNTIME) {
my ($pkg, $param) = @_;
$pkg = ref $pkg || $pkg;
while (my ($k, $v) = each %$param) {
if (exists $Bric::DEBUG_CACHE{"$pkg|$k|" . lc $v}) {
return $Bric::DEBUG_CACHE{"$pkg|$k|" . lc $v};
}
}
}
return;
}
##############################################################################
=head3 list
my @objs = Bric->list($params);
my $objs_aref = Bric->list($params);
This is an abstract method. All derived classes should override this
method. It takes a list of parameters and searches the database for objects
that meet the parameter serach criteria. It returns a list of objects in an
array context, and an array reference of objects in a scalar context. In the
concrete implementations of this method, classes should also call
C<cache_me()> for every object to be returned.
B<Throws:>
=over 4
=item Exception::MNI
=back
=cut
sub list { throw_mni "list() method not implemented" }
##############################################################################
=head2 Class Methods
=head3 list_ids
my @ids = Bric->list_ids($params);
my $ids_aref = Bric->list_ids($params);
This is an abstract method. It takes a list of parameters and searches the
database for objects that meet the parameter serach criteria. It returns a
list of object IDs in an array context, and an array reference of object IDs
in a scalar context.
B<Throws:>
=over 4
=item Exception::MNI
=back
=cut
sub list_ids { throw_mni "list_ids ()method not implemented" }
##############################################################################
=head3 my_meths
my $meths = Bric->my_meths
my @meths = Bric->my_meths(1);
my $meths_aref = Bric->my_meths(1);
@meths = Bric->my_meths(0, 1);
$meths_aref = Bric->my_meths(0, 1);
Returns an anonymous hash of introspection data for this object. If called
with a true argument, it will return an ordered list or anonymous array of
introspection data. If a second true argument is passed instead of a first,
then a list or anonymous array of introspection data will be returned for
properties that uniquely identify an object (excluding C<id>, which is
assumed).
Each hash key is the name of a property or attribute of the object. See each
subclass for a list of the properties included in the hash. The value for a
hash key is another anonymous hash containing the following keys:
=over 4
=item name
The name of the property or attribute. Is the same as the hash key when an
anonymous hash is returned.
=item disp
The display name of the property or attribute.
=item get_meth
A reference to the method that will retrieve the value of the property or
attribute.
=item get_args
An anonymous array of arguments to pass to a call to get_meth in order to
retrieve the value of the property or attribute.
=item set_meth
A reference to the method that will set the value of the property or
attribute.
=item set_args
An anonymous array of arguments to pass to a call to set_meth in order to set
the value of the property or attribute.
=item type
The type of value the property or attribute contains. There are only three
types:
=over 4
=item short
=item date
=item blob
=back
=item len
If the value is a 'short' value, this hash key contains the length of the
field.
=item search
The property is searchable via the list() and list_ids() methods.
=item req
The property or attribute is required.
=item props
An anonymous hash of properties used to display the property or
attribute. Possible keys include:
=over 4
=item type
The display field type. Possible values are
=over 4
=item text
=item textarea
=item password
=item hidden
=item radio
=item checkbox
=item select
=back
=item length
The Length, in letters, to display a text or password field.
=item maxlength
The maximum length of the property or value - usually defined by the SQL DDL.
=back
=item rows
The number of rows to format in a textarea field.
=item cols
The number of columns to format in a textarea field.
=item vals
An anonymous hash of key/value pairs reprsenting the values and display names
to use in a select list.
=back
B<Notes:> The method is a no-op here in the Bric base class. See the
subclasses for implementations and detail regarding the properties they
return.
=cut
sub my_meths {}
##############################################################################
=begin private
=head2 Destructors
=head3 DESTROY
This is the default destructor method. Even if nothing is defined within it,
it should still be here so that Perl wont waste time trying to find it in the
C<AUTOLOAD()> method.
=end private
=cut
sub DESTROY {}
=head2 Instance Methods
=head3 get/set
my $val = $obj->get_field1;
$obj = $obj->set_field1($val);
This is the AUTOLOAD handler. It translates all set and get operations into
subroutines acting upon the fields in derived classes.
B<Side Effects:> Creates a custom subroutine reference in the object package's
namespace.
B<Throws:>
=over 4
=item Exception::GEN
=back
=cut
sub AUTOLOAD {
my $self = $_[0];
my $pkg = ref $self or throw_gen "$self is not an object";
my ($op, $field, $perm, $msg);
# Get method name
our $AUTOLOAD;
# need symbolic refs to access the symbol table and call
# subroutine through $AUTOLOAD
no strict 'refs';
# Skip DESTROY and other ALL CAPs methods
return if $AUTOLOAD =~ /::[A-Z_]+$/;
# Make sure the function was called in the correct form.
($op, $field) = $AUTOLOAD =~ /([^_:]+)_(\w+)$/;
# Check the format and content of this AUTOLOAD request.
throw_gen "Bad AUTOLOAD method format: $AUTOLOAD"
unless $op and $field;
throw_gen "Cannot AUTOLOAD private methods: $AUTOLOAD"
if $field =~ /^_/;
# Get the permissions for this field
$perm = $pkg->ACCESS()->{$field} || FIELD_INVALID;
# field doesn't exist!
throw_gen "Access denied: '$field' is not a valid field for package $pkg."
if $perm & FIELD_INVALID;
# A get request
if ($op eq 'get') {
# check permissions
throw_gen qq{Can't locate object method "get_$field" via package "$pkg"}
unless $perm & FIELD_READ;
# setup get method
*{$AUTOLOAD} = QA_MODE ?
sub { return $_[0]->{$field} } : # take a shortcut
sub { return $_[0]->_get($field) }; # go directly to jail
}
# A set request
elsif ($op eq 'set') {
# check permissions
throw_gen qq{Can't locate object method "set_$field" via package "$pkg"}
unless $perm & FIELD_WRITE;
# setup set method
*{$AUTOLOAD} = sub { return $_[0]->_set([$field],[$_[1]]) }
}
# A read permission check
elsif ($op eq 'readable') {
my $val = $perm & FIELD_READ;
*{$AUTOLOAD} = sub () { $val };
}
# A write permission check
elsif ($op eq 'writable') {
my $val = $perm & FIELD_WRITE;
*{$AUTOLOAD} = sub () { $val };
}
# otherwise, fail
else {
throw_gen qq{Can't locate object method "$op\_$field" via package "$pkg"};
}
# call the darn method - all the parameters are still in @_
&$AUTOLOAD;
}
##############################################################################
=head3 get_grp_ids
my @grp_ids = $obj->get_grp_ids;
my $grp_ids_aref = $obj->get_grp_ids;
my @grp_ids = Bric->get_grp_ids;
my $grp_ids_aref = Bric->get_grp_ids;
Return a list of IDs for the Bric::Util::Grp objects to which the object
belongs. When called as a class method, return the value of the class'
C<INSTANCE_GROUP_ID> constant. Values are returned as a list in an array
context, and as an array reference in a scalar context.
=cut
sub get_grp_ids {
my $self = shift;
# Don't bother doing anything if this isn't a groupable class.
return unless defined($self->GROUP_PACKAGE);
# If it's just a class name, just return the instance class ID.
return $self->INSTANCE_GROUP_ID unless ref $self;
# Just return if there are no group IDs.
return unless exists $self->{grp_ids};
# Return the group IDs.
return wantarray ? @{$self->{grp_ids}} : $self->{grp_ids};
}
##############################################################################
=head3 cache_me
$obj = $obj->cache_me;
Caches the object for later retrieval by the C<lookup()> class method. Should
be called for all objects retrieved from the database, including all objects
to be returned by C<lookup()>, C<list()>, and C<href()> methods.
=cut
sub cache_me {
my $self = shift;
if (defined MOD_PERL) {
my $pkg = ref $self or return;
# Skip unsaved objects.
return unless defined $self->{id};
my $req = Apache->request;
# We may be called during Apache startup
return $self unless $req;
my $r = Apache::Request->instance($req);
# Cache it under its ID.
$r->pnotes("$pkg|id|$self->{id}" => $self);
# Cache it under other unique identifiers.
foreach my $m ($self->my_meths(0, 1)) {
$r->pnotes("$pkg|$m->{name}|" . lc $m->{get_meth}->($self) => $self);
}
}
if(CACHE_DEBUG_MODE && $Bric::CACHE_DEBUG_MODE_RUNTIME) {
my $pkg = ref $self or return;
# Skip unsaved objects.
return unless defined $self->{id};
# Cache it under its ID.
$Bric::DEBUG_CACHE{"$pkg|id|$self->{id}"} = $self;
# Cache it under other unique identifiers.
foreach my $m ($self->my_meths(0, 1)) {
$Bric::DEBUG_CACHE{"$pkg|$m->{name}|" . lc $m->{get_meth}->($self)}
= $self;
}
}
return $self;
}
##############################################################################
=head3 uncache_me
$obj->uncache_me;
Remove an object from the cache. This should be done before an
object's associated data is permanently deleted from the database.
=cut
sub uncache_me {
my $self = shift;
if (defined MOD_PERL) {
my $pkg = ref $self or return;
# Skip unsaved objects.
return unless defined $self->{id};
my $req = Apache->request;
# We may be called during Apache startup
return $self unless $req;
my $r = Apache::Request->instance($req);
# Uncache it under its ID.
$r->pnotes("$pkg|id|$self->{id}" => undef);
# Uncache it under other unique identifiers.
foreach my $m ($self->my_meths(0, 1)) {
$r->pnotes("$pkg|$m->{name}|" . lc $m->{get_meth}->($self) => undef);
}
}
if(CACHE_DEBUG_MODE && $Bric::CACHE_DEBUG_MODE_RUNTIME) {
my $pkg = ref $self or return;
# Skip unsaved objects.
return unless defined $self->{id};
$Bric::DEBUG_CACHE{"$pkg|id|$self->{id}"} = undef;
foreach my $m ($self->my_meths(0, 1)) {
$Bric::DEBUG_CACHE{"$pkg|$m->{name}|" . lc $m->{get_meth}->($self)}
= undef;
}
}
return $self;
}
##############################################################################
=head3 register_instance
$obj = $obj->register_instance;
Add the current object to the appropriate "All" group in the database. These
are groups that contain every instance of a particular type of object.
B<Throws:>
=over
=item Exception::DA
=back
=cut
sub register_instance {
my ($self, $grp_id, $grp_pkg) = @_;
# Fail if the package has not defined the GROUP_PACKAGE constant.
$grp_id ||= $self->INSTANCE_GROUP_ID || return;
$grp_pkg ||= $self->GROUP_PACKAGE || return;
# Add the object to the group.
my $grp = $grp_pkg->lookup({ id => $grp_id }) || return;
$grp->add_member({ obj => $self, no_check => 1 });
return $self if $grp->save;
}
##############################################################################
=head3 unregister_instance
$obj = $obj->unregister_instance;
Remove the current object from the appropriate "All" group in the database.
These are groups that contain every instance of a particular type of object.
B<Throws:>
=over
=item Exception::DA
=back
=cut
sub unregister_instance {
my $self = shift;
# Fail if the package has not defined the GROUP_PACKAGE constant.
return unless defined $self->GROUP_PACKAGE;
return unless defined $self->INSTANCE_GROUP_ID;
my $grp_id = $self->INSTANCE_GROUP_ID;
my $grp_pkg = $self->GROUP_PACKAGE;
my $grp = $grp_pkg->lookup({ id => $grp_id }) or return;
my @mbs = $grp->get_members;
my ($mem) = grep($_->get_object->get_id eq $self->get_id, @mbs);
$grp->delete_members($mem);
return $self if $grp->save;
}
##############################################################################
=head3 save
$obj = $obj->save;
Save the current object by setting an internal flag indicating that it has
been saved. Subclasses should override this method to save object data to the
database.
=cut
sub save {
my $self = shift;
$self->{_dirty} = 0;
return $self;
}
##############################################################################
=head2 Functions
=head3 register_fields
Bric::register_fields({ field1 => Bric::FIELD_READ,
field2 => Bric::FIELD::RDWR
});
This function is used by sub classes to register their field names and assign
access levels to them.
B<Side Effects>: Defines a subroutine named C<ACCESS()> in the caller's
package.
B<Throws:>
=over 4
=item Exception::GEN
=back
=cut
sub register_fields {
my $fields = shift || {};
my $pkg = caller();
my $root = __PACKAGE__;
# need symbolic refs to access the symbol table and install subroutines
no strict 'refs';
# find parent class (only handle single inheritence)
my ($parent) = grep { /^$root/ } (@{"${pkg}::ISA"});
# setup ACCESS sub for this package
eval {
my %ACCESS = ( %{$parent->ACCESS()}, %$fields );
*{"${pkg}::ACCESS"} = sub { \%ACCESS };
};
throw_gen error => "Unable to register field names", payload => $@
if $@;
}
##############################################################################
=begin private
=head2 Private Instance Methods
These methods are designed to be used by subclasses.
=head3 _get__dirty
my $dirty = $obj->_get__dirty;
Gets the value of the dirty boolean. This attribute indicates whether data in
the object has changed since it was instantiated or last saved, so that the
C<save()> method can determine whether to save data to the database again.
=cut
sub _get__dirty {
my $self = shift;
return $self->{'_dirty'};
}
=head3 _set__dirty
$ojb = $obj->_set__dirty($dirty);
Sets the value of the dirty boolean. This attribute indicates whether data in
the object has changed since it was instantiated or last saved, so that the
C<save()> method can determine whether to save data to the database again.
=cut
sub _set__dirty {
my $self = shift;
$self->{'_dirty'} = shift;
return $self;
}
##############################################################################
=head3 _set
$obj = $obj->_set(\%values);
$obj = $obj->_set(\@fields, \@values);
Sets field values. Can be called with either a hash reference of field name
keys and their corresponding values, or as two array references, one
containing all the field names, the other containing the values for those
keys, in order.
B<Notes:> For performance reasons, certain error checking only occurrs in
C<QA_MODE>.
B<Throws:>
=over 4
=item Exception::GEN
=back
=cut
sub _set {
my $self = shift;
# Make sure we have arguments.
throw_gen "Incorrect number of args to _set()." unless @_;
# Load $k and $v differently if its a hash ref or two array refs.
my ($k, $v) = @_ == 1 ? ([keys %{$_[0]}],[values %{$_[0]}]) : @_;
my ($key, $old_value, $new_value, $dirt);
for (0 .. $#$k) {
$key = $k->[$_];
$new_value = $v->[$_];
$old_value = $self->{$key};
# skip unless new_value is different from old_value
next if (not defined $new_value and not defined $old_value) or
(defined $new_value and defined $old_value and
$old_value eq $new_value);
# a change was found, mark for later
$dirt = 1;
# fast version, no check for errors
$self->{$key} = $new_value unless QA_MODE;
# in QA_MODE check for (impossible?) failures
if (QA_MODE) {
eval {
$self->{$key} = $new_value;
$dirt = 1;
};
throw_gen error => "Error setting value for '$key' in _set().",
payload => $@ if $@;
}
}
# Set the dirty flag to show that this objects needs an update.
$self->{_dirty} = 1 if $dirt;
return $self;
}
##############################################################################
=head3 _get
my @vals = $obj->_get(@fields);
my $val = $obj->_get($field);
Retrieves field values. If passed a list of field names, it will return a list
of values for those fields. If passed a single field name, it will return a
single value for that field.
B<Notes:> Error checking and exception throwing is only performed in QA_MODE
for performance reasons.
B<Throws:>
=over 4
=item Exception::GEN
=back
=cut
sub _get {
my $self = shift;
# producton code - no check for errors
return wantarray ? @{$self}{@_} : $self->{$_[0]} unless QA_MODE;
# debugging code
if (QA_MODE) {
my @return;
# Iterate through the keys and build up a return array.
for (@_) {
# If this is a private field, we need to access it differently.
eval { push @return, $self->{$_}};
throw_gen "Problems retrieving field '$_': $@" if $@;
}
# Syntax sugar. Let the user say $n = get_foo rather than ($n) =
# get_foo
return wantarray ? @return : $return[0];
}
}
##############################################################################
=head2 Private Functions
=head3 die
Bricolage overrides all exception handling to use exceptions unless it is
running under C<mod_perl>.
=head3 warn
Bric overrides all C<warn>ings to use exceptions unless it is running under
C<mod_perl>.
=cut
unless (MOD_PERL) {
$SIG{__DIE__} = \&throw_gen;
$SIG{__WARN__} = sub {
print STDERR Bric::Util::Fault::Exception::GEN->new(error => shift)
};
}
##############################################################################
=end private
=head1 AUTHOR
Garth Webb <garth@perijove.com>
Sam Tregar <stregar@about-inc.com>
=head1 SEE ALSO
NONE
=cut
1;