Skip to content
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

Closed
p6rt opened this issue Jun 15, 2008 · 4 comments
Closed

Bool.perl(), Range.perl() #131

p6rt opened this issue Jun 15, 2008 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 15, 2008

Migrated from rt.perl.org#55860 (status was 'resolved')

Searchable as RT55860$

@p6rt
Copy link
Author

p6rt commented Jun 15, 2008

From olivier.mengue@gmail.com

Here a patch that implements 'perl' methods on Bool and Range objects.

Olivier Mengué (dolmen on CPAN/IRC)

@p6rt
Copy link
Author

p6rt commented Jun 15, 2008

From olivier.mengue@gmail.com

Bool,Range-perl.patch
Index: 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

@p6rt
Copy link
Author

p6rt commented Jun 15, 2008

From @pmichaud

Applied Range.perl in r28394. (Bool.perl was already in place in r28389.)

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Jun 15, 2008

@pmichaud - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jun 15, 2008
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant