xmltv/lib Configure.pm,1.7,1.8

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/lib
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17234

Modified Files:
	Configure.pm 
Log Message:
Add 'constant' option in write_string()

Comments in config file not restricted to starting in first column

Index: Configure.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/lib/Configure.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Configure.pm	10 Apr 2012 08:44:21 -0000	1.7
--- Configure.pm	8 Jan 2014 11:27:50 -0000	1.8
***************
*** 1,4 ****
--- 1,9 ----
  package XMLTV::Configure;
  
+ # use version number for feature detection:
+ # 0.005065 : can use 'constant' in write_string()
+ # 0.005065 : comments in config file not restricted to starting in first column
+ our $VERSION = 0.005065;
+ 
  BEGIN {
      use Exporter   ();
***************
*** 72,76 ****
  	$line =~ tr/\n\r//d;
  	next if $line =~ /^\s*$/;
! 	next if $line =~ /^#/;
          
  	# Only accept lines with key=value or key!value. 
--- 77,81 ----
  	$line =~ tr/\n\r//d;
  	next if $line =~ /^\s*$/;
! 	next if $line =~ /^\s*#/;
          
  	# Only accept lines with key=value or key!value. 
***************
*** 79,83 ****
  	# part of the value, except for white-space at the end of the line
  	# which is ignored.
! 	my( $key, $sign, $value ) = ($line=~ /^(\S+)([=!])(.*?)\s*$/ );
  
  	return undef unless defined $key;
--- 84,88 ----
  	# part of the value, except for white-space at the end of the line
  	# which is ignored.
! 	my( $key, $sign, $value ) = ($line=~ /^(\S+)([=!])(.*?)\s*(#.*)?$/ );
  
  	return undef unless defined $key;
***************
*** 217,230 ****
  	my $description = getvalue( $p, 'description', $lang );
  	my $default = $p->findvalue( '@default' );
  	
  	my $value;
  
! 	my $q = defined( $default ) ? "$title: [$default]" :
  	                              "$title:";
  
! 	say( "$description" );
  	if( $tag eq 'string' )
  	{
! 	    $value = ask( "$q" );
  	    $value = $default if $value eq "";
  	    print OUT "$id=$value\n";
--- 222,237 ----
  	my $description = getvalue( $p, 'description', $lang );
  	my $default = $p->findvalue( '@default' );
+ 	my $constant = $p->findvalue( '@constant' );
  	
  	my $value;
  
! 	my $q = $default ne '' ? "$title: [$default]" :
  	                              "$title:";
  
! 	say( "$description" ) if $constant eq '';
  	if( $tag eq 'string' )
  	{
! 	    $value = $constant if $constant ne '';
! 	    $value = ask( "$q" ) if $constant eq '';
  	    $value = $default if $value eq "";
  	    print OUT "$id=$value\n";


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.