1*0Sstevel@tonic-gate#!perl 2*0Sstevel@tonic-gateuse warnings; 3*0Sstevel@tonic-gateuse strict; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gateBEGIN { 6*0Sstevel@tonic-gate chdir 't' if -d 't'; 7*0Sstevel@tonic-gate @INC = '../lib'; 8*0Sstevel@tonic-gate}; 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gateuse Test::More tests => 9; 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gaterequire_ok( 'Pod::Select' ); 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gatemy $fake_out = tie *FAKEOUT, 'CatchOut'; 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gatemy $p_s = Pod::Select->new; 17*0Sstevel@tonic-gateisa_ok( $p_s, 'Pod::Select' ); 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gatemy $pod = << 'EO_NAME'; 20*0Sstevel@tonic-gate=head1 NAME 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gateSelect.t - Tests for Pod::Select. 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gateEO_NAME 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate$p_s->select( 'NAME' ); 27*0Sstevel@tonic-gate$p_s->parse_from_file( $0, \*FAKEOUT ); 28*0Sstevel@tonic-gateis( $$fake_out, $pod, 'select( NAME )' ); 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate$pod .= << 'EO_SYNOPSIS'; 31*0Sstevel@tonic-gate=head1 SYNOPSIS 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gateThis program just tests the basics of the Pod::Select module. 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gateEO_SYNOPSIS 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate$$fake_out = ''; 38*0Sstevel@tonic-gate$p_s->select( 'NAME', 'SYNOPSIS' ); 39*0Sstevel@tonic-gate$p_s->parse_from_file( $0, \*FAKEOUT ); 40*0Sstevel@tonic-gateis( $$fake_out, $pod, 'select( NAME, SYNOPSIS )' ); 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate$pod .= << 'EO_AUTHOR'; 43*0Sstevel@tonic-gate=head1 AUTHOR 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gateAbe Timmerman <abe@ztreet.demon.nl> 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gateEO_AUTHOR 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate$$fake_out = ''; 50*0Sstevel@tonic-gate$p_s->add_selection( 'AUTHOR' ); 51*0Sstevel@tonic-gate$p_s->parse_from_file( $0, \*FAKEOUT ); 52*0Sstevel@tonic-gateis( $$fake_out, $pod, 'add_selection( AUTHOR )' ); 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gatemy $head1 = $p_s->curr_headings(1); 55*0Sstevel@tonic-gateis( $head1, 'AUTHOR', 'curr_headings()' ); 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate$pod = << 'EO_DESCRIPTION'; 58*0Sstevel@tonic-gate=head2 subsection 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gatea sub-section can be specified 61*0Sstevel@tonic-gate 62*0Sstevel@tonic-gateEO_DESCRIPTION 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate$$fake_out = ''; 65*0Sstevel@tonic-gate$p_s->select( 'DESCRIPTION/subsection' ); 66*0Sstevel@tonic-gate$p_s->parse_from_file( $0, \*FAKEOUT ); 67*0Sstevel@tonic-gateis( $$fake_out, $pod, 'select( DESCRIPTION/subsection )' ); 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gateok( $p_s->match_section( 'DESCRIPTION', 'subsection' ), 71*0Sstevel@tonic-gate 'match_section( DESCRIPTION, subsection )' ); 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate$pod = << 'EO_DESCRIPTION'; 74*0Sstevel@tonic-gate=head1 DESCRIPTION 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gateI'll go by the POD in Pod::Select. 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gateEO_DESCRIPTION 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate$$fake_out = ''; 81*0Sstevel@tonic-gate$p_s->select( 'DESCRIPTION/!.+' ); 82*0Sstevel@tonic-gate$p_s->parse_from_file( $0, \*FAKEOUT ); 83*0Sstevel@tonic-gateis( $$fake_out, $pod, 'select( DESCRIPTION/!.+ )' ); 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gatepackage CatchOut; 87*0Sstevel@tonic-gatesub TIEHANDLE { bless \( my $self ), shift } 88*0Sstevel@tonic-gatesub PRINT { my $self = shift; $$self .= $_[0] } 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate__END__ 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate=head1 NAME 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gateSelect.t - Tests for Pod::Select. 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate=head1 SYNOPSIS 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gateThis program just tests the basics of the Pod::Select module. 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate=head1 DESCRIPTION 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gateI'll go by the POD in Pod::Select. 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate=head2 selection + add_selection 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gatePull out the specified sections 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate=head2 subsection 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gatea sub-section can be specified 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate=head1 AUTHOR 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gateAbe Timmerman <abe@ztreet.demon.nl> 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate=cut 117