Click here to get back home

Class::Std causing compilation errors

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Class::Std causing compilation errors Walter Heukels 11-24-2007
Posted by Walter Heukels on November 24, 2007, 5:08 pm
Please log in for more thread options
I'm getting some strange problems with a couple of simple Class::Std
modules I'm working on. Either module works fine by itself, but when I
reference one from the other I get warnings and errors at compile time. My
test script doesn't do anything except use one of the modules:

#!/usr/bin/perl -w

use strict;
use lib '.';
use Mailbox;

(module code below)

When I try to run the script I get this:

Use of uninitialized value in pattern match (m//) at
/usr/lib/perl5/site_perl/5.8.8/Email/Simple.pm line 78.
Use of uninitialized value in split at
/usr/lib/perl5/site_perl/5.8.8/Email/Simple.pm line 100.

For some reason code in Email::Simple seems to be getting executed during
the CHECK phase. When I run perl -c I get the same result.

I know Class::Std works its magic during the CHECK phase but I'm not smart
enough to figure out what the code actually does.

Is this a problem with Class::Std, or am I doing something wrong?

The modules look like this:

package Mailbox;

use strict;
use warnings;
use Message;

use Class::Std;
{
my %dbh_of :ATTR;
my %filename_of :ATTR( :get<filename> );

sub BUILD
{
my ($self, $id, $args_ref) = @_;

my $filename = $args_ref->;
$filename_of{ $id } = $filename;
}

sub import
{
my ($self, $data) = @_;

my $msg = Message->new({ data => $data });
my $msg_obj = $msg->get_msg_obj();
my @from = $msg_obj->header('from') || '';
}
}

1;

and

package Message;

use strict;
use warnings;
use Email::Simple;

use Class::Std;
{
my %msg_obj_of :ATTR( :get<msg_obj> );

sub BUILD
{
my ($self, $id, $args_ref) = @_;
my $msg_obj = Email::Simple->new($args_ref->);
$msg_obj_of{ ident($self) } = $msg_obj;
}
}

1;


Posted by Walter Heukels on November 25, 2007, 10:23 am
Please log in for more thread options

> I'm getting some strange problems with a couple of simple Class::Std
> modules I'm working on. Either module works fine by itself, but when I
> reference one from the other I get warnings and errors at compile time. My
> test script doesn't do anything except use one of the modules:

Never mind, I'm an idiot. The moral of the story: don't use "import" as a
method name.

Walter


Similar ThreadsPosted
Commented lines are being shown compilation errors December 24, 2007, 5:37 am
Found problem in Mail-SpamAssassin-2.xx causing build failure onwin32 August 1, 2004, 9:33 pm
Conditional compilation November 5, 2004, 5:20 pm
DBI compilation error on Solaris February 24, 2005, 6:04 pm
Compilation problem using make January 21, 2006, 12:49 am
Class::DBI::Schema2Code V 1.01 July 29, 2004, 7:14 am
Class::Tree V 1.24 July 29, 2004, 7:15 am
[RFC] Class::DataStore May 13, 2005, 2:45 pm
RFC: new module Class::MakeIntrospecMethods October 18, 2004, 4:30 pm
Perl Class::Struct October 13, 2005, 3:18 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap