#!/usr/bin/perl
use strict;
use warnings;
use CGI;
# this is by default in package main scope
package TempConverter;
# define necessary stuff for TempConverter
# and start its package scope
# you can even do this, to....
package CGI;
# ...extend the CGI package, but this is not
# recommended
package TempConverter;
# back in TempConverter scope and add
# something you need
package main;
# now in main scope, ready for action!
# the safest place to do things
####
package main;
*set_scale = \&my_temp_convert::set_scale;
set_scale(1);
####
sub new { bless {} }
sub set_scale {
my $self = shift;
$curr_scale = shift;
}
# later.....
package main;
my $temp = my_temp_convert->new;
$temp->set_scale(1);
####
package main;
my_temp_convert->import;
set_scale(1)
####
package main;
no strict 'refs'; # this is necessary
for my $sym (keys %my_temp_convert::) {
*{"::$sym"} = *{"my_temp_convert::$sym"};
}
set_scale(1);
####
*main:: = *my_temp_convert::;
####
sub set_scale{$curr_scale=shift}
sub set_temp($){
#convert to C if needed, and store in "curtmp"
}
####
sub set_scale{ curr_scale=shift}
sub set_temp($){#convert to C if needed, and store in "curtmp"}