New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bool.perl(), Range.perl() #131
Labels
Comments
From olivier.mengue@gmail.comHere a patch that implements 'perl' methods on Bool and Range objects. Olivier Mengué (dolmen on CPAN/IRC) |
From olivier.mengue@gmail.comBool,Range-perl.patchIndex: src/classes/Bool.pir
===================================================================
--- src/classes/Bool.pir (révision 28379)
+++ src/classes/Bool.pir (copie de travail)
@@ -53,6 +53,20 @@
.end
+=item perl()
+
+Returns a Perl representation of the Bool.
+
+=cut
+
+.sub 'perl' :method
+ unless self goto false
+ .return ("Bool::True")
+ false:
+ .return ("Bool::False")
+.end
+
+
# Local Variables:
# mode: pir
# fill-column: 100
Index: src/classes/Range.pir
===================================================================
--- src/classes/Range.pir (révision 28379)
+++ src/classes/Range.pir (copie de travail)
@@ -148,6 +148,35 @@
.return ($I0)
.end
+
+=item perl()
+
+Returns a Perl representation of the Range.
+
+=cut
+
+.sub 'perl' :method
+ .local string result, tmp
+ .local pmc from, fromexc, toexc, to
+ from = getattribute self, '$!from'
+ fromexc = getattribute self, '$!from_exclusive'
+ toexc = getattribute self, '$!to_exclusive'
+ to = getattribute self, '$!to'
+ result = from.'perl'()
+ unless fromexc goto dots
+ result .= '^'
+ dots:
+ result .= '..'
+ unless toexc goto end
+ result .= '^'
+ end:
+ tmp = to.'perl'()
+ result .= tmp
+ .return (result)
+.end
+
+
+
=back
=head2 Operators
|
From @pmichaudApplied Range.perl in r28394. (Bool.perl was already in place in r28389.) Thanks! Pm |
@pmichaud - Status changed from 'new' to 'resolved' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Migrated from rt.perl.org#55860 (status was 'resolved')
Searchable as RT55860$
The text was updated successfully, but these errors were encountered: