pf-tools commit: r871 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Conf.pm lib/PFTools/Conf/Syntax.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Aug 31 15:09:41 UTC 2010


Author: ccaillet-guest
Date: Tue Aug 31 15:09:34 2010
New Revision: 871

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=871
Log:
  - using named backreference from PFTools::Conf::Syntax
  - using named backreference for using into Init_SUBST function

Modified:
    branches/next-gen/debian/changelog
    branches/next-gen/lib/PFTools/Conf.pm
    branches/next-gen/lib/PFTools/Conf/Syntax.pm

Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=871&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Tue Aug 31 15:09:34 2010
@@ -18,8 +18,10 @@
     - small fixes on Get_source for order and substitution regex
     - rollback for CONFIG: alias with the 0.33-stable substitution value
     - optims : sorting sections according to the types in Init_GLOBAL_NETCONFIG
+    - using named backreference from PFTools::Conf::Syntax
   * lib/PFTools/Conf/Syntax.pm
     - extracting syntax checks from PFTools::Conf to PFTools::Conf::Syntax
+    - using named backreference for using into Init_SUBST function
     which is more flexible for future evolutions
   * lib/PFTools/Conf/Host.pm
     - moving PFTools::Host to PFTools::Conf::Host because functions are
@@ -75,7 +77,7 @@
   * tools/Translate_old_config
     - tools for translating old configuration (pf-tools 0.XX) into new syntax
 
- -- Christophe Caillet <quadchris at free.fr>  Mon, 30 Aug 2010 11:34:57 +0200
+ -- Christophe Caillet <tof at sitadelle.com>  Tue, 31 Aug 2010 17:07:53 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Modified: branches/next-gen/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf.pm?rev=871&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf.pm (original)
+++ branches/next-gen/lib/PFTools/Conf.pm Tue Aug 31 15:09:34 2010
@@ -198,11 +198,11 @@
 	unless ($ref_subst->{'HOSTNAME'} =~ m/$host_regex/) {
 	    Abort( $CODE->{'OPEN'}, "Init_SUBST failed: invalid hostname $ref_subst->{'HOSTNAME'}" );
 	}
-	$ref_subst->{'HOSTTYPE'}	= $1 ;
-	$ref_subst->{'HOSTDIGITS'}	= $5 ;
-	$ref_subst->{'HOSTCLUSTER'}	= $4.$5 if ( defined $4 && defined $5 );
-	$ref_subst->{'HOSTNODEINDEX'}	= $6 || "" ;
-	$ref_subst->{'POPNAME'}		= $3 || "" ;
+	$ref_subst->{'HOSTTYPE'}	= $+{HOSTTYPE} ;
+	$ref_subst->{'HOSTDIGITS'}	= $+{HOSTDIGITS} ;
+	$ref_subst->{'HOSTCLUSTER'}	= $+{HOSTDIGITS}.$+{HOSTNODEINDEX} if ( defined $+{HOSTDIGITS} && defined $+{HOSTNODEINDEX} );
+	$ref_subst->{'HOSTNODEINDEX'}	= $+{HOSTNODEINDEX} || "" ;
+	$ref_subst->{'POPNAME'}		= $+{POPNAME} || "" ;
 	$ref_subst->{'HOSTNUM'}		= $ref_subst->{'HOSTDIGITS'} ;
 	$ref_subst->{'HOSTNUM'}		=~ s/^0*// ;
 	if ( $ref_subst->{'HOSTNUM'} eq "" ) {

Modified: branches/next-gen/lib/PFTools/Conf/Syntax.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf/Syntax.pm?rev=871&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf/Syntax.pm (original)
+++ branches/next-gen/lib/PFTools/Conf/Syntax.pm Tue Aug 31 15:09:34 2010
@@ -44,9 +44,9 @@
 our $ALLOWED_PARSING_CONTEXT = '(host|network|config|model)';
 our $HOSTTYPE_CONFIG_REGEX = qr{
 	\A
-	(				# HOSTTYPE
-	(
-	    (			# POPNAME (optional)
+	(?<HOSTTYPE>				# HOSTTYPE
+	(
+	    (?<POPNAME>			# POPNAME (optional)
 		[a-z]{3}\d{1}
 	    )
 	    -
@@ -59,9 +59,9 @@
 }xms;
 our $MODEL_CONFIG_REGEX = qr{
 	\A
-	(				# HOSTTYPE
-	(
-	    (			# POPNAME (optional)
+	(?<HOSTTYPE>				# HOSTTYPE
+	(
+	    (?<POPNAME>			# POPNAME (optional)
 		[a-z]{3}\d{1}
 	    )
 	    -
@@ -76,9 +76,9 @@
 }xms;
 our $HOST_CONFIG_REGEX = qr{
 	\A
-	(				# HOSTTYPE
-	(
-	    (			# POPNAME (optional)
+	(?<HOSTTYPE>				# HOSTTYPE
+	(
+	    (?<POPNAME>			# POPNAME (optional)
 		[a-z]{3}\d{1}
 	    )
 	    -
@@ -86,8 +86,8 @@
 	(
 	    [a-z0-9-]+[a-z-]	# host type (without the POP name)
 	)
-    )(\d*)                       # HOSTDIGITS (optional)
-	([a-z]*)                    # HOSTNODEINDEX (optional)
+    )(?<HOSTDIGITS>\d*)                       # HOSTDIGITS (optional)
+	(?<HOSTNODEINDEX>[a-z]*)                    # HOSTNODEINDEX (optional)
 	\z
 }xms;
 our $DEPLOY_CONFIG_REGEX = '((?:\w{3}\d-r)?deploy|(\w{3}\d-)?spawn)';




More information about the pf-tools-commits mailing list