| VS-RuleEngine documentation | Contained in the VS-RuleEngine distribution. |
VS::RuleEngine::Util - Utility functions for VS::RuleEngine
Checks if the package PACKAGE is defined or not.
Checks if the given NAME is a valid name to assign inputs, outputs, hooks, rules and actions.
Checks if the given NAME is a valid package name or not.
Nonething by default.
| VS-RuleEngine documentation | Contained in the VS-RuleEngine distribution. |
package VS::RuleEngine::Util; use strict; use warnings; use Carp qw(croak); require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(); our @EXPORT_OK = qw( is_existing_package is_valid_name is_valid_package_name ); our %EXPORT_TAGS = (); sub is_valid_name { my $name = pop; return $name =~ m/^ [A-Za-z] [A-Za-z0-9_]* $/x; } sub is_valid_package_name { my $pkg = pop; return $pkg =~ m/[[:alpha:]_] \w* (?: (?: :: | ') \w+ )*/x; # } sub is_existing_package { my $package = pop; no strict 'refs'; my $exists = defined *{$package . '::'} ? 1 : 0; return $exists; } 1; __END__