GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CONFIG::INI::SIMPLE (3)

.ds Aq ’

NAME

Config::INI::Simple - Simple reading and writing from an INI file--with preserved comments, too!

CONTENTS

SYNOPSIS



  # in your INI file
  ; The name of the server block to use
  ; Use one of the blocks below.
  server = Server01

  ; All server blocks need a host and port.
  ; These should be under each block.
  [Server01]
  host=foo.bar.com
  port=7775

  [Server02]
  host=foobar.net
  port=2235

  # in your Perl script
  use Config::INI::Simple;

  my $conf = new Config::INI::Simple;

  # Read the config file.
  $conf->read ("settings.ini");

  # Change the port from "Server02" block
  $conf->{Server02}->{port} = 2236;

  # Change the "server" to "Server02"
  $conf->{default}->{server} = Server02;

  # Write the changes.
  $conf->write ("settings.ini");



DESCRIPTION

Config::INI::Simple is for very simplistic reading and writing of INI files. A new object must be created for each INI file (an object keeps all the data read in from an INI which is used on the write method to write to the INI). It also keeps all your comments and original order intact.

INI FILE FORMAT

A basic INI format is:



  [Block1]
  VAR1=Value1
  VAR2=Value2
  ...

  [Block2]
  VAR1=Value1
  VAR2=Value2
  ...



Comments begin with either a ; or a # and must be on their own line. The object’s hashref will contain the variables under their blocks. The default block is default (see <B>newB> for defaults). So, <B>B>$conf<B>-B>{Block2}->{VAR2} = Value2>

METHODS

    new

Creates a new Config::INI::Simple object. You can pass in certain settings here:

<B>__file__B> - Sets the file path of the INI file to read. If this value is set, then <B>readB> and <B>writeB> won’t need the FILE parameter.

<B>__default__B> - Sets the name of the default block. Defaults to ’default’

<B>__eol__B> - Set the end-of-line characters for writing an INI file. Defaults to Win32’s \n

<B>__append__B> - Set to true and new hash keys will be appended to the file upon writing. If a new block is added to the hashref, that block will be appended to the end of the file followed by its data. Defaults to 1.

    read (FILE)

Read data from INI file <B>FILEB>. The object’s hashref will contain this INI file’s contents.

    write (FILE)

Writes to the INI file <B>FILEB>, inputting all the hashref variables found in the object.

    reset

Resets the internal hashref of the INI reader object. The four settings specified with <B>newB> will be reset to what they were when you created the object. All other data is removed from memory.

CHANGES



  Version 0.02
  - Uploaded a version of the module thats been modified by some
    other Perl hackers.

  Version 0.01
  - Initial release.



AUTHOR

C. J. Kirsle <kirsle -at- cuvou.net>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by C. J. Kirsle

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CONFIG::INI::SIMPLE (3) 2008-02-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.