From 720784dac20ebd0a5b68ee1dd67819856158622a Mon Sep 17 00:00:00 2001 From: nwf Date: Thu, 28 Aug 2008 05:20:19 -0400 Subject: [PATCH] Namespace ourselves, first pass darcs-hash:20080828092019-4d648-996f6968c7304098af7b44601a4d81b7ab6de05e.gz --- Definitions.pm | 3 +-- HuffmanCoder.pm | 3 +-- HuffmanCoder_test.pl | 11 +++++------ MasterCoder.pm | 3 +-- MasterCoder_test.pl | 7 +++---- MasterCoder_tlv_test.pl | 12 ++++++------ Protoutils.pm | 3 +-- irssi_test_new.pl | 14 +++++++------- 8 files changed, 25 insertions(+), 31 deletions(-) diff --git a/Definitions.pm b/Definitions.pm index ec1fad0..6c639e3 100644 --- a/Definitions.pm +++ b/Definitions.pm @@ -1,8 +1,7 @@ use warnings; use strict; -#package Irssi::Scripts::Instance::Definitions; -package Definitions; +package Instance::Definitions; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; diff --git a/HuffmanCoder.pm b/HuffmanCoder.pm index c8936b3..57f61cb 100644 --- a/HuffmanCoder.pm +++ b/HuffmanCoder.pm @@ -1,7 +1,6 @@ use warnings; -#package Irssi::Scripts::Instance::HuffmanCoder; -package HuffmanCoder; +package Instance::HuffmanCoder; ################################################################# diff --git a/HuffmanCoder_test.pl b/HuffmanCoder_test.pl index 57521b5..8053af8 100644 --- a/HuffmanCoder_test.pl +++ b/HuffmanCoder_test.pl @@ -2,14 +2,13 @@ use warnings; use strict; #use Data::Dumper; -# use Irssi::Scripts::Instance::Mastercode; ### XXX -require MasterCoder; -require HuffmanCoder; -use Definitions qw( @debug_code_chars $instance_huffman_table1 +require Instance::MasterCoder; +require Instance::HuffmanCoder; +use Instance::Definitions qw( @debug_code_chars $instance_huffman_table1 $MESSAGE_START $MESSAGE_END ); -my $mastercoder = MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); -my $huffmancoder = HuffmanCoder->new($mastercoder, $instance_huffman_table1); +my $mastercoder = Instance::MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); +my $huffmancoder = Instance::HuffmanCoder->new($mastercoder, $instance_huffman_table1); #print "Dumping encoding table:\n"; #$huffmancoder->dump_encode_table(); diff --git a/MasterCoder.pm b/MasterCoder.pm index dbc2f8d..00644af 100644 --- a/MasterCoder.pm +++ b/MasterCoder.pm @@ -4,8 +4,7 @@ use strict; use Math::BaseCalc; use POSIX qw( floor ); -#package Irssi::Scripts::Instance::MasterCoder; -package MasterCoder; +package Instance::MasterCoder; ################################################################# diff --git a/MasterCoder_test.pl b/MasterCoder_test.pl index 8b0583d..827a7aa 100644 --- a/MasterCoder_test.pl +++ b/MasterCoder_test.pl @@ -1,11 +1,10 @@ use warnings; use strict; -# use Irssi::Scripts::Instance::Mastercode; ### XXX -require MasterCoder; -use Definitions qw( @debug_code_chars $MESSAGE_START $MESSAGE_END ); +require Instance::MasterCoder; +use Instance::Definitions qw( @debug_code_chars $MESSAGE_START $MESSAGE_END ); -my $coder = MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END ); +my $coder = Instance::MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END ); print "Some handy quick tests... \n"; die unless $coder->tencode_padded($MESSAGE_START,2) eq "OO"; diff --git a/MasterCoder_tlv_test.pl b/MasterCoder_tlv_test.pl index a0cde02..d9337c6 100644 --- a/MasterCoder_tlv_test.pl +++ b/MasterCoder_tlv_test.pl @@ -1,16 +1,16 @@ use warnings; use strict; -use Definitions qw( %known_types +use Instance::Definitions qw( %known_types @debug_code_chars $instance_huffman_table1 $MESSAGE_START $MESSAGE_END ); -require MasterCoder; -require HuffmanCoder; -use Protoutils qw( dump_message ); +require Instance::MasterCoder; +require Instance::HuffmanCoder; +use Instance::Protoutils qw( dump_message ); -my $mc = MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); -my $hc = HuffmanCoder->new($mc, $instance_huffman_table1); +my $mc = Instance::MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); +my $hc = Instance::HuffmanCoder->new($mc, $instance_huffman_table1); my @test_strings = ( "hi", "there", "coin", "test", "!@#\$&*.-=" ); my @tlvs = (); diff --git a/Protoutils.pm b/Protoutils.pm index 70f487c..ac74de3 100644 --- a/Protoutils.pm +++ b/Protoutils.pm @@ -1,8 +1,7 @@ use warnings; use strict; -#package Irssi::Scripts::Instance::Protoutils; -package Protoutils; +package Instance::Protoutils; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; diff --git a/irssi_test_new.pl b/irssi_test_new.pl index 9ed3cc6..7649176 100644 --- a/irssi_test_new.pl +++ b/irssi_test_new.pl @@ -21,17 +21,17 @@ $VERSION = 'irssi-test v0.01'; ################################################################# -require MasterCoder; -require HuffmanCoder; -use Definitions qw( %known_types +require Instance::MasterCoder; +require Instance::HuffmanCoder; +use Instance::Definitions qw( %known_types @debug_code_chars @default_code_chars $instance_huffman_table1 $MESSAGE_START $MESSAGE_END ); -my $mc_dbg = MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); -my $mc_dfl = MasterCoder->new(\@default_code_chars, $MESSAGE_START, $MESSAGE_END); -my $hc_dbg = HuffmanCoder->new($mc_dbg, $instance_huffman_table1); -my $hc_dfl = HuffmanCoder->new($mc_dfl, $instance_huffman_table1); +my $mc_dbg = Instance::MasterCoder->new(\@debug_code_chars, $MESSAGE_START, $MESSAGE_END); +my $mc_dfl = Instance::MasterCoder->new(\@default_code_chars, $MESSAGE_START, $MESSAGE_END); +my $hc_dbg = Instance::HuffmanCoder->new($mc_dbg, $instance_huffman_table1); +my $hc_dfl = Instance::HuffmanCoder->new($mc_dfl, $instance_huffman_table1); # XXX Allow some kind of runtime switch between these? my $mc = $mc_dfl; -- 2.50.1