develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [p5p] [p5pod] Pod::InputObjects patch for plain refs

Thread Next
From:
Brad Appleton
Date:
March 7, 2000 16:54
Subject:
Re: [p5p] [p5pod] Pod::InputObjects patch for plain refs
Message ID:
200003080054.SAA19915@agogic.cig.mot.com
On Tue, Mar 07, 2000 at 06:40:12PM -0600, Brad Appleton wrote:
> Russ Allbery <rra@stanford.edu> wrote
> > -      next unless (ref || ref eq 'SCALAR');
> > +      next if (!ref || ref eq 'SCALAR');
> >        if ($_->isa('Pod::InteriorSequence') or $_->can('nested')) {
> 
> Eeek! When I apply this patch, it breaks my code. Pod::Text (my test
> version of it anyay ;-) fails to pass some basic tests, like t/pod/lref
> and t/pod/headings to name a few.
>
> If you want to allow scalars, then you can't use them as refs right?
> So if its a plain scalar, then we can't try to do $_->methodname
> correct?

D'Oh!!! My apologies. It works just fine *if* I alow follow the previous
suggestion of calling isa() & can() as functions rather than as methods
(duh!).
-- 
Brad Appleton <bradapp@enteract.com> http://www.enteract.com/~bradapp/
  "And miles to go before I sleep." -- Robert Frost



*** InputObjects.pm.orig	Tue Mar  7 18:50:39 2000
--- InputObjects.pm	Tue Mar  7 18:52:25 2000
***************
*** 522,529 ****
     my ($self, @children) = @_;
     ## Make sure any sequences know who their parent is
     for (@children) {
!       next unless (ref || ref eq 'SCALAR');
!       if ($_->isa($_, 'Pod::InteriorSequence') or $_->can('nested')) {
            $_->nested($self);
        }
     }
--- 522,531 ----
     my ($self, @children) = @_;
     ## Make sure any sequences know who their parent is
     for (@children) {
!       next if (!ref || ref eq 'SCALAR');
!       if (UNIVERSAL::isa($_, 'Pod::InteriorSequence') or
!           UNIVERSAL::can($_, 'nested'))
!       {
            $_->nested($self);
        }
     }
***************
*** 537,543 ****
     my $ptree = $self->{'-ptree'};
     for (@$ptree) {
        next  unless (length  and  ref  and  ref ne 'SCALAR');
!       $_->_unset_child2parent_links() if $_->isa('Pod::InteriorSequence');
     }
  }
  
--- 539,546 ----
     my $ptree = $self->{'-ptree'};
     for (@$ptree) {
        next  unless (length  and  ref  and  ref ne 'SCALAR');
!       $_->_unset_child2parent_links()
!           if UNIVERSAL::isa($_, 'Pod::InteriorSequence');
     }
  }
  
***************
*** 890,896 ****
     local *ptree = $self;
     for (@ptree) {
         next  unless (length  and  ref  and  ref ne 'SCALAR');
!        $_->_unset_child2parent_links() if $_->isa('Pod::InteriorSequence');
     }
  }
  
--- 893,900 ----
     local *ptree = $self;
     for (@ptree) {
         next  unless (length  and  ref  and  ref ne 'SCALAR');
!        $_->_unset_child2parent_links()
!            if UNIVERSAL::isa($_, 'Pod::InteriorSequence');
     }
  }

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About