Re: need help in tutorial(alpha)



On Thu, 2006-05-18 at 03:41 +0200, A. Pagaltzis wrote:
* Mat Wilson <mat jnm com au> [2006-05-18 03:10]:
        # We do not have a Glib::CLAMP function, so we provide it here.
        sub clamp ($val, $low, $high)

That is a syntax error in Perl.

Yep, my bad.  I had the patch to fix it sitting in my inbox for a while
and never really got around to apply it to CVS.

        {
            return (($val > $high) ? $high : (($val < $low) ? $low : $val));
        }

    use List::Util qw( min max );
    # ...
    return min $low, max $high, $val;

clamp() is the direct porting of the GLib CLAMP() macro.

I think the error is the lines

            # This sets the adjustment and make it emit the "changed" signal to
            # reconfigure all the widgets that are attached to this signal.
            $set->set_value(clamp ($set->value,
                                   $set->upper - $set->page_size,
                                   $set->lower));
        
to do with the commas

I donât see any error in there.

... as it's working in C. ;-)

Ciao,
 Emmanuele.

-- 
Emmanuele Bassi - <ebassi gmail com>
Log: http://log.emmanuelebassi.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]