Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

RE: MP3 server with IO::Socket

by antihec (Sexton)
on Jun 03, 2000 at 16:50 UTC ( #16182=note: print w/ replies, xml ) Need Help??


in reply to MP3 server with IO::Socket

There seems to be a minor issue with the open Statement in Line 55.
If you write it as open( PLAYLIST, "<playlist.m3u" ) || die "Can't open playlist: $!";, it will do what you mean. In its current form it evaluates to open PLAYLIST, ("playlist.m3u" || die);, I think.

The print doesn't return 0, for me it returns undef, so I changed line 118 to unless( defined( $print_status )) to get rid of "uninitialized value"

Thanks for sharing this nice code, btw! :-)

-- bash$ :(){ :|:&};:


Comment on RE: MP3 server with IO::Socket
Select or Download Code
RE: RE: MP3 server with IO::Socket
by perlmonkey (Hermit) on Jun 04, 2000 at 07:08 UTC
    Thanks for your comments. I was surprised, but you seem to be correct on the open statement. In the perlopentut document the two different syntax's used are:
    open FILE, "foo.txt" or die $!; #or open(FILE, "foo.txt") || die $!;
    I did not realize that perl would parse 'or' and '||' differently.

    As for the print, you are also correct, but fortunately my logic still worked. print returns undef if it failed, but the logic still held because if you use the numeric operator '==' on undef it is equivalent to 0. So this code will work: print "hello\n" if undef == 0; But I modified the code as you suggested to be more explicit.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://16182]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-08-28 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (260 votes), past polls