~ubuntu-branches/ubuntu/utopic/libclass-accessor-grouped-perl/utopic

« back to all changes in this revision

Viewing changes to lib/Class/Accessor/Grouped.pm

  • Committer: Bazaar Package Importer
  • Author(s): Ansgar Burchardt, Ansgar Burchardt, gregor herrmann
  • Date: 2010-04-26 16:53:15 UTC
  • mfrom: (1.1.6 upstream) (5.2.1 maverick)
  • Revision ID: james.westby@ubuntu.com-20100426165315-pcbea7h1ca3c0t6g
[ Ansgar Burchardt ]
* New upstream release.
* Recommend libclass-xsaccessor-perl.
* Add build-dependency on libclass-xsaccessor-perl to use Class::XSAccessor
  during tests.
* Use source format 3.0 (quilt).
* debian/copyright: Formatting changes for current DEP-5 proposal.
* debian/copyright: Update years of copyright.

[ gregor herrmann ]
* Bump debhelper build dependency to 7.2.13 (Module::AutoInstall).

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
use MRO::Compat;
8
8
use Sub::Name ();
9
9
 
10
 
our $VERSION = '0.09002';
 
10
our $VERSION = '0.09003';
11
11
$VERSION = eval $VERSION;
12
12
 
 
13
# Class::XSAccessor is segfaulting on win32, so be careful
 
14
# Win32 users can set $hasXS to try to use it anyway
 
15
 
 
16
our $hasXS;
 
17
 
 
18
sub _hasXS {
 
19
 
 
20
  if (not defined $hasXS) {
 
21
    $hasXS = 0;
 
22
 
 
23
    if ($^O ne 'MSWin32') {
 
24
      eval {
 
25
        require Class::XSAccessor;
 
26
        $hasXS = 1;
 
27
      };
 
28
    }
 
29
  }
 
30
 
 
31
  return $hasXS;
 
32
}
 
33
 
13
34
=head1 NAME
14
35
 
15
36
Class::Accessor::Grouped - Lets you build groups of accessors
84
105
            my $full_alias = join('::', $class, $alias);
85
106
            
86
107
            if ( $hasXS && $group eq 'simple' ) {
 
108
                require Class::XSAccessor;
87
109
                Class::XSAccessor::newxs_accessor("${class}::${name}", $field, 0);
88
110
                Class::XSAccessor::newxs_accessor("${class}::${alias}", $field, 0);
89
111
                
438
460
    return @{mro::get_linear_isa($class)};
439
461
};
440
462
 
441
 
# This is now a hard, rather than optional dep. Since we dep on Sub::Name, we no
442
 
# longer care about not using XS modules.
443
 
 
444
 
# Class::XSAccessor is segfaulting in some places, so removing for now.
445
 
{
446
 
    our $hasXS;
447
 
 
448
 
    sub _hasXS { 0 }
449
 
 
450
 
#    sub _hasXS {
451
 
#        return $hasXS if defined $hasXS;
452
 
#    
453
 
#        $hasXS = 0;
454
 
#        eval {
455
 
#            require Class::XSAccessor;
456
 
#            $hasXS = 1;
457
 
#        };
458
 
#    
459
 
#        return $hasXS;
460
 
#    }
461
 
}
462
 
 
463
463
1;
464
464
 
 
465
=head1 Performance
 
466
 
 
467
You can speed up accessors of type 'simple' by installing L<Class::XSAccessor>.
 
468
Note however that the use of this module is disabled by default on Win32
 
469
systems, as it causes yet unresolved segfaults. If you are a Win32 user, and
 
470
want to try this module with L<Class::XSAccessor>, set
 
471
C<$Class::Accessor::Grouped::hasXS> to a true value B<before> registering
 
472
your accessors (e.g. in a C<BEGIN> block)
 
473
 
465
474
=head1 AUTHORS
466
475
 
467
476
Matt S. Trout <mst@shadowcatsystems.co.uk>
473
482
 
474
483
=head1 COPYRIGHT & LICENSE
475
484
 
476
 
Copyright (c) 2006-2009 Matt S. Trout <mst@shadowcatsystems.co.uk>
 
485
Copyright (c) 2006-2010 Matt S. Trout <mst@shadowcatsystems.co.uk>
477
486
 
478
487
This program is free software; you can redistribute it and/or modify
479
488
it under the same terms as perl itself.