package WebPAC::Common;
+use Exporter 'import';
+@EXPORT = qw/
+ force_array
+/;
use warnings;
use strict;
return File::Spec->catfile('var', @_);
}
+=head1 EXPORTED NETHODS
+
+=head2 force_array
+
+ my @array = force_array( $ref, sub {
+ warn "reference is undefined!";
+ });
+
+=cut
+
+sub force_array {
+ my ( $what, $error ) = @_;
+ my @result;
+ if ( ref( $what ) eq 'ARRAY' ) {
+ @result = @{ $what };
+ } elsif ( defined $what ) {
+ @result = ( $what );
+ } else {
+ $error->() if ref($error) eq 'CODE';
+ }
+ return @result;
+}
+
=head1 INTERNAL METHODS