Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

heavy perl

by Miker (Scribe)
on Aug 23, 2000 at 05:32 UTC ( [id://29138] : perlquestion . print w/replies, xml ) Need Help??

Miker has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I'm new to Perl and programming in general. I know how to make a database, use modules, regex, all the basics. But now I want to go a bit beyond:) I have downloaded the xaudio SDK, which says that I can use Perl to make an MP3 encoder/player. But as I was looking through the docs I realized I was in way over my head. This doesn't look like friendly Perl hehe. Can anyone point me to a book (I have the cookbook and learning and programming, all great) or web site that tells me how to dig in to some harder stuff, but doesn't blow me out of the water right off the bat? Or even if you want to tell me that Perl is not right for this type of thing. Anything that will get me over this hurdle. I love writting my little system maintainence programs but would love to do something "big". Thanks all for any input:) Miker

Replies are listed 'Best First'.
Re: heavy perl
by Russ (Deacon) on Aug 23, 2000 at 06:00 UTC
    My favorites:
    • Effective Perl Programming (teaches idiomatic Perl)
    • Advanced Perl Programming (just like it sounds)
    • Object-Oriented Perl (discusses many cool advanced topics, not just OO)
    • Mastering Algorithms with Perl (any MP3 code will likely make use of concepts in this book)
    Now, that said, I'm not sure there's much that any book can do to help you understand difficult Perl. My advice for how to learn to read difficult Perl: write difficult Perl. Make every line of your code count. Learn something in each construct you fashion. There's always some way to write it shorter, so go find it.

    Of course, this will largely result in the opposite of easily readable, maintainable code. But, you'll be surprised at how much of that "difficult" code becomes just "normal" after a short time of writing "power Perl." Constructs you used to consider obtuse will soon be just common.

    Brainbench 'Most Valuable Professional' for Perl

RE: heavy perl
by BlueLines (Hermit) on Aug 23, 2000 at 06:50 UTC
    This doesn't look that hard though. According to the docs, something like this should work (I'll never know because I can't find the module anywhere on their site):
    #!/usr/bin/perl -w use strict; use MPEG::MP3Play; my ($mp3_file)=@ARGV; print "Going to play $mp3_file...\n"; my $mp3=new MPEG::MP3Play (debug => 'all'); $mp3->open($mp3_file); $mp3->play; print "Finished playing $mp3_file\n";
    I guess the tricky part is in dealing with the messge queue(??!!) from the SDK. Anyhow, this seems to be a very well documented module. I'm not sure what to tell you if you're having problems other than to read through all of the docs...


    Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.
RE: heavy perl
by ZZamboni (Curate) on Aug 23, 2000 at 06:59 UTC
    Apart from what Russ said, I would suggest taking it one line at a time. Go through the docs. For every piece of syntax of construct that you don't understand, research it (look in the Perl documentation, in your books, or ask here) until you do. Then proceed. Sometimes you can get a good general idea of what a piece of code does without really understanding the details, so take your time to dissect the code shown in the documentation and understand it thouroughly. You will learn a lot in the process, not only about your MP3 module, but about Perl programming in general.


Re: heavy perl
by Anonymous Monk on Aug 23, 2000 at 06:20 UTC
Re: heavy perl
by Nooks (Monk) on Aug 23, 2000 at 15:48 UTC
    Read Abigail's collection of JAPHs---I'm not sure if there is a collection online, but if you search at DejaNews you'll find lots. Almost without exception they illustrate some important, interesting or surprising feature of the language and they're short and not too hard to understand.
Addendum to reading list
by moo (Acolyte) on Aug 23, 2000 at 20:30 UTC
    Software Engineering with Ada by Grady Booch and Doug Bryan 
    provides an excellent foundation for understanding object 
    oriented programming..."heavy Perl," if you will.  
    It's about the thought process behind the coding and will 
    help you understand the symantic of much of the code that 
    passes through this site.  Booch also provides a method for 
    designing programs...very important stuff for the beginner.
    As you grow, you will choose to use or discard Booch's 
    suggestions for design and implementation.
    It was my first computer book and I use it extensively 
    in my Perl programming.  I just ignore the Ada and generate
    Perl for the examples.
Re: heavy perl
by Miker (Scribe) on Aug 23, 2000 at 07:58 UTC
    Thanks to everyone, I think I will dig in to the docs a bit more. What was tripping me up was I think some of the Perl I thought I had a handle on, so I think I'll pick their Perl script apart and get to know all of its nuances, and go from there. Thanks for pointing me in the right direction. Oh and the book list is perfect, Russ:) Those are some of the ones I was thinking about getting, it helped make up my mind.
Re: heavy perl
by Miker (Scribe) on Aug 23, 2000 at 10:15 UTC
    UPDATE: I read a bit more of the docs for xaudio and went back and forth with that and perltoot when i got lost, and I'm getting it:) I have a really crude "thing" that plays, stops and even seeks through a file (mp3) Thanks again, very very much all, I probably would have given up in frustration without the push in the right direction. Now I can keep plugging away at this and get something good going:) Miker