Nile::Var - Application Shared variables.
# get a reference to the the shared var object $var = $self->me->var; # set some variables $var->set('email', 'ahmed@mewsoft.com'); $var->set('path', '/var/home/public_html/app'); $var->set('lang', 'en-US'); # auto setters $var->email('ahmed@mewsoft.com'); $var->lang('en-US'); # get some variables $mail = $var->get('email'); $path = $var->get('path'); $lang = $var->get('lang'); # auto getters $mail = $var->email; $lang = $var->lang; # get variables or default values $value = $var->get('name', 'default'); $path = $var->get('email', 'root@localhost'); # set a list of variables $var->set(%vars); $var->set(fname=>'Ahmed', lname=>'Elsheshtawy', email=>'ahmed@mewsoft.com'); # get a list of variables @values = $var->list(@vars); # get a list of variables names @names = $var->keys; # get a hash reference to the variables $vars = $var->vars; $vars->{path} = '/app/path'; say $vars->{theme}; # check if variables exist $found = $self->exists($name); # delete some vars $self->delete(@vars); # clear all vars $self->clear;
# delete entire xml object data. $xml->clear();
Completely clears all loaded xml data from memory. This does not apply to the file until file is updated or saved.
# get all variables as a hash or a hash ref. %vars = $var->vars(); $vars = $var->vars();
Returns all variables as a hash or a hash reference.
# set variables. $var->set("users_count", $count); $var->set(%vars); # automatic setter support $var->email('ahmed@mewsoft.com'); # same as $var->set('email', 'ahmed@mewsoft.com');
Set shared variables.
# get variables say $var->get("email"); say $var->get("website", "default value"); # automatic getter support say $var->email; # same as $var->get('email');
Returns shared variables.
# get a list of shared variables. @vars = $var->list(@names);
Returns a list of shared variables.
# returns all variables names. @names = $var->keys($);
Returns all shared variables names.
# check if a variable exist or not. $found = $var->exists($name);
Check if a shared variable exist or not.
# delete shared variables. $var->delete(@names);
Delete a list of shared variables.
This project is available on github at https://github.com/mewsoft/Nile.
Please visit the project's homepage at https://metacpan.org/release/Nile.
Source repository is at https://github.com/mewsoft/Nile.
See Nile for details about the complete framework.
Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com
Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Nile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nile
CPAN shell
perl -MCPAN -e shell install Nile
For more information on module installation, please visit the detailed CPAN module installation guide.