MIDI-Perl 0.77 (basically bugfix) entering CPAN
[email protected] ("Sean M. Burke") Sat, 20 May 2000 18:55:07 -0600
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <[email protected]> |
2000-05-20 Sean M. Burke [email protected] * Release 0.77 * Fixing an incidental bug in MIDI::Simple (which surfaces only in Perl 5.6, apparently). Thanks to Matt Burt ([email protected]) for finding the bug, as well as noting the fix. * Changed MIDI::Score::score_r_to_events_r and MIDI::Score::events_r_to_score_r (which were useful only in list context previously) to do something useful (and rather intuitive) in scalar context. I.e., whereas they used to only do this: ($events_r, $ticks) = MIDI::Score::score_r_to_events_r( $score_r ) ($score_r, $ticks) = MIDI::Score::events_r_to_score_r( $events_r ) They now also do this: $events_r = MIDI::Score::score_r_to_events_r( $score_r ) $score_r = MIDI::Score::events_r_to_score_r( $events_r ) (Previously if you tried the calls with the latter, scalar, contexts, you'd get just the number "2" in $events_r or $score_r.) Also added this rumination in the MIDI::Simple docs that may be of interest to folks on the list: (Author's note, two years later: all this business of returning lists of various sizes, with this and other functions in here, is basically a workaround for the fact that there's not really any such thing as a boolean context in Perl -- at least, not as far as user-defined functions can see. I now think I should have done this with just returning a single scalar value: a number (which could be 0!) if the input is a number, and undef/emptylist (C<return;>) if not -- then, the user could test: # Hypothetical -- # This fuction doesn't actually work this way: if(defined(my $note_val = is_relative_note_spec($string))) { ...do things with $note_val... } else { print "Hey, that's no note!\n"; } However, I don't anticipate users actually using these messy functions often at all -- I basically wrote these for internal use by MIDI::Simple, then I documented them on the off chance they I<might> be of use to anyone else.) [This reminds me of the problem of returning multiple values in Lisp, to which a long section in /The Evolution of Lisp/ is dedicated. I have a PS and PDF copy in http://www.speech.cs.cmu.edu/~sburke/pub/ It's very intersting reading.] -- Sean M. Burke [email protected] http://www.spinn.net/~sburke/