packetstormer has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to pass a variable to a new value using Config::Tiny?
I have a form that passes a value to a perl script. The value is called $newvalue. If I print the value its fine. However none of the following work to update the config file with that value:
use strict; use warnings; use diagnostics; use Config::Tiny; use CGI qw(param header); my $Config = Config::Tiny->new; $Config = Config::Tiny->read( 'file.conf' ); my $newvalue = param('newvalue'); chomp $newvalue; $Config->{section}->{ipaddress} = "\$newvalue"; #OR #$Config->{section}->{ipaddress} = \$newvalue; #OR #$Config->{section}->{ipaddress} = $newvalue; #OR #$Config->{section}->{ipaddress} = "$newvalue"; $Config->write( 'file.conf' ); print "Content-type: text/html\n\n"; print $newvalue; print <<ENDHTML
Has anyone any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Config::Tiny Module
by Eliya (Vicar) on Mar 29, 2011 at 20:30 UTC | |
by packetstormer (Monk) on Mar 29, 2011 at 20:54 UTC | |
by Eliya (Vicar) on Mar 29, 2011 at 21:04 UTC | |
by packetstormer (Monk) on Mar 30, 2011 at 08:26 UTC | |
by packetstormer (Monk) on Mar 29, 2011 at 21:05 UTC | |
by Eliya (Vicar) on Mar 29, 2011 at 21:27 UTC | |
|
Re: Config::Tiny Module
by perl514 (Pilgrim) on Jan 17, 2013 at 18:26 UTC |