mothra vs. Win32::GUI

mothra on 2002-05-02T14:36:56

I love getting the chance to use for()'s on scalars when they make sense. For example, it was nice to be able to do this:

    for ($wind_dir) {
        s/north/N/ig;
        s/south/S/ig;
        s/west/W/ig;
        s/east/E/ig;
    }

in my tooltip weather reporting program. Oh, the little things...

Two problems yet remain though:

  1. A non-wheel-reinvention compliant and intelligent way of converting the UTC time of the report to the local time of the weather station whose report is being viewed. By "intelligent" I simply mean I don't want the user to even notice that I magically converted UTC to their local time; it should just Do The Right Thing.

  2. Making a system-tray-icon-only application out of it all, whose tooltip is -- wouldn't you know -- the current weather.

Win32::GUI isn't the easiest thing in the world when you're unfamiliar with it.


Regex

djberg96 on 2002-05-02T19:56:49

I reduced your regex to this:
for($wind_dir){
   s/(\w).*/uc($1)/ige;
}

Re:Regex

mothra on 2002-05-03T00:24:07

That's broken, because the wind direction "Northeast" must be turned into "NE".

Re:Regex

vsergu on 2002-05-03T14:45:08

Obviously it should be

$wind_dir =~ s/(.)..th?/\U$1/gi;

Re:Regex

mothra on 2002-05-03T15:40:44

If your goal is to save lines/characters, sure. For the year down the road when I have to come back and fix something, I'll be happy to leave it the way I have it. :)

Re:Regex

vsergu on 2002-05-03T16:39:56

I wasn't serious. Being a TPR golf tournament judge is warping me.