lib::tiny - use lib, without having to use memory by loading Config
This document describes lib::tiny version 0.6
use lib::tiny @list; no lib::tiny @list;
This module simply adds and removes the given (existant on add) paths as-is to/from @INC in the same manner as lib but in a '::Tiny' manner.
The idea is this: lib.pm has to load the entire %Config and only uses 3 small variables from it.
As far as I can tell Config still gets use()d in lib even if perl was compiled with PERL_BUILD_EXPAND_CONFIG_VARS
Also the assumption is that if you are using this to shave off a bit of memory (appx 200K +/- over 'use lib') then you are probably not interested in the arch/version/inc_version_list alternate paths anyway.
That being the case it doesn't bother with them since it'd require Config and also more memory for File::Spec.
For the same reason we don't have a @lib::tiny::ORIG_INC copy
If you are interested in those things just use lib instead.
Is used when you:
use lib::tiny @list;
no lib::tiny @list;
lib::tiny requires no configuration files or environment variables.
None.
None reported.
No bugs have been reported.
Please report any bugs or feature requests to bug-lib-tiny@rt.cpan.org, or through the web interface at http://rt.cpan.org.
bug-lib-tiny@rt.cpan.org
Here are some quick tests to showing how it uses over 50% less memory than use lib; (at least at this moment on this machine, your mileage may vary obviously)
multivac:~ dmuey$ perl -le 'print `ps u -p $$`;' USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND dmuey 12815 0.0 0.1 601232 1172 s001 S+ 5:07PM 0:00.01 perl -le print `ps u -p $$`; multivac:~ dmuey$ perl -le 'use lib "/tmp";print `ps u -p $$`;' USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND dmuey 12817 2.7 0.1 601232 1544 s001 S+ 5:08PM 0:00.01 perl -le use lib "/tmp";print `ps u -p $$`; multivac:~ dmuey$ perl -le 'use lib::tiny "/tmp";print `ps u -p $$`;' USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND dmuey 12819 0.0 0.1 601232 1360 s001 S+ 5:08PM 0:00.01 perl -le use lib::tiny "/tmp";print `ps u -p $$`; multivac:~ dmuey$ perl -le 'print 1544 - 1172;' 372 multivac:~ dmuey$ perl -le 'print 1360 - 1172;' 188 multivac:~ dmuey$ perl -le 'print ((188/372)*100);' 50.5376344086022 multivac:~ dmuey$
If there is great demand we may:
or at least a mechanism to pass the data and have it done?
To Adam Kennedy for the helpful feedback to make this module actually fit in the '::Tiny' spec.
Daniel Muey <http://drmuey.com/cpan_contact.pl>
<http://drmuey.com/cpan_contact.pl>
Copyright (c) 2008, Daniel Muey <http://drmuey.com/cpan_contact.pl>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
To install lib::tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm lib::tiny
CPAN shell
perl -MCPAN -e shell install lib::tiny
For more information on module installation, please visit the detailed CPAN module installation guide.