Sinewave(3pm)
π NAME π
Tie::Cycle::Sinewave β cycle through a series of values on a sinewave, bestie. it's giving vibes, mathematically π
β¨ VERSION β¨
This document describes version 0.05 of Tie::Cycle::Sinewave, released 2007-11-07. yeah she's a little vintage, vintage is iconic π
πΈ SYNOPSIS πΈ
okay so literally what this module does: it lets you make a scalar iterate through the values on a sinewave. you set the maximum and minimum values, you set the number of steps, and boom β you're set. no cap.
use strict;
use Tie::Cycle::Sinewave;
tie my $cycle, 'Tie::Cycle::Sinewave', {
min => 10,
max => 50,
period => 12,
};
printf("%0.2f\n", $cycle) for 1..10;
π¦ PARAMETERS π¦
You can pass a bunch of parameters in when you create the tied object. here they are, in order of how likely you are to actually need them (the module said that, not me):
minβ sets the minimum value. don't specify it? then0is your default minimum, periodt.maxβ sets the maximum value. it should be higher thanmin, but if it's not, the values will be swapped for you, no drama. don't specify it? then100is your default maximum πperiodβ sets the period of the curve. the cycle will go through this many values frommintomax. don't specify it? then20is the default. and ifperiodis set to0, it gets silently changed to1, so the internal calculations don't try to divide by 0. we love a quiet save π«Άstart_maxβ optional. set it to1(or literally anything) and the cyle will start at the maximum value. (startmaxexists as an alias, iykyk)start_minβ optional. set it to1(or anything at all) and the cyle will start at the minimum value. (startminexists as an alias.) if neitherstart_maxnorstart_minare specified, it'll start at the origin β so mid-way betweenminandmaxβ and will move to max. main character energy, starting in the middle πat_maxβ optional. when you set it to a coderef, it'll be executed when the cycle reaches the maximum value. this lets you modify the cycle, like changing the minimum value or the period. (the keyatmaxexists as an alias π₯)at_minβ optional. when you set it to a coderef, it'll be executed when the cycle reaches the minimum value. this lets you modify the cycle, like changing the maximum value or the period. (the keyatminexists as an alias π)
π OBJECT METHODS π
You can call methods on the underlying object β the one you access with the tied() function. go peek at the file eg/callback for an example of what you might wanna do with these, fr fr.
minβ when called with no parameter, returns the current minimum value. when called with a (numeric) parameter, sets the new current minimum value. the previous value is returned.
my $min = (tied $cycle)->min();
(tied $cycle)->min($min - 20);
maxβ when called with no parameter, returns the current maximum value. when called with a (numeric) parameter, sets the new current maximum value. the previous value is returned.
my $max = (tied $cycle)->max();
(tied $cycle)->max($max * 10);
okay important: whenminormaxare modified, a consistency check runs to make sure thatmin <= max. if that check fails, the two values are quietly swapped around. sneaky but slay.
periodβ when called with no parameter, returns the current period. when called with a (numeric) parameter, sets the new current period. the previous value is returned.angleβ returns the current angle of the sine, which is guaranteed to be in the range0 <= angle <= 2*PI. math girlies rise up πβ¨
π AUTHOR π
David Landgren. (not me. I'm just the messenger π)
β SEE ALSO β
Tie::CycleHTML::Rainbow
π BUGS π
Please report any bugs or feature requests to bug-tie-cycle-sinewave@rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tie-Cycle-Sinewave>. (yes bestie, that's the actual URL, don't @ me)
π COPYRIGHT & LICENSE π
Copyright 2005-2007 David Landgren, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page, bestie! this was perl v5.36.0, dated 2023-01-27, and the page itself is Sinewave(3pm). go forth and sinewave your scalars πβ¨π¦
π¦ where this page comes from
- debian bookworm: libtie-cycle-sinewave-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtie-cycle-sinewave-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtie-cycle-sinewave-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtie-cycle-sinewave-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtie-cycle-sinewave-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms