Question one: Is there anyway i could easily start/stop a process from perl?

Isn't the problem that you don't know the pid to kill?

Just a suggestion - maybe it would be easier to have perl streaming the current mp3 to a fifo, and have mpg123 play that? See the .signature example in perlipc for a working example.

Question two: Is there anyway to convince perl to read/write mp3 files without dying

You were already on the right track :)

Here's an example of what I meant in 199077:

adam@2cb:~$ perl -e 'open F, "nofx - falling in love.mp3"; binmode F; +open G, ">bleh"; binmode G; while(<F>) { print G; } ' adam@2cb:~$ ls -la nofx\ -\ falling\ in\ love.mp3 bleh -rw-r--r-- 1 adam users 5011330 Sep 20 13:00 bleh -rw-r--r-- 1 adam users 5011330 Jan 24 2002 nofx\ -\ falli +ng\ in\ love.mp3 adam@2cb:~$ cksum nofx\ -\ falling\ in\ love.mp3 bleh 2095826934 5011330 nofx - falling in love.mp3 2095826934 5011330 bleh

The original/new files end up exactly the same - perl is handling the binary data just fine.

update: added binmode G;. example was only working without it because i'm a linux weenie?


In reply to Re: Mp3 PLayer. Part Two! by panix
in thread Mp3 PLayer. Part Two! by BUU

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.