Jonathan Yu > Alien-Libjio-1.004 > Alien::Libjio

Download:
Alien-Libjio-1.004.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.004   Source  

NAME ^

Alien::Libjio - Utility package to install and locate libjio

VERSION ^

version 1.004

SYNOPSIS ^

  use Alien::Libjio;

  my $jio = Alien::Libjio->new;
  my $ldflags = $jio->ldflags;
  my $cflags = $jio->cflags;

DESCRIPTION ^

To ensure reliability, some file systems and databases provide support for something known as journalling. The idea is to ensure data consistency by creating a log of actions to be taken (called a Write Ahead Log) before committing them to disk. That way, if a transaction were to fail due to a system crash or other unexpected event, the write ahead log could be used to finish writing the data.

While this functionality is often available with networked databases, it can be a rather memory- and processor-intensive solution, even where reliable writes are important. In other cases, the filesystem does not provide native journalling support, so other tricks may be used to ensure data integrity, such as writing to a separate temporary file and then overwriting the file instead of modifying it in-place. Unfortunately, this method cannot handle threaded operations appropriately.

Thankfully, Alberto Bertogli published a userspace C library called libjio that can provide these features in a small (less than 1500 lines of code) library with no external dependencies.

This package is designed to install it, and provide a way to get the flags necessary to compile programs using it. It is particularly useful for Perl XS programs that use it, such as IO::Journal.

METHODS ^

Alien::Libjio->new

Creates a new Alien::Libjio object, which essentially just has a few convenience methods providing useful information like compiler and linker flags.

Example code:

  my $jio = Alien::Libjio->new();

This method will return an appropriate Alien::Libjio object or throw an exception on error.

$jio->installed

Determine if a valid installation of libjio has been detected in the system. This method will return a true value if it is, or undef otherwise.

Example code:

  print "okay\n" if $jio->installed;

$jio->version

Determine the installed version of libjio, as a string.

Currently versions are simply floating-point numbers, so you can treat the version number as such, but this behaviour is subject to change.

Example code:

  my $version = $jio->version;

$jio->ldflags

$jio->linker_flags

This returns the flags required to link C code with the local installation of libjio (typically in the LDFLAGS variable). It is particularly useful for building and installing Perl XS modules such as IO::Journal.

In scalar context, it returns an array reference suitable for passing to other build systems, particularly Module::Build. In list context, it gives a normal array so that join and friends will work as expected.

Example code:

  my $ldflags = $jio->ldflags;
  my @ldflags = @{ $jio->ldflags };
  my $ldstring = join(' ', $jio->ldflags);
  # or:
  # my $ldflags = $jio->linker_flags;

$jio->cflags

$jio->compiler_flags

This method returns the compiler option flags to compile C code which uses the libjio library (typically in the CFLAGS variable). It is particularly useful for building and installing Perl XS modules such as IO::Journal.

Example code:

  my $cflags = $jio->cflags;
  my @cflags = @{ $jio->cflags };
  my $ccstring = join(' ', $jio->cflags);
  # or:
  # my $cflags = $jio->compiler_flags;

$jio->method

$jio->how

This method returns the method the module used to find information about libjio. The following methods are currently used (in priority order):

Example code:

  if ($jio->installed) {
    print 'I found this information using: ', $jio->how, "\n";
  }

ACKNOWLEDGEMENTS ^

SEE ALSO ^

IO::Journal, a Perl module that provides an interface to libjio.

http://blitiri.com.ar/p/libjio/, Alberto Bertogli's page about libjio, which explains the purpose and features of libjio.

CAVEATS ^

1;

BUGS ^

Please report any bugs or feature requests on the bugtracker website http://rt.cpan.org/NoAuth/Bugs.html?Dist=Alien-Libjio

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR ^

Jonathan Yu <jawnsy@cpan.org>

COPYRIGHT AND LICENSE ^

Legally speaking, this package and its contents are:

  Copyright (c) 2011 by Jonathan Yu <jawnsy@cpan.org>.

But this is really just a legal technicality that allows the author to offer this package under the public domain and also a variety of licensing options. For all intents and purposes, this is public domain software, which means you can do whatever you want with it.

The software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

syntax highlighting: