diff options
author | bscan <10503608+bscan@users.noreply.github.com> | 2022-02-06 23:00:29 -0500 |
---|---|---|
committer | bscan <10503608+bscan@users.noreply.github.com> | 2022-02-06 23:00:29 -0500 |
commit | 21b9e56831b9d7c14109fbfa51659570dead7149 (patch) | |
tree | 556a08b60c60cea51a10a1ea4b746457f587e20d /testWorkspace | |
parent | aea1b6501427fde5cd016e8077b071156e14a826 (diff) | |
download | PerlNavigator-21b9e56831b9d7c14109fbfa51659570dead7149.zip |
Change for old versions of Perl back to 5.8
Diffstat (limited to 'testWorkspace')
-rw-r--r-- | testWorkspace/slimTest.pl | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/testWorkspace/slimTest.pl b/testWorkspace/slimTest.pl new file mode 100644 index 0000000..45f8169 --- /dev/null +++ b/testWorkspace/slimTest.pl @@ -0,0 +1,114 @@ +# mainTest.pl uses a variety of non-core things (e.g. Moo/Moose) as well as recent Perl Constructs (e.g. signatures) +# slimTest.pl is for testing with a barebones Perl 5.8 + +use strict; +use warnings; +use utf8; +use FindBin qw($Bin); +use File::Spec; +use lib "$Bin"; +# These are system test modules +use Data::Dumper; # Module details. Dumper is auto-exported +use Cwd qw(fast_abs_path); # fast_abs_path is pure perl. +use MIME::Base64 qw(encode_base64); # encode_base64 is XS, so the best we can do is find the .pm + +# Workspace modules +use MyLib::NamedPackage qw(exported_sub imported_constant $our_variable); +use MyLib::MyClass; +use MyLib::MyOtherClass; +use MyLib::NonPackage; +use MyLib::DBI; +use MySubClass; + +use constant MYCONSTANT => 6; + +my $my_scalar = 1; +my @my_array = (2,2); +my $array_ref = [3,3]; +my %my_hash = ("Four"=>4); +my $hash_ref = {"Five"=>5}; +# my $üτfⅷ = 10; + +print "\n------ Variables --------\n"; +print $my_scalar; +print ${my_scalar}; + +print $my_array[0]; +print "@my_array"; +print $array_ref->[0]; +print $$array_ref[0]; +print "@$array_ref"; +print $my_hash{"Four"}; +print %my_hash; +print $hash_ref->{"Five"}; +print $$hash_ref{"Five"}; +# print $üτfⅷ; +print MYCONSTANT; + +LABEL1: for (0..4) { + LABEL2: foreach my $lexLoopDuplicate (0..4) { + next LABEL2 if $lexLoopDuplicate > 2; + last LABEL1; + } +} + +foreach my $lexLoopDuplicate (1..3){ + print $lexLoopDuplicate; +} + +for (my $cStyleLoopVar = 0; $cStyleLoopVar <= 2; $cStyleLoopVar++){ + print "$cStyleLoopVar"; +} + +print imported_constant . "\n"; + +print $our_variable . "\n"; + +sub same_script_sub { + my $functionVar = shift; + print "$functionVar\n"; +} + + +print "\n------ Subs --------\n"; +same_script_sub("FooSix"); +SameFilePackage::same_file_package_sub(); +duplicate_sub_name(); +nonpackage_sub(); +exported_sub(); +MyLib::NamedPackage::non_exported_sub(); +MyLib::NamedPackage::duplicate_sub_name(); +MyLib::SubPackage::subpackage_mod(); + +print Dumper(\%my_hash); +print fast_abs_path($0) . "\n"; +print encode_base64($0) . "\n"; + +print "\n ------ Methods and Attributes ------\n"; + +my $testObj = MyLib::MyClass->new(); +$testObj->overridden_method(); + +my $subObj = MySubClass->new(); +$subObj->overridden_method(); +$subObj->inherited_method(); + +my $otherObj = MyLib::MyOtherClass->new(); +$otherObj->unique_method_name(); +$otherObj->duplicate_method_name(); + +my $unknownObj = $otherObj; +$unknownObj->duplicate_method_name(); + +my $hiddenPackObj = MyLib::SubPackage->new(); + +my $dbh2 = MyLib::DBI->connect(); + + +print "\nDone with test script\n"; + +package SameFilePackage; ## no critic (package) + +sub same_file_package_sub { + print "In same_file_package_sub\n"; +} |