I'm attempting my first PerlEX app and I'm failing miserably. :-(

The goal is for my module to access variables stored in the calling
script. The following example works when run as CGI but fails as
PerlEX. Am I on the right path here or is there a better way?



# ------------------------------------------------------
# test.plex
# ------------------------------------------------------

BEGIN {
        use strict;
        use test_package qw(&test_sub1 &test_sub2);
        our $cached_when=(localtime);
}

our %hash = (
        'Bob' => {
                        Age => '7',
                        Type => 'Foo',
                }
);

print "Content-type: text/html\npragma: no-cache\n\n";

&test_package::test_sub1();

&test_package::test_sub2();



# ------------------------------------------------------
# test_package.pm
# ------------------------------------------------------

package test_package;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;

@ISA = qw(Exporter AutoLoader);
@EXPORT_OK = qw(&test_sub1 &test_sub2);
$VERSION = '0.01';

sub test_sub1{

        for my $subkey (sort keys %{$main::hash{'Bob'}}){
                print "SubKey: $subkey = $main::hash{'Bob'}{$subkey}<br>\n";
        }
}

sub test_sub2{
        print 'Cached: '.$main::cached_when."<br>\n";
        print 'Now: '.(localtime)."<br>\n";
}


1;
__END__

Attachment: test.plex
Description: Binary data

Attachment: test_package.pm
Description: Binary data

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to