Chemistry-Elements-1.081/0000755000076500000240000000000014777037111014232 5ustar brianstaffChemistry-Elements-1.081/LICENSE0000644000076500000240000002174214777037110015244 0ustar brianstaffThe Chemistry::Elements module is licensed under the same terms as perl itself, under the Artistic License 2.0. Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ******** This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions *********** "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution ******************************************************** (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version ****************************************************** (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source ********************************************************** (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified ****************************************************************** Versions without the Source *************************** (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package ********************************** (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version ******************************************************** (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions ****************** (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Chemistry-Elements-1.081/Changes0000644000076500000240000000515414777037110015531 0ustar brianstaffRevision history for Perl module Chemistry::Elements 1.081 2025-04-13T22:44:24Z * require a newer version.pm for v5.10.1 tests 1.079 2025-02-11T15:56:43Z * update error messages to properly interpolate bad args (#17) * update symbol for 105 from proposed Ha to actual Db (#16) 1.078 2025-01-05T11:14:20Z * refresh distro and move to BRIANDFOY 1.077 2024-01-15T21:20:02Z * refresh distro, update email addresses 1.076 2023-01-10T15:33:32Z * remove some internal cruft noted by Gene Boggs. No meaningful changes and no need to update unless you want to. 1.075 2021-10-26T17:12:19Z * Minor fix to Changes file because I had the first two dates in the wrong order * On the repo side, fixed up the GitHub actions to do more testing and to report to Coveralls. It's all changed since last I looked. 1.074 2021-01-15T08:26:43Z * freshen distro, remove Travis CI, add Github Actions 1.073 2018-05-22T13:57:23Z * Change to Artistic License 2.0. 1.072 2017-08-06T06:08:52Z * Update the new heavy element symbols. 1.071 2016-12-30T20:11:12Z * Version adjustment to be greater than what's on CPAN 1.065 2016-12-24T18:07:06Z * Add the rest of the Japanese element names 1.064 2016-12-24T17:24:18Z * Ben Bullock adds Japanese element names and fixes some sloppy typing while he's in there. 1.063 2016-12-24T03:46:31Z * New names for 113, 115, 117, and 118 https://iupac.org/iupac-announces-the-names-of-the-elements-113-115-117-and-118/ 1.062 2016-01-12T19:38:47Z * Fix the GitHub reference 1.061 2016-01-12T19:28:38Z * Add the latest chemical elements. We're up to 118 now. * http://periodic.lanl.gov/index.shtml 1.06 - 2008-08-31 * Bump to a release version. There are no changes since the last development version. 1.05_02 - 2008-08-29 * Fix some element name typoes * All of this is now in github https://github.com/briandfoy/chemistry-elements.git 1.05_01 - 2008-06-28 * Adding multi-language support * This is a test version for the new tests and the big move 1.05 - 2007-11-09 * cleanups for the move from CVS to SVN, and latest kwalitee * no need to upgrade 1.04 - 2007-07-30 * Updated distro to use new subversion repo, and for kwalitee 1.03 - 2007-01-09 * updated copyright and license info * no code changes, so no need to upgrade 1.01 - 2005-05-24 * Fixed up the distro to have tests and more documentation * Added license info: this package is under the same terms as Perl itself 0.97.1102 - 1997-11-02 * gutsy enough to actually release it for testing and comments * working on a German version to be released RSN (just need a free hour) 0.97.1018 - 1997-10-19 * original version; created by h2xs 1.18 Chemistry-Elements-1.081/MANIFEST0000644000076500000240000000141614777037111015365 0ustar brianstaffChanges examples/chart_test examples/README INSTALL.SKIP languages/cz-el.txt languages/de-el.txt languages/es-el.txt languages/fr-el.txt languages/it-el.txt languages/nl-el.txt languages/sv-el.txt lib/Chemistry/Elements.pm LICENSE Makefile.PL MANIFEST MANIFEST.SKIP README.pod SECURITY.md t/_get_name_by_symbol.t t/_get_name_by_Z.t t/_get_symbol_by_name.t t/_get_symbol_by_Z.t t/_get_Z_by_name.t t/_get_Z_by_symbol.t t/_is_name.t t/_is_symbol.t t/_is_Z.t t/autoload.t t/can.t t/compile.t t/get_name.t t/get_symbol.t t/get_Z.t t/name.t t/new.t t/pod.t t/pod_coverage.t t/symbol.t t/test_manifest t/Z.t xt/changes.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Chemistry-Elements-1.081/t/0000755000076500000240000000000014777037111014475 5ustar brianstaffChemistry-Elements-1.081/t/pod.t0000644000076500000240000000020114777037110015434 0ustar brianstaffuse Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Chemistry-Elements-1.081/t/_get_Z_by_symbol.t0000644000076500000240000000136514777037110020154 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_get_Z_by_symbol'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); is( _get_Z_by_symbol('Po'), 84, "Got right Z for Po" ); is( _get_Z_by_symbol('Pb'), 82, "Got right Z for Pb" ); is( _get_Z_by_symbol('Ne'), 10, "Got right Z for Ne" ); is( _get_Z_by_symbol('La'), 57, "Got right Z for La" ); is( _get_Z_by_symbol('H'), 1, "Got right Z for H" ); ok( ! _get_Z_by_symbol( '' ), "empty string isn't a symbol" ); ok( ! _get_Z_by_symbol( undef ), "undef isn't a symbol" ); ok( ! _get_Z_by_symbol( 'Foo' ), "Foo isn't a symbol" ); ok( ! _get_Z_by_symbol( '86' ), "86 isn't a symbol" ); Chemistry-Elements-1.081/t/autoload.t0000644000076500000240000000116414777037110016473 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = 'get_symbol'; use_ok( $class, $sub ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Object interface with something that works { my $element = $class->new( 'Erbium' ); isa_ok( $element, $class ); is( $element->Z, 68 ); is( $element->name, 'Erbium' ); is( $element->symbol, 'Er' ); ok( $element->molar_mass( 167.26 ), 'Set molar mass for Er' ); ok( $element->can( 'molar_mass' ), "Now I can call molar_mass" ); is( $element->molar_mass, 167.26, 'Got back same value for molar mass' ); } Chemistry-Elements-1.081/t/get_symbol.t0000644000076500000240000000313214777037110017024 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = 'get_symbol'; use_ok( $class, $sub ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Object interface { my $element = $class->new( 'Erbium' ); isa_ok( $element, $class ); ok( ! $element->can( $sub ), "can() says $sub is not there (good)" ); eval { $element->get_Z }; ok( defined $@, "Calling $sub as object method fails (good)" ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Functional interface { ok( defined &get_symbol, "$sub is in the current namespace" ); is( get_symbol( 'Plutonium' ), 'Pu', 'Got the right symbol for Plutonium (English)' ); is( get_symbol( 'Lutoniumpai' ), 'Pu', 'Got the right symbol for Lutoniumpai (Pig Latin)' ); is( get_symbol( 18 ), 'Ar', 'Got the right symbol for 18' ); is( get_symbol( 'Rh' ), 'Rh', 'Got the right symbol for Rh' ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Functional interface, stuff that shouldn't work { is( get_symbol( -1 ), undef, 'Got undef for -1' ); is( get_symbol( 0 ), undef, 'Got undef for 0' ); is( get_symbol( ), undef, 'Got undef for no args' ); is( get_symbol( undef ), undef, 'Got undef for undef' ); is( get_symbol( '' ), undef, 'Got undef for empty string' ); is( get_symbol( 'Unh' ), undef, 'Got undef for Unh' ); is( get_symbol( 'Foo' ), undef, 'Got undef for Foo' ); is( get_symbol( 82.1 ), undef, 'Got undef for 82.0' ); }Chemistry-Elements-1.081/t/name.t0000644000076500000240000000275214777037110015607 0ustar brianstaff#!/usr/bin/perl #!/usr/bin/perl use Test::More; my $class = 'Chemistry::Elements'; my $method = 'name'; my @methods = qw(Z symbol name error); subtest 'sanity' => sub { use_ok $class; ok defined &{"${class}::can"}, "$class defines its own can"; }; subtest 'new object' => sub { my $symbol = 'U'; my $element = $class->new( $symbol ); isa_ok $element, $class ; ok $element->can($method), "Object can call the $method method"; can_ok $element, @methods; subtest 'read values' => sub { is $element->Z, 92, "Got right Z for $symbol"; is $element->symbol, $symbol, "Got right symbol for $symbol"; is $element->$method(), 'Uranium', "Got right name for $symbol (Default)"; }; subtest 'change element' => sub { my $symbol = 'Pu'; is $element->Z(94), 94, "Got right Z for $symbol after U decay"; is $element->symbol, $symbol, "Got right symbol for $symbol"; is $element->$method(), 'Plutonium', "Got right name for $symbol (Default)"; }; subtest 'change to nonsense' => sub { my @table = ( [ qw(Te symbol) ], [ '', 'empty string' ], [ undef, 'undef' ], [ 0, 'number' ], [ 200, 'number' ], [ -1, 'number' ], ); foreach my $row ( @table ) { my( $arg, $label ) = @$row; subtest $label => sub { ok ! $element->$method($arg), "Could not change name to $label"; like $element->error, qr/\Q$arg\E is not a valid element name/, "error notes invalid argument"; }; } }; }; done_testing(); Chemistry-Elements-1.081/t/_get_name_by_symbol.t0000644000076500000240000000343314777037110020661 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_get_name_by_symbol'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work, default language is( _get_name_by_symbol( 'F' ), 'Fluorine', "Get right name for F (Default)" ); is( _get_name_by_symbol( 'Ar' ), 'Argon', "Get right name for Ar (Default)" ); is( _get_name_by_symbol( 'Xe' ), 'Xenon', "Get right name for Xe (Default)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work, English is( _get_name_by_symbol( 'F', $Languages{'English'} ), 'Fluorine', "Get right name for F (English)" ); is( _get_name_by_symbol( 'Ar', $Languages{'English'} ), 'Argon', "Get right name for Ar (English)" ); is( _get_name_by_symbol( 'Xe', $Languages{'English'} ), 'Xenon', "Get right name for Xe (English)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work, Pig Latin is( _get_name_by_symbol( 'F', $Languages{'Pig Latin'} ), 'Luorinefai', "Get right name for F (Pig Latin)" ); is( _get_name_by_symbol( 'Ar', $Languages{'Pig Latin'} ), 'Rgonaai', "Get right name for Ar (Pig Latin)" ); is( _get_name_by_symbol( 'Xe', $Languages{'Pig Latin'} ), 'Enonxai', "Get right name for Xe (Pig Latin)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that shouldn't work ok( ! defined _get_name_by_symbol( '' ), "No symbol from empty string" ); ok( ! defined _get_name_by_symbol( undef ), "No name from undef" ); ok( ! defined _get_name_by_symbol( ), "No name from no args" ); ok( ! defined _get_name_by_symbol( 0 ), "No name from 0" ); Chemistry-Elements-1.081/t/symbol.t0000644000076500000240000000601714777037110016172 0ustar brianstaff#!/usr/bin/perl use Test::More; my $class = 'Chemistry::Elements'; my $method = 'symbol'; my @methods = qw(Z symbol name error); subtest 'sanity' => sub { use_ok $class; ok defined &{"${class}::can"}, "$class defines its own can"; }; subtest 'new object' => sub { my $symbol = 'U'; my $element = $class->new( $symbol ); isa_ok $element, $class ; ok $element->can($method), "Object can call the $method method"; can_ok $element, @methods; subtest 'read values' => sub { is $element->Z(), 92, "Got right Z for $symbol"; is $element->$method(), $symbol, "Got right symbol for $symbol"; is $element->name, 'Uranium', "Got right name for $symbol (Default)"; }; subtest 'change element' => sub { my $symbol = 'Pu'; is $element->Z(94), 94, "Got right Z for $symbol after U decay"; is $element->$method(), $symbol, "Got right symbol for $symbol"; is $element->name, 'Plutonium', "Got right name for $symbol (Default)"; }; subtest 'change to nonsense' => sub { my @table = ( [ qw(Technetium name) ], [ '', 'empty string' ], [ undef, 'undef' ], [ 0, 'number' ], [ 200, 'number' ], [ -1, 'number' ], ); foreach my $row ( @table ) { my( $arg, $label ) = @$row; subtest $label => sub { ok ! $element->$method($arg), "Could not change symbol to $label"; like $element->error, qr/\Q$arg\E is not a valid element symbol/, "error notes invalid argument"; }; } }; }; done_testing(); __END__ use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; use_ok( $class ); ok( defined &{"${class}::can"}, "$class defines its own can" ); my $element = $class->new( 'U' ); isa_ok( $element, $class ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # try something that should return true ok( $element->can('symbol'), 'Object can call the symbol method' ); is( $element->Z, 92, "Got right Z for U" ); is( $element->symbol, 'U', "Got right symbol for U" ); is( $element->name, 'Uranium', "Got right name for U (Default)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Change the name to something that will work is( $element->symbol('Pu'), 'Pu', "Got right name for Pu after U decay" ); is( $element->name, 'Plutonium', "Got right name for Pu" ); is( $element->Z, 94, "Got right Z for Pu (Default)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Change the name to something that won't work ok( ! $element->symbol(''), "Can't change name to empty string" ); ok( ! $element->symbol(undef), "Can't change name to undef" ); ok( ! $element->symbol(0), "Can't change name to 0" ); ok( ! $element->symbol(-1), "Can't change name to -1" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This should still be the same element is( $element->name, 'Plutonium', "Got right name for Pu after U decay" ); is( $element->symbol, 'Pu', "Got right symbol for Pu" ); is( $element->Z, 94, "Got right name for Pu (Default)" ); Chemistry-Elements-1.081/t/_is_name.t0000644000076500000240000000102614777037110016432 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_is_name'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); ok( _is_name( 'Oxygen' ), "Oxygen is a name" ); ok( _is_name( 'Xygenoai' ), "Xygenoai is a name" ); ok( ! _is_name( '' ), "empty string isn't a name" ); ok( ! _is_name( undef ), "undef isn't a name" ); ok( ! _is_name( 'Foo' ), "Foo isn't a name" ); ok( ! _is_name( 'Po' ), "Po isn't a name" ); Chemistry-Elements-1.081/t/Z.t0000644000076500000240000000277114777037110015101 0ustar brianstaff#!/usr/bin/perl use Test::More; my $class = 'Chemistry::Elements'; my $method = 'Z'; my @methods = qw(Z symbol name error); subtest 'sanity' => sub { use_ok $class; ok defined &{"${class}::can"}, "$class defines its own can"; }; subtest 'new object' => sub { my $symbol = 'U'; my $element = $class->new( $symbol ); isa_ok $element, $class ; ok $element->can($method), "Object can call the $method method"; can_ok $element, @methods; subtest 'read values' => sub { is $element->$method(), 92, "Got right Z for $symbol"; is $element->symbol, $symbol, "Got right symbol for $symbol"; is $element->name, 'Uranium', "Got right name for $symbol (Default)"; }; subtest 'change element' => sub { my $symbol = 'Pu'; is $element->$method(94), 94, "Got right Z for $symbol after U decay"; is $element->symbol, $symbol, "Got right symbol for $symbol"; is $element->name, 'Plutonium', "Got right name for $symbol (Default)"; }; subtest 'change to nonsense' => sub { my @table = ( [ qw(Pa symbol) ], [ qw(Technetium name) ], [ '', 'empty string' ], [ undef, 'undef' ], [ 0, 'out of range (0)' ], [ 200, 'out of range (200)' ], [ -1, 'out of range (-1)' ], ); foreach my $row ( @table ) { my( $arg, $label ) = @$row; subtest $label => sub { ok ! $element->$method($arg), "Could not change Z to $label"; like $element->error, qr/\Q$arg\E is not a valid proton/, "error notes invalid argument"; }; } }; }; done_testing(); Chemistry-Elements-1.081/t/new.t0000644000076500000240000000265714777037110015464 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = 'get_symbol'; use_ok( $class, $sub ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Object interface with something that works { my $element = $class->new( 'Erbium' ); isa_ok( $element, $class ); is( $element->Z, 68 ); is( $element->name, 'Erbium' ); is( $element->symbol, 'Er' ); } { my $element = $class->new( 'Er' ); isa_ok( $element, $class ); is( $element->Z, 68 ); is( $element->name, 'Erbium' ); is( $element->symbol, 'Er' ); } { my $element = $class->new( 68 ); isa_ok( $element, $class ); is( $element->Z, 68 ); is( $element->name, 'Erbium' ); is( $element->symbol, 'Er' ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Object interface with something that doesn't work { my $element = $class->new( 'Administrativium' ); ok( ! defined $element, "Can't make a fake element" ); } { my $element = $class->new( ); ok( ! defined $element, "Can't make a fake element" ); } { my $element = $class->new( undef ); ok( ! defined $element, "Can't make a fake element" ); } { my $element = $class->new( '' ); ok( ! defined $element, "Can't make a fake element" ); } { my $element = $class->new( 0 ); ok( ! defined $element, "Can't make a fake element" ); } { my $element = $class->new( -1 ); ok( ! defined $element, "Can't make a fake element" ); } Chemistry-Elements-1.081/t/can.t0000644000076500000240000000165514777037110015431 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; use_ok( $class ); ok( defined &{"${class}::can"}, "$class defines its own can" ); my $object = $class->new( 'U' ); isa_ok( $object, $class ); # try something that should return true ok( $object->can('Z'), 'Object can call the Z method' ); # try something that is a defined sub but should return false ok( ! $object->can('get_Z'), 'Object can call the Z method' ); # try something that is not a defined sub (and should return false) ok( ! $object->can('not_there'), 'Object can call the Z method' ); # try it as a class method, which should fail ok( ! defined $class->can('Z'), "Can't call Z as a class method" ); ok( ! defined $class->can('name'), "Can't call Z as a class method" ); # try is as a class method, when it should work ok( $class->can('isa'), "Can call isa as a class method" ); ok( $class->can('can'), "Can call can as a class method" ); Chemistry-Elements-1.081/t/_get_Z_by_name.t0000644000076500000240000000146714777037110017572 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_get_Z_by_name'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work foreach my $name ( qw( Hydrogen Ydrogenhai ) ) { my $Z = _get_Z_by_name( $name ); is( $Z, 1, "Z for $name is right" ); } foreach my $name ( qw( Oldgai Gold ) ) { my $Z = _get_Z_by_name( $name ); is( $Z, 79, "Z for $name is right" ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that shouldn't work foreach my $name ( qw( Foo Bar Bax ), undef, 0, '', ) { no warnings 'uninitialized'; my $Z = _get_Z_by_name( $name ); is( "$Z", "", "Z for $name is undefined" ); } Chemistry-Elements-1.081/t/_get_name_by_Z.t0000644000076500000240000000316114777037110017563 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; use_ok( $class ); ok( defined &{"${class}::_get_name_by_Z"}, "_get_name_by_Z defined" ); package Chemistry::Elements; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Default language, as English is( _get_name_by_Z(1), 'Hydrogen', 'Works of H in default language' ); is( _get_name_by_Z(6), 'Carbon', 'Works of C in default language' ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Default language, as Pig Latin { local $Default_language; $Default_language = $Languages{'Pig Latin'}; is( _get_name_by_Z(1), 'Ydrogenhai', 'Works of H in changed default language' ); is( _get_name_by_Z(90), 'Horiumtai', 'Works of Th in changed default language' ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Specify language, as English is( _get_name_by_Z( 1, $Languages{'English'} ), 'Hydrogen', 'Works of H in specified language (English)' ); is( _get_name_by_Z( 6, $Languages{'English'} ), 'Carbon', 'Works of C in specified language (English)' ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Specify language, as Pig Latin is( _get_name_by_Z( 1, $Languages{'Pig Latin'} ), 'Ydrogenhai', 'Works of H in specified language (Pig Latin)' ); is( _get_name_by_Z( 82, $Languages{'Pig Latin'} ), 'Eadlai', 'Works of H in specified language (Pig Latin)' ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that shouldn't work is( _get_name_by_Z(undef), undef, 'Fails for undef' ); is( _get_name_by_Z('Foo'), undef, 'Fails for Foo' ); Chemistry-Elements-1.081/t/get_name.t0000644000076500000240000000246414777037110016446 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; use_ok( $class, qw(get_name) ); ok( defined &get_name, "get_name is defined" ); is( get_name( 'H' ), 'Hydrogen' ); is( get_name( 'Hydrogen' ), 'Hydrogen' ); is( get_name( '1' ), 'Hydrogen' ); is( get_name( 'Si', $Languages{'English'} ), 'Silicon' ); is( get_name( 'Silicon', $Languages{'English'} ), 'Silicon' ); is( get_name( '14', $Languages{'English'} ), 'Silicon' ); is( get_name( 'He', $Languages{'Pig Latin'} ), 'Eliumhai' ); is( get_name( 'Helium', $Languages{'Pig Latin'} ), 'Eliumhai' ); is( get_name( '2', $Languages{'Pig Latin'} ), 'Eliumhai' ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Functional interface, stuff that shouldn't work { is( get_name( -1 ), undef, 'Got undef for -1' ); is( get_name( 0 ), undef, 'Got undef for 0' ); is( get_name( ), undef, 'Got undef for no args' ); is( get_name( undef ), undef, 'Got undef for undef' ); is( get_name( '' ), undef, 'Got undef for empty string' ); is( get_name( 'Unh' ), undef, 'Got undef for Unh' ); is( get_name( 'Foo' ), undef, 'Got undef for Foo' ); is( get_name( 82.1 ), undef, 'Got undef for 82.0' ); }Chemistry-Elements-1.081/t/compile.t0000644000076500000240000000030714777037110016311 0ustar brianstaffBEGIN { @classes = qw( Chemistry::Elements ); } use Test::More tests => scalar @classes; foreach my $class ( @classes ) { print "bail out! $class did not compile" unless use_ok( $class ); } Chemistry-Elements-1.081/t/_get_symbol_by_Z.t0000644000076500000240000000156614777037110020157 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_get_symbol_by_Z'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work, default language is( _get_symbol_by_Z( 46 ), 'Pd', "Get right symbol for 46" ); is( _get_symbol_by_Z( 32 ), 'Ge', "Get right symbol for 32" ); is( _get_symbol_by_Z( 61 ), 'Pm', "Get right symbol for 61" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that shouldn't work ok( ! defined _get_symbol_by_Z( '' ), "No symbol from empty string" ); ok( ! defined _get_symbol_by_Z( undef ), "No symbol from undef" ); ok( ! defined _get_symbol_by_Z( ), "No symbol from no args" ); ok( ! defined _get_symbol_by_Z( 0 ), "No symbol from 0" ); Chemistry-Elements-1.081/t/_is_symbol.t0000644000076500000240000000110414777037110017014 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_is_symbol'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); ok( _is_symbol( 'Po' ), "Po is a symbol" ); ok( _is_symbol( 'Sg' ), "Sg is a symbol" ); ok( _is_symbol( 'Db' ), "Db is a symbol" ); ok( ! _is_symbol( '' ), "empty string isn't a symbol" ); ok( ! _is_symbol( undef ), "undef isn't a symbol" ); ok( ! _is_symbol( 'Foo' ), "Foo isn't a symbol" ); ok( ! _is_symbol( '86' ), "Po isn't a symbol" ); Chemistry-Elements-1.081/t/_is_Z.t0000644000076500000240000000106114777037110015722 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_is_Z'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); ok( _is_Z( $_ ), "$_ is a Z" ) for 1 .. 106; ok( ! _is_Z( $_ + 0.1 ), "$_.1 is not a Z" ) for 10 .. 20; ok( ! _is_Z( '' ), "empty string isn't a Z" ); ok( ! _is_Z( undef ), "undef isn't a Z" ); ok( ! _is_Z( 'Foo' ), "Foo isn't a Z" ); ok( ! _is_Z( 'Po' ), "Po isn't a Z" ); ok( ! _is_Z( 0 ), "0 isn't a Z" ); Chemistry-Elements-1.081/t/_get_symbol_by_name.t0000644000076500000240000000225514777037110020662 0ustar brianstaff#!/usr/bin/perl package Chemistry::Elements; use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; my $sub = '_get_symbol_by_name'; use_ok( $class ); ok( defined &{"${class}::$sub"}, "$sub defined" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that should work is( _get_symbol_by_name( 'Calcium' ), 'Ca', "Get right name for F (English)" ); is( _get_symbol_by_name( 'Magnesium' ), 'Mg', "Get right name for Ar (English)" ); is( _get_symbol_by_name( 'Chlorine' ), 'Cl', "Get right name for Xe (English)" ); is( _get_symbol_by_name( 'Alciumcai' ), 'Ca', "Get right name for F (Pig Latin)" ); is( _get_symbol_by_name( 'Agnesiummai' ), 'Mg', "Get right name for Ar (Pig Latin)" ); is( _get_symbol_by_name( 'Hlorinecai' ), 'Cl', "Get right name for Xe (Pig Latin)" ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Stuff that shouldn't work ok( ! defined _get_symbol_by_name( '' ), "No symbol from empty string" ); ok( ! defined _get_symbol_by_name( undef ), "No name from undef" ); ok( ! defined _get_symbol_by_name( ), "No name from no args" ); ok( ! defined _get_symbol_by_name( 0 ), "No name from 0" ); Chemistry-Elements-1.081/t/get_Z.t0000644000076500000240000000257714777037110015744 0ustar brianstaff#!/usr/bin/perl use Test::More 'no_plan'; my $class = 'Chemistry::Elements'; use_ok( $class, qw( get_Z ) ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Object interface shouldn't work { my $element = $class->new( 'Erbium' ); isa_ok( $element, $class ); ok( ! $element->can( 'get_Z' ), 'can() says get_Z is not there (good)' ); eval { $element->get_Z }; ok( defined $@, "Calling get_Z as object method fails (good)" ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Functional interface, stuff that works { ok( defined &get_Z, "get_Z is in the current namespace" ); is( get_Z( 'Erbium' ), 68, 'Got the right Z for Erbium' ); is( get_Z( 72 ), 72, 'Got the right Z for 72' ); is( get_Z( 'Po' ), 84, 'Got the right Z for Po' ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Functional interface, stuff that shouldn't work { is( get_Z( -1 ), undef, 'Got undef for -1' ); is( get_Z( 0 ), undef, 'Got undef for 0' ); is( get_Z( ), undef, 'Got undef for no args' ); is( get_Z( undef ), undef, 'Got undef for undef' ); is( get_Z( '' ), undef, 'Got undef for empty string' ); is( get_Z( 'Unh' ), undef, 'Got undef for Unh' ); is( get_Z( 'Foo' ), undef, 'Got undef for Foo' ); is( get_Z( 82.1 ), undef, 'Got undef for 82.0' ); }Chemistry-Elements-1.081/t/test_manifest0000644000076500000240000000042114777037110017261 0ustar brianstaffcompile.t pod.t pod_coverage.t can.t _is_Z.t _is_symbol.t _get_Z_by_symbol.t _is_name.t _get_Z_by_name.t _get_Z_by_symbol.t _get_name_by_Z.t _get_name_by_symbol.t _get_symbol_by_Z.t _get_symbol_by_name.t get_Z.t get_name.t get_symbol.t new.t Z.t name.t symbol.t autoload.t Chemistry-Elements-1.081/t/pod_coverage.t0000644000076500000240000000010214777037110017307 0ustar brianstaffuse Test::More tests => 1; eval "use Test::Pod::Coverage"; pass; Chemistry-Elements-1.081/xt/0000755000076500000240000000000014777037111014665 5ustar brianstaffChemistry-Elements-1.081/xt/changes.t0000644000076500000240000000020314777037110016454 0ustar brianstaffuse Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); Chemistry-Elements-1.081/languages/0000755000076500000240000000000014777037111016200 5ustar brianstaffChemistry-Elements-1.081/languages/fr-el.txt0000644000076500000240000000350014777037110017743 0ustar brianstaffFrench FR 1 Hydrogene H 2 Helium He 3 Lithium Li 4 Beryllium Be 5 Bore B 6 Carbone C 7 Azote N 8 Oxygene O 9 Fluor F 10 Neon Ne 11 Sodium Na 12 Magnesium Mg 13 Aluminium Al 14 Silicium Si 15 Phosphore P 16 Soufre S 17 Chlore Cl 18 Argon Ar 19 Potassium K 20 Calcium Ca 21 Scandium Sc 22 Titane Ti 23 Vanadium V 24 Chrome Cr 25 Manganese Mn 26 Fer Fe 27 Cobalt Co 28 Nickel Ni 29 Cuivre Cu 30 Zinc Zn 31 Gallium Ga 32 Germanium Ge 33 Arsenic As 34 Selenium Se 35 Brome Br 36 Krypton Kr 37 Rubidium Rb 38 Strontium Sr 39 Yttrium Y 40 Zirconium Zr 41 Niobium Nb 42 Molybdene Mo 43 Technetium Tc 44 Ruthenium Ru 45 Rhodium Rh 46 Palladium Pd 47 Argent Ag 48 Cadmium Cd 49 Indium In 50 Etain Sn 51 Antimoine Sb 52 Tellure Te 53 Iode I 54 Xenon Xe 55 Cesium Cs 56 Baryum Ba 57 Lanthane La 58 Cerium Ce 59 Praseodyme Pr 60 Neodyme Nd 61 Promethium Pm 62 Samarium Sm 63 Europium Eu 64 Gadolinium Gd 65 Terbium Tb 66 Dysprosium Dy 67 Holmium Ho 68 Erbium Er 69 Thulium Tm 70 Ytterbium Yb 71 Lutecium Lu 72 Hafnium Hf 73 Tantale Ta 74 Tungstene W 75 Rhenium Re 76 Osmium Os 77 Iridium Ir 78 Platine Pt 79 Or Au 80 Mercure Hg 81 Thallium Tl 82 Plomb Pb 83 Bismuth Bi 84 Polonium Po 85 Astate At 86 Radon Rn 87 Francium Fr 88 Radium Ra 89 Actinium Ac 90 Thorium Th 91 Protactinium Pa 92 Uranium U 93 Neptunium Np 94 Plutonium Pu 95 Americium Am 96 Curium Cm 97 Berkelium Bk 98 Californium Cf 99 Einsteinium Es 100 Fermium Fm 101 Mendelevium Md 102 Nobelium No 103 Lawrencium Lr 104 Rutherfordium Rf 105 Dubnium Db 106 Seaborgium Sg 107 Bohrium Bh 108 Hassium Hs 109 Meitnerium Mt 110 Darmstadtium Ds 111 Roentgenium Rg 112 Ununbium Uub 113 Ununtrium Uut 114 Ununquadium Uuq 115 Ununpentium Uup 116 Ununhexium Uuh 117 Ununseptium Uus 118 Ununoctium UuoChemistry-Elements-1.081/languages/sv-el.txt0000644000076500000240000000340414777037110017767 0ustar brianstaffXXX SV 1 Vate H 2 Helium He 3 Litium Li 4 Beryllium Be 5 Bor B 6 Kol C 7 Kvave N 8 Syre O 9 Fluor F 10 Neon Ne 11 Natrium Na 12 Magnesium Mg 13 Aluminium Al 14 Kisel Si 15 Fosfor P 16 Svavel S 17 Klor Cl 18 Argon Ar 19 Kalium K 20 Kalcium Ca 21 Skandium Sc 22 Titan Ti 23 Vanadin V 24 Krom Cr 25 Mangan Mn 26 Jarn Fe 27 Kobolt Co 28 Nickel Ni 29 Koppar Cu 30 Zink Zn 31 Gallium Ga 32 Germanium Ge 33 Arsenik As 34 Selen Se 35 Brom Br 36 Krypton Kr 37 Rubidium Rb 38 Strontium Sr 39 Yttrium Y 40 Zirkonium Zr 41 Niob Nb 42 Molybden Mo 43 Teknetium Tc 44 Rutenium Ru 45 Rodium Rh 46 Palladium Pd 47 Silver Ag 48 Kadmium Cd 49 Indium In 50 Tenn Sn 51 Antimon Sb 52 Tellur Te 53 Jod I 54 Xenon Xe 55 Cesium Cs 56 Barium Ba 57 Lantan La 58 Cerium Ce 59 Praseodym Pr 60 Neodym Nd 61 Prometium Pm 62 Samarium Sm 63 Europium Eu 64 Gadolinium Gd 65 Terbium Tb 66 Dysprosium Dy 67 Holmium Ho 68 Erbium Er 69 Tulium Tm 70 Ytterbium Yb 71 Lutetium Lu 72 Hafnium Hf 73 Tantal Ta 74 Volfram W 75 Rhenium Re 76 Osmium Os 77 Iridium Ir 78 Platina Pt 79 Guld Au 80 Kvicksilver Hg 81 Tallium Tl 82 Bly Pb 83 Vismut Bi 84 Polonium Po 85 Astat At 86 Radon Rn 87 Francium Fr 88 Radium Ra 89 Aktinium Ac 90 Torium Th 91 Protaktinium Pa 92 Uran U 93 Neptunium Np 94 Plutonium Pu 95 Americium Am 96 Curium Cm 97 Berkelium Bk 98 Californium Cf 99 Einsteinium Es 100 Fermium Fm 101 Mendelevium Md 102 Nobelium No 103 Lawrencium Lr 104 Rutherfordium Rf 105 Dubnium Db 106 Seaborgium Sg 107 Bohrium Bh 108 Hassium Hs 109 Meitnerium Mt 110 Darmstadtium Ds 111 Rontgenium Rg 112 Ununbium Uub 113 Ununtrium Uut 114 Ununquadium Uug 115 Ununpentium Uup 116 Ununhexium Uuh 117 Ununseptium Uus 118 Ununoctium Uuo Chemistry-Elements-1.081/languages/nl-el.txt0000644000076500000240000000351014777037110017746 0ustar brianstaffDutch NL 1 Waterstof H 2 Helium He 3 Lithium Li 4 Berillium Be 5 Boor B 6 Koolstof C 7 Stikstof N 8 Zuurstof O 9 Fluor F 10 Neon Ne 11 Natrium Na 12 Magnesium Mg 13 Aluminium Al 14 Silicium Si 15 Fosfor P 16 Zwavel S 17 Chloor Cl 18 Argon Ar 19 Kalium K 20 Calcium Ca 21 Scandium Sc 22 Titanium Ti 23 Vanadium V 24 Chroom Cr 25 Mangaan Mn 26 IJzer Fe 27 Kobalt Co 28 Nikkel Ni 29 Koper Cu 30 Zink Zn 31 Gallium Ga 32 Germanium Ge 33 Arsenicum As 34 Seleen Se 35 Broom Br 36 Krypton Kr 37 Rubidium Rb 38 Strontium Sr 39 Yttrium Y 40 Zirkonium Zr 41 Niobium Nb 42 Molybdeen Mo 43 Technetium Tc 44 Ruthenium Ru 45 Rhodium Rh 46 Palladium Pd 47 Zilver Ag 48 Cadmium Cd 49 Indium In 50 Tin Sn 51 Antimonium Sb 52 Telluur Te 53 Jodium I 54 Xenon Xe 55 Cesium Cs 56 Barium Ba 57 Lanthanium La 58 Cerium Ce 59 Praseodymium Pr 60 Neodymium Nd 61 Promethium Pm 62 Samarium Sm 63 Europium Eu 64 Gadolinium Gd 65 Terbium Tb 66 Dysprosium Dy 67 Holmium Ho 68 Erbium Er 69 Thulium Tm 70 Ytterbium Yb 71 Lutetium Lu 72 Hafnium Hf 73 Tantalium Ta 74 Wolfraam W 75 Renium Re 76 Osmium Os 77 Iridium Ir 78 Platina Pt 79 Goud Au 80 Kwik Hg 81 Thallium Tl 82 Lood Pb 83 Bismut Bi 84 Polonium Po 85 Astatium At 86 Radon Rn 87 Francium Fr 88 Radium Ra 89 Actinium Ac 90 Thorium Th 91 Protactinium Pa 92 Uranium U 93 Neptunium Np 94 Plutonium Pu 95 Americium Am 96 Curium Cm 97 Berkelium Bk 98 Californium Cf 99 Einsteinium Es 100 Fermium Fm 101 Mendelevium Md 102 Nobelium No 103 Lawrencium Lr 104 Rutherfordium Rf 105 Dubnium Db 106 Seaborgium Sg 107 Bohrium Bh 108 Hassium Hs 109 Meitnerium Mt 110 Darmstadtium Ds 111 Roentgenium Rg 112 Ununbium Uub 113 Ununtrium Uut 114 Ununquadium Uug 115 Ununpentium Uup 116 Ununhexium Uuh 117 Ununseptium Uus 118 Ununoctium Uuo Chemistry-Elements-1.081/languages/cz-el.txt0000644000076500000240000000337714777037110017764 0ustar brianstaffChech CZ 1 Vodik H 2 Helium He 3 Lithium Li 4 Beryllium Be 5 Bor B 6 Uhlik C 7 Dusik N 8 Kyslik O 9 Fluor F 10 Neon Ne 11 Sodik Na 12 Horcik Mg 13 Hlinik Al 14 Kremik Si 15 Fosfor P 16 Sira S 17 Chlor Cl 18 Argon Ar 19 Draslik K 20 Vapnik Ca 21 Skandium Sc 22 Titan Ti 23 Vanad V 24 Chrom Cr 25 Mangan Mn 26 Zelezo Fe 27 Kobalt Co 28 Nikl Ni 29 Med Cu 30 Zinek Zn 31 Gallium Ga 32 Germanium Ge 33 Arsen As 34 Selen Se 35 Brom Br 36 Krypton Kr 37 Rubidium Rb 38 Stroncium Sr 39 Yttrium Y 40 Zirkonium Zr 41 Niob Nb 42 Molybden Mo 43 Technecium Tc 44 Ruthenium Ru 45 Rhodium Rh 46 Palladium Pd 47 Stribro Ag 48 Kadmium Cd 49 Indium In 50 Cin Sn 51 Antimon Sb 52 Tellur Te 53 Jod I 54 Xenon Xe 55 Cesium Cs 56 Baryum Ba 57 Lanthan La 58 Cer Ce 59 Praseodym Pr 60 Neodym Nd 61 Promethium Pm 62 Samarium Sm 63 Europium Eu 64 Gadolinium Gd 65 Terbium Tb 66 Dysprosium Dy 67 Holmium Ho 68 Erbium Er 69 Thulium Tm 70 Ytterbium Yb 71 Lutecium Lu 72 Hafnium Hf 73 Tantal Ta 74 Wolfram W 75 Rhenium Re 76 Osmium Os 77 Iridium Ir 78 Platina Pt 79 Zlato Au 80 Rtut Hg 81 Thallium Tl 82 Olovo Pb 83 Bismut Bi 84 Polonium Po 85 Astat At 86 Radon Rn 87 Francium Fr 88 Radium Ra 89 Aktinium Ac 90 Thorium Th 91 Protaktinium Pa 92 Uran U 93 Neptunium Np 94 Plutonium Pu 95 Americium Am 96 Curium Cm 97 Berkelium Bk 98 Kalifornium Cf 99 Einsteinium Es 100 Fermium Fm 101 Mendelevium Md 102 Nobelium No 103 Lawrencium Lr 104 Rutherfordium Rf 105 Dubnium Db 106 Seaborgium Sg 107 Bohrium Bh 108 Hassium Hs 109 Meitnerium Mt 110 Darmstadtium Ds 111 Roentgenium Rg 112 Ununbium Uub 113 Ununtrium Uut 114 Ununquadium Uuq 115 Ununpentium Uup 116 Ununhexium Uuh 117 Ununseptium Uus 118 Ununoctium UuoChemistry-Elements-1.081/languages/de-el.txt0000644000076500000240000000345714777037110017737 0ustar brianstaffGerman DE 1 Wasserstoff H 2 Helium He 3 Lithium Li 4 Beryllium Be 5 Bor B 6 Kohlenstoff C 7 Stickstoff N 8 Sauerstoff O 9 Fluor F 10 Neon Ne 11 Natrium Na 12 Magnesium Mg 13 Aluminum Al 14 Silizium Si 15 Phosphor P 16 Schwefel S 17 Chlor Cl 18 Argon Ar 19 Kalium K 20 Kalzium Ca 21 Scandium Sc 22 Titan Ti 23 Vanadium V 24 Chrom Cr 25 Mangan Mn 26 Eisen Fe 27 Kobalt Co 28 Nickel Ni 29 Kupfer Cu 30 Zink Zn 31 Gallium Ga 32 Germanium Ge 33 Arsen As 34 Selen Se 35 Brom Br 36 Krypton Kr 37 Rubidium Rb 38 Strontium Sr 39 Yttrium Y 40 Zirkonium Zr 41 Nobium Nb 42 Molybdan Mo 43 Technetium Tc 44 Ruthenium Ru 45 Rhodium Rh 46 Palladium Pd 47 Silber Ag 48 Kadmium Cd 49 Indium In 50 Zinn Sn 51 Antimon Sb 52 Tellur Te 53 Jod I 54 Xenon Xe 55 Casium Cs 56 Barium Ba 57 Lanthan La 58 Cer Ce 59 Praseodym Pr 60 Neodym Nd 61 Promethium Pm 62 Samarium Sm 63 Europium Eu 64 Gadolinium Gd 65 Terbium Tb 66 Dysprosium Dy 67 Holmium Ho 68 Erbium Er 69 Thulium Tm 70 Ytterbium Yb 71 Lutetium Lu 72 Hafnium Hf 73 Tantal Ta 74 Wolfram W 75 Rhenium Re 76 Osmium Os 77 Iridium Ir 78 Platin Pt 79 Gold Au 80 Quecksilber Hg 81 Thallium Tl 82 Blei Pb 83 Wismut Bi 84 Polonium Po 85 Astat At 86 Radon Rn 87 Franzium Fr 88 Radium Ra 89 Aktinium Ac 90 Thorium Th 91 Protactinium Pa 92 Uran U 93 Neptunium Np 94 Plutonium Pu 95 Amerikium Am 96 Curium Cm 97 Berkelium Bk 98 Kalifornium Cf 99 Einsteinium Es 100 Fermium Fm 101 Mendelevium Md 102 Nobelium No 103 Lawrencium Lr 104 Rutherfordium Rf 105 Dubnium Db 106 Seaborgium Sg 107 Bohrium Bh 108 Hassium Hs 109 Meitnerium Mt 110 Darmstadtium Ds 111 Rontgenium Rg 112 Ununbium Uub 113 Ununtrium Uut 114 Ununquadium Uuq 115 Ununpentium Uup 116 Ununhexium Uuh 117 Ununseptium Uus 118 Ununoctium UuoChemistry-Elements-1.081/languages/es-el.txt0000644000076500000240000000335714777037110017755 0ustar brianstaffSpanish ES 1 Hidrogeno H 2 Helio He 3 Litio Li 4 Berilio Be 5 Boro B 6 Carbono C 7 Nitrogeno N 8 Oxigeno O 9 Fluor F 10 Neon Ne 11 Sodio Na 12 Magnesio Mg 13 Aluminio Al 14 Silicio Si 15 Fosforo P 16 Azufre S 17 Cloro Cl 18 Argon Ar 19 Potasio K 20 Calcio Ca 21 Escandio Sc 22 Titanio Ti 23 Vanadio V 24 Cromo Cr 25 Manganeso Mn 26 Hierro Fe 27 Cobalto Co 28 Niquel Ni 29 Cobre Cu 30 Zinc Zn 31 Galio Ga 32 Germanio Ge 33 Arsenico As 34 Selenio Se 35 Bromo Br 36 Kripton Kr 37 Rubidio Rb 38 Estroncio Sr 39 Itrio Y 40 Circonio Zr 41 Niobio Nb 42 Molibdeno Mo 43 Tecnecio Tc 44 Rutenio Ru 45 Rodio Rh 46 Paladio Pd 47 Plata Ag 48 Cadmio Cd 49 Indio In 50 Estano Sn 51 Antimonio Sb 52 Telurio Te 53 Yodo I 54 Xenon Xe 55 Cesio Cs 56 Bario Ba 57 Lantano La 58 Cerio Ce 59 Praseodimio Pr 60 Neodimio Nd 61 Prometio Pm 62 Samario Sm 63 Europio Eu 64 Gadolinio Gd 65 Terbio Tb 66 Disprosio Dy 67 Holmio Ho 68 Erbio Er 69 Tulio Tm 70 Iterbio Yb 71 Lutecio Lu 72 Hafnio Hf 73 Tantalio Ta 74 Wolframio W 75 Renio Re 76 Osmio Os 77 Iridio Ir 78 Platino Pt 79 Oro Au 80 Mercurio Hg 81 Talio Tl 82 Plomo Pb 83 Bismuto Bi 84 Polonio Po 85 Astato At 86 Radon Rn 87 Francio Fr 88 Radio Ra 89 Actinio Ac 90 Torio Th 91 Protactinio Pa 92 Uranio U 93 Neptunio Np 94 Plutonio Pu 95 Americio Am 96 Curio Cm 97 Berkelio Bk 98 Californio Cf 99 Einsteinio Es 100 Fermio Fm 101 Mendelevio Md 102 Nobelio No 103 Lawrencio Lr 104 Rutherfordio Rf 105 Dubnio Db 106 Seaborgio Sg 107 Bohrio Bh 108 Hassio Hs 109 Meitnerio Mt 110 Darmstadtio Ds 111 Roentgenio Rg 112 Ununbio Uub 113 Ununtrio Uut 114 Ununquadio Uug 115 Ununpentio Uup 116 Ununhexio Uuh 117 Ununseptio Uus 118 Ununoctio UuoChemistry-Elements-1.081/languages/it-el.txt0000644000076500000240000000336414777037110017760 0ustar brianstaffItalian IT 1 Idrogeno H 2 Elio He 3 Litio Li 4 Berillio Be 5 Boro B 6 Carbonio C 7 Azoto N 8 Ossigeno O 9 Fluoro F 10 Neon Ne 11 Sodio Na 12 Magnesio Mg 13 Alluminio Al 14 Silicio Si 15 Fosforo P 16 Zolfo S 17 Cloro Cl 18 Argon Ar 19 Potassio K 20 Calcio Ca 21 Scandio Sc 22 Titanio Ti 23 Vanadio V 24 Cromo Cr 25 Manganese Mn 26 Ferro Fe 27 Cobalto Co 28 Nichel Ni 29 Rame Cu 30 Zinco Zn 31 Gallio Ga 32 Germanio Ge 33 Arsenico As 34 Selenio Se 35 Bromo Br 36 Kripton Kr 37 Rubidio Rb 38 Stronzio Sr 39 Ittrio Y 40 Zirconio Zr 41 Niobio Nb 42 Molibdeno Mo 43 Tecnezio Tc 44 Rutenio Ru 45 Rodio Rh 46 Palladio Pd 47 Argento Ag 48 Cadmio Cd 49 Indio In 50 Stagno Sn 51 Antimonio Sb 52 Tellurio Te 53 Iodio I 54 Xeno Xe 55 Cesio Cs 56 Bario Ba 57 Lantanio La 58 Cerio Ce 59 Praseodimio Pr 60 Neodimio Nd 61 Promezio Pm 62 Samario Sm 63 Europio Eu 64 Gadolinio Gd 65 Terbio Tb 66 Disprosio Dy 67 Olmio Ho 68 Erbio Er 69 Tulio Tm 70 Itterbio Yb 71 Lutezio Lu 72 Afnio Hf 73 Tantalio Ta 74 Tungsteno W 75 Renio Re 76 Osmio Os 77 Iridio Ir 78 Platino Pt 79 Oro Au 80 Mercurio Hg 81 Tallio Tl 82 Piombo Pb 83 Bismuto Bi 84 Polonio Po 85 Astato At 86 Radon Rn 87 Francio Fr 88 Radio Ra 89 Attinio Ac 90 Torio Th 91 Protoattinio Pa 92 Uranio U 93 Nettunio Np 94 Plutonio Pu 95 Americio Am 96 Curio Cm 97 Berkelio Bk 98 Californio Cf 99 Einsteinio Es 100 Fermio Fm 101 Mendelevio Md 102 Nobelio No 103 Laurenzio Lr 104 Rutherfordio Rf 105 Dubnio Db 106 Seaborgio Sg 107 Bohrio Bh 108 Hassio Hs 109 Meitnerio Mt 110 Darmstadtio Ds 111 Roentgenio Rg 112 Ununbio Uub 113 Ununtrio Uut 114 Ununquadio Uuq 115 Ununpentio Uup 116 Ununhexio Uuh 117 Ununseptio Uus 118 Ununoctio UuoChemistry-Elements-1.081/README.pod0000644000076500000240000001161314777037110015674 0ustar brianstaff=pod =encoding utf8 =for HTML =for HTML =for HTML =for HTML =for HTML Coverage Status =for HTML =for HTML =head1 The Chemistry::Elements module This is the I for the L Perl module. You're probably looking at this because you don't know where else to find what you're looking for. Read this once and you might never have to read one again for any Perl module. =head2 Documentation To read about L, look at the embedded documentation in the module itself. Inside the distribution, you can format it with L: % perldoc lib/Chemistry/Elements.pm If you have already installed the module, you can specify the module name instead of the file location: % perldoc Chemistry::Elements You can read the documentation and inspect the meta data on L. The standard module documentation has example uses in the SYNOPSIS section, but you can also look in the I directory (if it's there), or look at the test files in I. =head2 Installation You can install this module with a CPAN client, which will resolve and install the dependencies: % cpan Chemistry::Elements % cpanm Chemistry::Elements You can also install directly from the distribution directory, which will also install the dependencies: % cpan . % cpanm . You could install just this module manually: % perl Makefile.PL % make % make test % make install You probably don't want to do that unless you're fiddling with the module and only want to run the tests without installing anything. =head2 Source location The meta data, such as the source repository and bug tracker, is in I or the I files it creates. You can find that on those CPAN web interfaces, but you can also look at files directly in the source repository: L If you find a problem, file a ticket in the L. There are also backup repositories hosted on other services. These reflect the state of the main repo and exist only for redundancy: =over 4 =item * L =item * L =item * L =back =head2 GitHub Attestations This distribution now uses L, which allow you to verify that the archive file you have was made from the official repo. You need a GitHub account and the L. # download the distro file from GitHub, MetaCPAN, or a CPAN mirror $ gh auth login ...follow instructions... $ gh attestation verify Chemistry-Elements-1.23.tar.gz --owner briandfoy =head2 Getting help Although I'm happy to hear from module users in private email, that's the best way for me to forget to do something. Besides the issue trackers, you can find help at L or L, both of which have many competent Perlers who can answer your question, almost in real time. They might not know the particulars of this module, but they can help you diagnose your problem. You might like to read L. =head2 Copyright and License You should have received a I file, but the license is also noted in the module files. About the only thing you can't do is pretend that you wrote code that you didn't. =head2 Good luck! Enjoy, brian d foy, briandfoy@pobox.com =cut Chemistry-Elements-1.081/MANIFEST.SKIP0000644000076500000240000000211014777037110016121 0ustar brianstaff #!start included /usr/local/perls/perl-5.20.0/lib/5.20.0/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /usr/local/perls/perl-5.20.0/lib/5.20.0/ExtUtils/MANIFEST.SKIP \.?appveyor.yml \.releaserc \.lwpcookies \bMANIFEST\s\d \bChanges\s\d \.icloud$ \A\.github\b \.gitattributes\b Chemistry-Elements-1.081/examples/0000755000076500000240000000000014777037111016050 5ustar brianstaffChemistry-Elements-1.081/examples/README0000644000076500000240000000010514777037110016723 0ustar brianstaffSee the tests in the t/ directory for examples until I add some more.Chemistry-Elements-1.081/examples/chart_test0000644000076500000240000000164014777037110020133 0ustar brianstaff#!/usr/bin/perl -w use strict; #This script demostrates the use of the object oriented interface #that the Chemistry::Elements module provides. At the prompt you #can enter a Z, name, or chemical symbol to create an Elements #object. Once you have an object you can define your own methods #through which you associate data with the object. use Chemistry::Elements qw(); print "> "; #you can specify a Z, name, or symbol. #case does not matter since the module should figure it out while( ) { chomp $_; my $obj = new Chemistry::Elements $_; print "no object could be created\n> " unless ref $obj; next unless ref $obj; #accessor methods for the Element object my $Z = $obj->Z; my $name = $obj->name; my $symbol = $obj->symbol; #this is just to demonstrate defining your own method $obj->pretend_method($obj->Z / 3.2); my $MM = $obj->pretend_method; print "$Z,$name,$symbol,$MM\n> "; } Chemistry-Elements-1.081/META.yml0000664000076500000240000000150014777037111015501 0ustar brianstaff--- abstract: 'Perl extension for working with Chemical Elements' author: - 'brian d foy ' build_requires: Test::More: '1' version: '0.86' configure_requires: ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Chemistry-Elements no_index: directory: - t - inc requires: perl: '5.010' resources: bugtracker: https://github.com/briandfoy/chemistry-elements/issues homepage: https://github.com/briandfoy/chemistry-elements repository: https://github.com/briandfoy/chemistry-elements version: '1.081' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Chemistry-Elements-1.081/lib/0000755000076500000240000000000014777037111015000 5ustar brianstaffChemistry-Elements-1.081/lib/Chemistry/0000755000076500000240000000000014777037111016747 5ustar brianstaffChemistry-Elements-1.081/lib/Chemistry/Elements.pm0000644000076500000240000005601314777037110021065 0ustar brianstaffuse v5.10; package Chemistry::Elements; use strict; use warnings; use utf8; no warnings; use Carp qw(croak carp); use Scalar::Util qw(blessed); use vars qw( $AUTOLOAD $debug %names $maximum_Z %names_to_Z $Default_language %Languages ); use Exporter qw(import); our @EXPORT_OK = qw(get_Z get_symbol get_name); our @EXPORT = qw(); our $VERSION = '1.081'; use subs qw( _get_name_by_Z _get_symbol_by_Z _get_name_by_symbol _get_Z_by_symbol _get_symbol_by_name _get_Z_by_name _is_Z _is_name _is_symbol _format_name _format_symbol ); BEGIN { my @class_methods = qw(can isa new); my @object_methods = qw(new Z name symbol can error); my %class_methods = map { $_, 1 } @class_methods; my %object_methods = map { $_, 1 } @object_methods; sub can { my $thingy = shift; my @methods = @_; my $method_hash = blessed $thingy ? \%object_methods : \%class_methods ; foreach my $method ( @methods ) { return unless exists $method_hash->{ $method }; } return 1; } sub _add_object_method { # everyone gets it $object_methods{ $_[1] } = 1; } } $debug = 0; %Languages = ( 'Pig Latin' => 0, 'English' => 1, 'Japanese' => 2, ); $Default_language = $Languages{'English'}; # http://www.ptable.com/?lang=ja %names = ( 1 => [ qw( Ydrogenhai Hydrogen 水素) ], 2 => [ qw( Eliumhai Helium ヘリウム) ], 3 => [ qw( Ithiumlai Lithium リチウム) ], 4 => [ qw( Erylliumbai Beryllium ベリリウム) ], 5 => [ qw( Oronbai Boron ホウ素) ], 6 => [ qw( Arboncai Carbon 炭素) ], 7 => [ qw( Itrogennai Nitrogen 窒素) ], 8 => [ qw( Xygenoai Oxygen 酸素) ], 9 => [ qw( Luorinefai Fluorine フッ素) ], 10 => [ qw( Eonnai Neon ネオン) ], 11 => [ qw( Odiumsai Sodium ナトリウム) ], 12 => [ qw( Agnesiummai Magnesium マグネシウム) ], 13 => [ qw( Luminiumaai Aluminium アルミニウム) ], 14 => [ qw( Iliconsai Silicon ケイ素) ], 15 => [ qw( Hosphoruspai Phosphorus リン) ], 16 => [ qw( Ulfursai Sulfur 硫黄) ], 17 => [ qw( Hlorinecai Chlorine 塩素) ], 18 => [ qw( Rgonaai Argon アルゴン) ], 19 => [ qw( Otassiumpai Potassium カリウム) ], 20 => [ qw( Alciumcai Calcium カルシウム) ], 21 => [ qw( Candiumsai Scandium スカンジウム) ], 22 => [ qw( Itaniumtai Titanium チタン) ], 23 => [ qw( Anadiumvai Vanadium バナジウム) ], 24 => [ qw( Hromiumcai Chromium クロム) ], 25 => [ qw( Anganesemai Manganese マンガン) ], 26 => [ qw( Roniai Iron 鉄) ], 27 => [ qw( Obaltcai Cobalt コバルト) ], 28 => [ qw( Ickelnai Nickel ニッケル) ], 29 => [ qw( Oppercai Copper 銅) ], 30 => [ qw( Inczai Zinc 亜鉛) ], 31 => [ qw( Alliumgai Gallium ガリウム) ], 32 => [ qw( Ermaniumgai Germanium ゲルマニウム) ], 33 => [ qw( Rsenicaai Arsenic ヒ素) ], 34 => [ qw( Eleniumsai Selenium セレン) ], 35 => [ qw( Rominebai Bromine 臭素) ], 36 => [ qw( Ryptonkai Krypton クリプトン) ], 37 => [ qw( Ubidiumrai Rubidium ルビジウム) ], 38 => [ qw( Trontiumsai Strontium ストロンチウム) ], 39 => [ qw( Ttriumyai Yttrium イットリウム) ], 40 => [ qw( Irconiumzai Zirconium ジルコニウム) ], 41 => [ qw( Iobiumnai Niobium ニオブ) ], 42 => [ qw( Olybdenummai Molybdenum モリブデン) ], 43 => [ qw( Echnetiumtai Technetium テクネチウム) ], 44 => [ qw( Utheniumrai Ruthenium ルテニウム) ], 45 => [ qw( Hodiumrai Rhodium ロジウム) ], 46 => [ qw( Alladiumpai Palladium パラジウム) ], 47 => [ qw( Ilversai Silver 銀) ], 48 => [ qw( Admiumcai Cadmium カドミウム) ], 49 => [ qw( Ndiumiai Indium インジウム) ], 50 => [ qw( Intai Tin スズ) ], 51 => [ qw( Ntimonyaai Antimony アンチモン) ], 52 => [ qw( Elluriumtai Tellurium テルル) ], 53 => [ qw( Odineiai Iodine ヨウ素) ], 54 => [ qw( Enonxai Xenon キセノン) ], 55 => [ qw( Esiumcai Cesium セシウム) ], 56 => [ qw( Ariumbai Barium バリウム) ], 57 => [ qw( Anthanumlai Lanthanum ランタン) ], 58 => [ qw( Eriumcai Cerium セリウム) ], 59 => [ qw( Raesodymiumpai Praseodymium プラセオジム) ], 60 => [ qw( Eodymiumnai Neodymium ネオジム) ], 61 => [ qw( Romethiumpai Promethium プロメチウム) ], 62 => [ qw( Amariumsai Samarium サマリウム) ], 63 => [ qw( Uropiumeai Europium ユウロピウム) ], 64 => [ qw( Adoliniumgai Gadolinium ガドリニウム) ], 65 => [ qw( Erbiumtai Terbium テルビウム) ], 66 => [ qw( Ysprosiumdai Dysprosium ジスプロシウム) ], 67 => [ qw( Olmiumhai Holmium ホルミウム) ], 68 => [ qw( Rbiumeai Erbium エルビウム) ], 69 => [ qw( Huliumtai Thulium ツリウム) ], 70 => [ qw( Tterbiumyai Ytterbium イッテルビウム) ], 71 => [ qw( Utetiumlai Lutetium ルテチウム) ], 72 => [ qw( Afniumhai Hafnium ハフニウム) ], 73 => [ qw( Antalumtai Tantalum タンタル) ], 74 => [ qw( Ungstentai Tungsten タングステン) ], 75 => [ qw( Heniumrai Rhenium レニウム) ], 76 => [ qw( Smiumoai Osmium オスミウム) ], 77 => [ qw( Ridiumiai Iridium イリジウム) ], 78 => [ qw( Latinumpai Platinum 白金) ], 79 => [ qw( Oldgai Gold 金) ], 80 => [ qw( Ercurymai Mercury 水銀) ], 81 => [ qw( Halliumtai Thallium タリウム) ], 82 => [ qw( Eadlai Lead 鉛) ], 83 => [ qw( Ismuthbai Bismuth ビスマス) ], 84 => [ qw( Oloniumpai Polonium ポロニウム) ], 85 => [ qw( Statineaai Astatine アスタチン) ], 86 => [ qw( Adonrai Radon ラドン) ], 87 => [ qw( Ranciumfai Francium フランシウム) ], 88 => [ qw( Adiumrai Radium ラジウム) ], 89 => [ qw( Ctiniumaai Actinium アクチニウム) ], 90 => [ qw( Horiumtai Thorium トリウム) ], 91 => [ qw( Rotactiniumpai Protactinium プロトアクチニウム) ], 92 => [ qw( Raniumuai Uranium ウラン) ], 93 => [ qw( Eptuniumnai Neptunium ネプツニウム) ], 94 => [ qw( Lutoniumpai Plutonium プルトニウム) ], 95 => [ qw( Mericiumaai Americium アメリシウム) ], 96 => [ qw( Uriumcai Curium キュリウム) ], 97 => [ qw( Erkeliumbai Berkelium バークリウム) ], 98 => [ qw( Aliforniumcai Californium カリホルニウム) ], 99 => [ qw( Insteiniumeai Einsteinium アインスタイニウム) ], 100 => [ qw( Ermiumfai Fermium フェルミウム) ], 101 => [ qw( Endeleviummai Mendelevium メンデレビウム) ], 102 => [ qw( Obeliumnai Nobelium ノーベリウム) ], 103 => [ qw( Awerenciumlai Lawrencium ローレンシウム) ], 104 => [ qw( Utherfordiumrai Rutherfordium ラザホージウム) ], 105 => [ qw( Ubniumdai Dubnium ドブニウム) ], 106 => [ qw( Eaborgiumsai Seaborgium シーボーギウム) ], 107 => [ qw( Ohriumbai Bohrium ボーリウム) ], 108 => [ qw( Assiumhai Hassium ハッシウム) ], 109 => [ qw( Eitneriummai Meitnerium マイトネリウム) ], 110 => [ qw( Armstadtiumdai Darmstadtium ダームスタチウム) ], 111 => [ qw( Oentgeniumrai Roentgenium レントゲニウム) ], 112 => [ qw( Operniciumcai Copernicium コペルニシウム) ], 113 => [ qw( Ihoniumnai Nihonium ニホニウム) ], 114 => [ qw( Leroviumfai Flerovium フレロビウム) ], 115 => [ qw( Oscoviummai Moscovium モスコビウム) ], 116 => [ qw( Ivermoriumlai Livermorium リバモリウム) ], 117 => [ qw( Ennessinetai Tennessine テネシン) ], 118 => [ qw( Ganessonoai Oganesson オガネソン) ], ); { # There might be duplicates keys here, but it should never come out # with the wrong Z our %names_to_Z = (); foreach my $Z ( keys %names ) { my @names = map { lc } @{ $names{$Z} }; # print STDERR "Got names [@names] for $Z\n"; @names_to_Z{@names} = ($Z) x @names; } #print STDERR Dumper( \%names_to_symbol ); use Data::Dumper; } { my @a = sort {$a <=> $b } keys %names; $maximum_Z = pop @a; } my %elements = map { state $n = 0; $n++; $_ => $n, $n => $_ } qw( H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og ); sub new { my( $class, $data, $language ) = @_; my $self = {}; bless $self, $class; if( _is_Z $data ) { $self->Z($data) } elsif( _is_symbol $data ) { $self->symbol($data) } elsif( _is_name $data ) { $self->name($data) } else { return } return $self; } sub Z { my $self = shift; return $self->{'Z'} unless @_; my $data = shift; unless( _is_Z $data ) { $self->error("$data is not a valid proton number"); return; } $self->{'Z'} = $data; $self->{'name'} = _get_name_by_Z $data; $self->{'symbol'} = _get_symbol_by_Z $data; return $data; } sub name { my $self = shift; return $self->{'name'} unless @_; my $data = shift; unless( _is_name $data ) { $self->error("$data is not a valid element name"); return; } $self->{'name'} = _format_name $data; $self->{'Z'} = _get_Z_by_name $data; $self->{'symbol'} = _get_symbol_by_Z($self->Z); return $data; } sub symbol { my $self = shift; return $self->{'symbol'} unless @_; my $data = shift; unless( _is_symbol $data ) { $self->error("$data is not a valid element symbol"); return; } $self->{'symbol'} = _format_symbol $data; $self->{'Z'} = _get_Z_by_symbol $data; $self->{'name'} = _get_name_by_Z $self->Z; return $data; } sub get_symbol { my $thingy = shift; #since we were asked for a name, we'll suppose that we were passed #either a chemical symbol or a Z. return _get_symbol_by_Z($thingy) if _is_Z $thingy; return _get_symbol_by_name($thingy) if _is_name $thingy; #maybe it's already a symbol... return _format_symbol $thingy if _is_symbol $thingy; #we were passed something wierd. pretend we don't know anything. return; } sub _get_symbol_by_name { my $name = lc shift; return unless _is_name $name; my $Z = $names_to_Z{$name}; $elements{$Z}; } sub _get_symbol_by_Z { return unless _is_Z $_[0]; return $elements{$_[0]}; } sub get_name { my $thingy = shift; my $language = defined $_[0] ? $_[0] : $Default_language; #since we were asked for a name, we'll suppose that we were passed #either a chemical symbol or a Z. return _get_name_by_symbol( $thingy, $language ) if _is_symbol $thingy; return _get_name_by_Z( $thingy, $language ) if _is_Z $thingy; #maybe it's already a name, might have to translate it if( _is_name $thingy ) { my $Z = _get_Z_by_name( $thingy ); return _get_name_by_Z( $Z, $language ); } #we were passed something wierd. pretend we don't know anything. return; } sub _get_name_by_symbol { my $symbol = shift; return unless _is_symbol $symbol; my $language = defined $_[0] ? $_[0] : $Default_language; my $Z = _get_Z_by_symbol($symbol); return _get_name_by_Z( $Z, $language ); } sub _get_name_by_Z { my $Z = shift; my $language = defined $_[0] ? $_[0] : $Default_language; return unless _is_Z $Z; #not much we can do if they don't pass a proper number # XXX: check for language? return $names{$Z}[$language]; } sub get_Z { my $thingy = shift; croak "Can't call get_Z on object. Use Z instead" if ref $thingy; #since we were asked for a name, we'll suppose that we were passed #either a chemical symbol or a Z. return _get_Z_by_symbol( $thingy ) if _is_symbol( $thingy ); return _get_Z_by_name( $thingy ) if _is_name( $thingy ); #maybe it's already a Z return $thingy if _is_Z( $thingy ); return; } # gets the proton number for the name, no matter which language it # is in sub _get_Z_by_name { my $name = lc shift; $names_to_Z{$name}; # language agnostic } sub _get_Z_by_symbol { my $symbol = _format_symbol( shift ); return $elements{$symbol} if exists $elements{$symbol}; return; } ######################################################################## ######################################################################## # # the _is_* functions do some minimal data checking to help other # functions guess what sort of input they received ######################################################################## sub _is_name { exists $names_to_Z{ lc shift } ? 1 : 0 } ######################################################################## sub _is_symbol { my $symbol = _format_symbol( $_[0] ); exists $elements{$symbol} ? 1 : (); } ######################################################################## sub _is_Z { $_[0] =~ /^[123456789]\d*\z/ && exists $elements{$_[0]} } ######################################################################## # _format_symbol # # input: a string that is supoosedly a chemical symbol # output: the string with the first character in uppercase and the # rest lowercase # # there is no data checking involved. this function doens't know # and doesn't care if the data are valid. it just does its thing. sub _format_symbol { $_[0] =~ m/^[a-z]/i && ucfirst lc $_[0] } ######################################################################## # _format_name # # input: a string that is supoosedly a chemical element's name # output: the string with the first character in uppercase and the # rest lowercase # # there is no data checking involved. this function doens't know # and doesn't care if the data are valid. it just does its thing. # # this looks like _format_symbol, but it logically isn't. someday # it might do something different than _format_symbol sub _format_name { my $data = shift; $data =~ s/^(.)(.*)/uc($1).lc($2)/e; return $data; } ######################################################################## sub AUTOLOAD { my $self = shift; my $data = shift; return unless ref $self; my $method_name = $AUTOLOAD; $method_name =~ s/.*:://; if( $data ) { # only add new method if they add data $self->{$method_name} = $data; $self->_add_object_method( $method_name ); } elsif( defined $self->{$method_name} ) { return $self->{$method_name} } else { return } } 1; __END__ =encoding utf8 =head1 NAME Chemistry::Elements - Perl extension for working with Chemical Elements =head1 SYNOPSIS use Chemistry::Elements qw(get_name get_Z get_symbol); # the constructor can use different input $element = Chemistry::Elements->new( $atomic_number ); $element = Chemistry::Elements->new( $chemical_symbol ); $element = Chemistry::Elements->new( $element_name ); # you can make up your own attributes by specifying # a method (which is really AUTOLOAD) $element->molar_mass(22.989) #sets the attribute $MM = $element->molar_mass #retrieves the value =head1 DESCRIPTION There are two parts to the module: the object stuff and the exportable functions for use outside of the object stuff. The exportable functions are discussed in L. Chemistry::Elements provides an easy, object-oriented way to keep track of your chemical data. Using either the atomic number, chemical symbol, or element name you can construct an Element object. Once you have an element object, you can associate your data with the object by making up your own methods, which the AUTOLOAD function handles. Since each chemist is likely to want to use his or her own data, or data for some unforesee-able property, this module does not try to be a repository for chemical data. The Element object constructor tries to be as flexible as possible - pass it an atomic number, chemical symbol, or element name and it tries to create the object. # the constructor can use different input $element = Chemistry::Elements->new( $atomic_number ); $element = Chemistry::Elements->new( $chemical_symbol ); $element = Chemistry::Elements->new( $element_name ); Once you have the object, you can define your own methods simply by using them. Giving the method an argument (others will be ignored) creates an attribute with the method's name and the argument's value. # you can make up your own attributes by specifying # a method (which is really AUTOLOAD) $element->molar_mass(22.989) #sets the attribute $MM = $element->molar_mass #retrieves the value The atomic number, chemical symbol, and element name can be retrieved in the same way. $atomic_number = $element->Z; $name = $element->name; $symbol = $element->symbol; These methods can also be used to set values, although changing any of the three affects the other two. $element = Chemistry::Elements->new('Lead'); $atomic_number = $element->Z; # $atomic_number is 82 $element->Z(79); $name = $element->name; # $name is 'Gold' =head2 Instance methods =over 4 =item new( Z | SYMBOL | NAME ) Create a new instance from either the atomic number, symbol, or element name. =item can( METHOD [, METHOD ... ] ) Returns true if the package or object can respond to METHOD. This distinguishes between class and instance methods. =item Z Return the atomic number of the element. =item name Return the name of the element. =item symbol Return the symbol of the element. =back =head2 Exportable functions These functions can be exported. They are not exported by default. At the moment, only the functional interface supports multi-language names. =over 4 =item get_symbol( NAME|Z ) This function attempts to return the symbol of the chemical element given either the chemical symbol, element name, or atmoic number. The function does its best to interpret inconsistent input data (e.g. chemcial symbols of mixed and single case). use Chemistry::Elements qw(get_symbol); $name = get_symbol('Fe'); #$name is 'Fe' $name = get_symbol('fe'); #$name is 'Fe' $name = get_symbol(26); #$name is 'Fe' $name = get_symbol('Iron'); #$name is 'Fe' $name = get_symbol('iron'); #$name is 'Fe' If no symbol can be found, nothing is returned. Since this function will return the symbol if it is given a symbol, you can use it to test whether a string is a chemical symbol (although you have to play some tricks with case since get_symbol will try its best despite the case of the input data). if( lc($string) eq lc( get_symbol($string) ) ) { #stuff } You can modify the symbols (e.g. you work for UCal ;) ) by changing the data at the end of this module. =item get_name( SYMBOL|NAME|Z [, LANGUAGE] ) This function attempts to return the name the chemical element given either the chemical symbol, element name, or atomic number. The function does its best to interpret inconsistent input data (e.g. chemical symbols of mixed and single case). $name = get_name('Fe'); #$name is 'Iron' $name = get_name('fe'); #$name is 'Iron' $name = get_name(26); #$name is 'Iron' $name = get_name('Iron'); #$name is 'Iron' $name = get_name('iron'); #$name is 'Iron' If no Z can be found, nothing is returned. Since this function will return the name if it is given a name, you can use it to test whether a string is a chemical element name (although you have to play some tricks with case since get_name will try its best despite the case of the input data). if( lc($string) eq lc( get_name($string) ) ) { #stuff } You can modify the names (e.g. for different languages) by changing the data at the end of this module. =item get_Z( SYMBOL|NAME|Z ) This function attempts to return the atomic number of the chemical element given either the chemical symbol, element name, or atomic number. The function does its best to interpret inconsistent input data (e.g. chemcial symbols of mixed and single case). $name = get_Z('Fe'); #$name is 26 $name = get_Z('fe'); #$name is 26 $name = get_Z(26); #$name is 26 $name = get_Z('Iron'); #$name is 26 $name = get_Z('iron'); #$name is 26 If no Z can be found, nothing is returned. Since this function will return the Z if it is given a Z, you can use it to test whether a string is an atomic number. You might want to use the string comparison in case the $string is not a number (in which case the comparison will be false save for the case when $string is undefined). if( $string eq get_Z($string) ) { #stuff } =back The package constructor automatically finds the largest defined atomic number (in case you add your own heavy elements). =head2 AUTOLOADing methods You can pseudo-define additional methods to associate data with objects. For instance, if you wanted to add a molar mass attribute, you simply pretend that there is a molar_mass method: $element->molar_mass($MM); #add molar mass datum in $MM to object Similarly, you can retrieve previously set values by not specifying an argument to your pretend method: $datum = $element->molar_mass(); #or without the parentheses $datum = $element->molar_mass; If a value has not been associated with the pretend method and the object, the pretend method returns nothing. I had thought about providing basic data for the elements, but thought that anyone using this module would probably have their own data. If there is an interest in canned data, perhaps I can provide mine :) =head2 Localization support XXX: Fill this stuff in later. For now see the test suite =head1 TO DO I would like make this module easily localizable so that one could specify other names or symbols for the elements (i.e. a different language or a different perspective on the heavy elements). If anyone should make changes to the data, i would like to get a copy so that i can include it in future releases :) =head1 SOURCE AVAILABILITY The source for this module is in Github: https://github.com/briandfoy/chemistry-elements =head1 AUTHOR brian d foy, C<< >> =head1 COPYRIGHT AND LICENSE Copyright © 2000-2025, brian d foy . All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. =cut Chemistry-Elements-1.081/Makefile.PL0000644000076500000240000000514714777037110016212 0ustar brianstaffpackage Chemistry::Elements; use strict; use warnings; =encoding utf8 =head1 The build file for Chemistry::Elements This build file is a modulino; it works as both a build script and a module. To build the distribution, run this file normally: % perl Makefile.PL But, it's more interesting than that. You can load it with C and call C to get the data structure it passes to C: my $package = require '/path/to/Makefile.PL'; my $arguments = $package->arguments; Note that C-ing a file makes an entry in C<%INC> for exactly that name. If you try to C another file with the same name, even from a different path, C thinks it has already loaded the file. As such, I recommend you always require the full path to the file. The return value of the C is a package name (in this case, the name of the main module. Use that to call the C method. Even if this distribution needs a higher version of Perl, this bit only needs v5.8. You can play with the data structure with a primitive Perl. =cut use File::Spec::Functions qw(catfile); my $module = __PACKAGE__; ( my $dist = $module ) =~ s/::/-/g; my $github = 'https://github.com/briandfoy/chemistry-elements'; my $main_file = catfile( 'lib', split /::/, "$module.pm" ); my %WriteMakefile = ( 'MIN_PERL_VERSION' => '5.010', 'NAME' => $module, 'VERSION_FROM' => $main_file, 'ABSTRACT_FROM' => $main_file, 'LICENSE' => 'artistic_2', 'AUTHOR' => 'brian d foy ', 'CONFIGURE_REQUIRES' => { 'ExtUtils::MakeMaker' => '6.64', 'File::Spec::Functions' => '0', }, 'BUILD_REQUIRES' => { }, 'TEST_REQUIRES' => { 'Test::More' => '1', 'version' => '0.86', }, 'PREREQ_PM' => { }, 'META_MERGE' => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'git', url => $github, web => $github, }, bugtracker => { web => "$github/issues", }, homepage => $github, }, }, clean => { FILES => "$dist-*" }, ); sub arguments { \%WriteMakefile } do_it() unless caller; sub do_it { require File::Spec; my $MM ='ExtUtils::MakeMaker'; my $MM_version = eval{ "$MM " . $WriteMakefile{'CONFIGURE_REQUIRES'}{'ExtUtils::MakeMaker'} } || "$MM 6.64"; eval "use $MM_version; 1" or die "Could not load $MM_version: $@"; eval "use Test::Manifest 1.21" if -e File::Spec->catfile( qw(t test_manifest) ); my $arguments = arguments(); my $minimum_perl = $arguments->{MIN_PERL_VERSION} || '5.008'; eval "require $minimum_perl;" or die $@; WriteMakefile( %$arguments ); } no warnings; __PACKAGE__; Chemistry-Elements-1.081/INSTALL.SKIP0000644000076500000240000000015614777037110016031 0ustar brianstaffREADME\.pod README.* # things that might be in local directories after fooling # around with them \.DS_Store Chemistry-Elements-1.081/SECURITY.md0000644000076500000240000000231414777037110016022 0ustar brianstaff# Security Policy for Chemistry::Elements ## Reporting security issues **Do not report security problems on public forums or in repository issues.** Privately report vulnerabilities to the maintainers listed at the end of this document. Include as many details as possible to reproduce the issue, including code samples or test cases. Check that your report does not expose any of your sensitive data, such as passwords, tokens, or other secrets. You do not need to have a solution or fix. Depending on the issue, CPANSec may be notified. Depending on the issue, CPANSec may be notified. You can also privately report issues to the CPAN Security Group (CPANSec) . This is especially important if you think a vulnerability is being actively exploited. CPANSec may report the issue to the relevant authorities. See [Report a Security Issue](https://security.metacpan.org/docs/report.html). ## Response to reports The maintainers aim to respond to all reports within one day, but this may be affected by life and other things that happen to people who maintain open source code. A new release will be provided as soon as possible. ## Maintainers * brian d foy, Chemistry-Elements-1.081/META.json0000664000076500000240000000270114777037111015655 0ustar brianstaff{ "abstract" : "Perl extension for working with Chemical Elements", "author" : [ "brian d foy " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Chemistry-Elements", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : {} }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.64", "File::Spec::Functions" : "0" } }, "runtime" : { "requires" : { "perl" : "5.010" } }, "test" : { "requires" : { "Test::More" : "1", "version" : "0.86" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/briandfoy/chemistry-elements/issues" }, "homepage" : "https://github.com/briandfoy/chemistry-elements", "repository" : { "type" : "git", "url" : "https://github.com/briandfoy/chemistry-elements", "web" : "https://github.com/briandfoy/chemistry-elements" } }, "version" : "1.081", "x_serialization_backend" : "JSON::PP version 4.16" }