Slackware::Slackget::Local - A class to load the locales


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.

Index


NAME

Top

Slackware::Slackget::Local - A class to load the locales

VERSION

Top

Version 1.0.0

SYNOPSIS

Top

This class' purpose is to load and export the local.

    use Slackware::Slackget::Local;

    my $local = Slackware::Slackget::Local->new();
    $local->load('/usr/local/share/slack-get/local/french.xml');
    print $local->get('__SETTINGS') ;

CONSTRUCTOR

Top

new

Can take an argument : the LC_MESSAGES file. In this case the constructor automatically call the Load() method.

	my $local = new Slackware::Slackget::Local();
	or
	my $local = new Slackware::Slackget::Local('/usr/local/share/slack-get/local/french.xml');

FUNCTIONS

Top

Load (deprecated)

Same as load(), provided for backward compatibility.

load

Load the local from a given file

	$local->load('/usr/local/share/slack-get/local/french.xml') or die "unable to load local\n";

Return undef if something goes wrong, 1 else.

get_indexes

Return the list of all index of the current loaded local. Dependending of the context, this method return an array or an arrayref.

	# Return a list
	foreach ($local->get_indexes) {
		print "$_ : ",$local->Get($_),"\n";
	}

	# Return an arrayref
	my $index_list = $local->get_indexes ;

Get (deprecated)

Same as get(), provided for backward compatibility.

get

Return the localized message of a given token :

	my $error_on_modification = $local->get('__ERR_MOD') ;

Return undef if the token doesn't exist.

You can also pass extra arguments to this method, and if their is wildcards in the token they will be replace by those values. Wildcards are %1, %2, ..., %x.

Here is and example :

	# The token is :
	# __NETWORK_CONNECTION_ERROR = Error, cannot connect to %1, the server said ``%2''.
	my $localized_token = $local->get('__NETWORK_CONNECTION_ERROR', '192.168.0.42', 'Connection not authorized');
	print "$localized_token\n";
	# $localized_token contains the string "Error, cannot connect to 192.168.0.42, the server said ``Connection not authorized''."




to_XML (deprecated)

Same as to_xml(), provided for backward compatibility.

name

Accessor for the name of the Local (langpack).

	print "The current langpack name is : ", $local->name,"\n";
	$local->name('Japanese'); # Set the name of the langpack to 'Japanese'.

AUTHOR

Top

DUPUIS Arnaud, <a.dupuis@infinityperl.org>

BUGS

Top

Please report any bugs or feature requests to bug-Slackware-Slackget@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Slackware::Slackget::Local




You can also look for information at:

* Infinity Perl website

http://www.infinityperl.org/category/slack-get

* slack-get specific website

http://slackget.infinityperl.org

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Slackware-Slackget

* CPAN Ratings

http://cpanratings.perl.org/d/Slackware-Slackget

* Search CPAN

http://search.cpan.org/dist/Slackware-Slackget

ACKNOWLEDGEMENTS

Top

Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.

SEE ALSO

Top

COPYRIGHT & LICENSE

Top


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.