From: Vincent Pit Date: Fri, 11 Nov 2011 21:01:51 +0000 (+0100) Subject: Make sure the POD headings are linkable X-Git-Tag: v0.02~15 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=311423ea1bdbde2c8dde8ce3a772a1036365ec4f;p=perl%2Fmodules%2FScope-Context.git Make sure the POD headings are linkable --- diff --git a/lib/Scope/Context.pm b/lib/Scope/Context.pm index 4f327a3..4a45cbb 100644 --- a/lib/Scope/Context.pm +++ b/lib/Scope/Context.pm @@ -87,7 +87,10 @@ will croak when L is called. =head1 METHODS -=head2 C +=head2 C + + my $cxt = Scope::Context->new; + my $cxt = Scope::Context->new($scope_upper_cxt); Creates a new immutable L object from the L-comptabile context C<$context>. If omitted, C<$context> defaults to the current context. @@ -128,10 +131,14 @@ sub _croak { =head2 C + my $scope_upper_cxt = $cxt->cxt; + Read-only accessor to the L context corresponding to the topic L object. =head2 C + my $uid = $cxt->uid; + Read-only accessor to the L UID of the topic L object. =cut @@ -162,6 +169,8 @@ use overload ( =head2 C + my $is_valid = $cxt->is_valid; + Returns true if and only if the topic context is still valid (that is, it designates a scope that is higher than the topic context in the call stack). =cut @@ -170,6 +179,8 @@ sub is_valid { Scope::Upper::validate_uid($_[0]->uid) } =head2 C + $cxt->assert_valid; + Throws an exception if the topic context has expired and is no longer valid. Returns true otherwise. @@ -185,6 +196,8 @@ sub assert_valid { =head2 C + my $want = $cxt->want; + Returns the Perl context (in the sense of C : C for void context, C<''> for scalar context, and true for list context) in which is executed the scope corresponding to the topic L object. =cut @@ -197,7 +210,11 @@ sub want { Scope::Upper::want_at($self->cxt); } -=head2 C +=head2 C + + my $up_cxt = $cxt->up; + my $up_cxt = $cxt->up($frames); + my $up_cxt = Scope::Context->up; Returns a new L object pointing to the C<$frames>-th upper scope above the topic context. @@ -233,7 +250,11 @@ sub up { $self->new($cxt); } -=head2 C +=head2 C + + my $sub_cxt = $cxt->sub; + my $sub_cxt = $cxt->sub($frames); + my $sub_cxt = Scope::Context->sub; Returns a new L object pointing to the C<$frames>-th subroutine scope above the topic context. @@ -271,7 +292,11 @@ sub sub { $self->new($cxt); } -=head2 C +=head2 C + + my $eval_cxt = $cxt->eval; + my $eval_cxt = $cxt->eval($frames); + my $eval_cxt = Scope::Context->eval; Returns a new L object pointing to the C<$frames>-th C scope above the topic context. @@ -305,7 +330,9 @@ sub eval { $self->new($cxt); } -=head2 C +=head2 C + + $cxt->reap($code); Execute C<$code> when the topic context ends. @@ -321,7 +348,9 @@ sub reap { &Scope::Upper::reap($code, $self->cxt); } -=head2 C +=head2 C + + $cxt->localize($what, $value); Localize the variable described by C<$what> to the value C<$value> when the control flow returns to the scope pointed by the topic context. @@ -337,7 +366,9 @@ sub localize { Scope::Upper::localize($what, $value, $self->cxt); } -=head2 C +=head2 C + + $cxt->localize_elem($what, $key, $value); Localize the element C<$key> of the variable C<$what> to the value C<$value> when the control flow returns to the scope pointed by the topic context. @@ -353,7 +384,9 @@ sub localize_elem { Scope::Upper::localize_elem($what, $key, $value, $self->cxt); } -=head2 C +=head2 C + + $cxt->localize_delete($what, $key); Delete the element C<$key> from the variable C<$what> when the control flow returns to the scope pointed by the topic context. @@ -369,7 +402,9 @@ sub localize_delete { Scope::Upper::localize_delete($what, $key, $self->cxt); } -=head2 C +=head2 C + + $cxt->unwind(@values); Immediately returns the scalars listed in C<@values> from the closest subroutine enclosing the topic context. @@ -385,7 +420,9 @@ sub unwind { Scope::Upper::unwind(@_ => $self->cxt); } -=head2 C +=head2 C + + my @ret = $cxt->uplevel($code, @args); Executes the code reference C<$code> with arguments C<@args> in the same setting as the closest subroutine enclosing the topic context, then returns to the current scope the values returned by C<$code>.