On Mon, Mar 28, 2011 at 09:57, Mehul Sanghvi <[hidden email]> wrote:
> On Mon, Mar 28, 2011 at 09:52, Paolo Bonzini <[hidden email]> wrote: >> On 03/28/2011 03:42 PM, Mehul Sanghvi wrote: >>> >>> gst> Smalltalk getenv: 'SHELL' >>> '/bin/bash' >>> gst> >>> >>> I didn't think I needed it when I was doing the environ statement. >> >> You didn't need it for "Smalltalk environ" indeed. But here, >> >>> which is different from >>> >>> gst> Smalltalk environ: >>> >>> the last one needing a '.' to make it a complete statement or an object. >> >> adding a "." would only make a syntax error, because you need an argument >> after "environ:", just like you had one above "getenv:". >> >> Tip: if you think it's complicated, you aren't understanding it. :) >> >> Paolo >> > > More like not paying attention to it. :) > > > -- > Mehul N. Sanghvi > email: [hidden email] > I've attached a patch so that environ can be supported from GST. And this is what my final test-cgi.st script looks like :) Just ignore the fact that I use GNU style for naming my variables rather then the CamelCase style that is the convention in Smalltalk. ------ BEGIN CODE ---------- #!/usr/local/bin/gst -f Transcript showCr: 'Content-type: text/html'; nl . '' displayNl . '<HTML>' displayNl . '<HEAD><TITLE>Testing CGI/Smalltalk</TITLE></HEAD>' displayNl . '<BODY>' displayNl . '<H2>Yo! Smalltalk, Whats up ? </H2>' displayNl . env := Smalltalk environ . env_dict := Dictionary new. [ (env_string := env value) isNil ] whileFalse: [ match := env_string =~ '(.*?)=(.*)'. env_dict at: (match at: 1) put: (match at: 2). env incr ]. env_sorted := env_dict keys asSortedCollection. Transcript nl ; showCr: '==== All Env Vars below ====== <br>'; nl. env_sorted do: [ :a_key | Transcript show: a_key . ans := env_dict at: a_key. Transcript show: ' = '; show: ans; cr. ]. '</BODY>' displayNl . '</HTML>' displayNl . -------------- END CODE ------ Thanks for the help Paolo and the patience. Hopefully the patch makes it in. cheers, mehul -- Mehul N. Sanghvi email: [hidden email] _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk environ-patch.diff (1K) Download Attachment |
On 03/28/2011 06:32 PM, Mehul Sanghvi wrote:
> I've attached a patch so that environ can be supported from GST. Thanks, I'll add the support. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Mehul Sanghvi-2
Doesn't seem like the patch I had sent previously made it in.
I just did a "git pull" for the first time since March 2011, and the patch wasn't in there. Any chance it can be included ? It is attached to this email. On Mon, Mar 28, 2011 at 12:32, Mehul Sanghvi <[hidden email]> wrote: > On Mon, Mar 28, 2011 at 09:57, Mehul Sanghvi <[hidden email]> wrote: >> On Mon, Mar 28, 2011 at 09:52, Paolo Bonzini <[hidden email]> wrote: >>> On 03/28/2011 03:42 PM, Mehul Sanghvi wrote: >>>> >>>> gst> Smalltalk getenv: 'SHELL' >>>> '/bin/bash' >>>> gst> >>>> >>>> I didn't think I needed it when I was doing the environ statement. >>> >>> You didn't need it for "Smalltalk environ" indeed. But here, >>> >>>> which is different from >>>> >>>> gst> Smalltalk environ: >>>> >>>> the last one needing a '.' to make it a complete statement or an object. >>> >>> adding a "." would only make a syntax error, because you need an argument >>> after "environ:", just like you had one above "getenv:". >>> >>> Tip: if you think it's complicated, you aren't understanding it. :) >>> >>> Paolo >>> >> >> More like not paying attention to it. :) >> >> >> -- >> Mehul N. Sanghvi >> email: [hidden email] >> > > > > I've attached a patch so that environ can be supported from GST. > > > And this is what my final test-cgi.st script looks like :) > Just ignore the fact that I use GNU style for naming my variables > rather then the CamelCase style that is the convention in Smalltalk. > > > ------ BEGIN CODE ---------- > #!/usr/local/bin/gst -f > > Transcript showCr: 'Content-type: text/html'; nl . > '' displayNl . > '<HTML>' displayNl . > '<HEAD><TITLE>Testing CGI/Smalltalk</TITLE></HEAD>' displayNl . > '<BODY>' displayNl . > '<H2>Yo! Smalltalk, Whats up ? </H2>' displayNl . > > env := Smalltalk environ . > env_dict := Dictionary new. > > [ (env_string := env value) isNil ] whileFalse: [ > match := env_string =~ '(.*?)=(.*)'. > env_dict at: (match at: 1) put: (match at: 2). > env incr ]. > > env_sorted := env_dict keys asSortedCollection. > > Transcript nl ; showCr: '==== All Env Vars below ====== <br>'; nl. > env_sorted do: [ :a_key | > Transcript show: a_key . > ans := env_dict at: a_key. > Transcript show: ' = '; show: ans; cr. > ]. > > '</BODY>' displayNl . > '</HTML>' displayNl . > > -------------- END CODE ------ > > > Thanks for the help Paolo and the patience. Hopefully the patch makes it in. > > > cheers, > > mehul > > -- > Mehul N. Sanghvi > email: [hidden email] > -- Mehul N. Sanghvi email: [hidden email] _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk environ-patch.diff (1K) Download Attachment |
On 11/13/2011 05:00 AM, Mehul Sanghvi wrote:
> Doesn't seem like the patch I had sent previously made it in. > > I just did a "git pull" for the first time since March 2011, and the > patch wasn't in there. > > Any chance it can be included ? It is attached to this email. Sure, my mistake. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |