in reply to Re^2: IO::Socket and passed variables to functions
in thread IO::Socket and passed variables to functions

A handy tool for checking weird output is the od command. If you pipe your output to od -c you will see all the non-printing characters. When I did this with your server (having added a print of what came in to $buf from the socket) I saw the following.

0000000 L i s t e n i n g f o r c +o 0000020 n n e c t i o n s o n p o +r 0000040 t 8 8 8 8 \n b u f = " C +S 0000060 C \r " \n 0000064

Applying the fix oshalla recommended solved the problem.

The od command is usually installed on *nix systems and is available for Windows.

I note also that you are interpolating whatever text you receive from the socket into your SQL statement without any validation. Consider what will happen if a nasty fragment of SQL was entered rather than a group name. You might lose data.

A good habit is to always check your data from external sources to make sure it is valid. And you might use place holders in your SQL statement rather than interpolating the group name into the string to further reduce the risk.

Replies are listed 'Best First'.
Re^4: IO::Socket and passed variables to functions
by onegative (Scribe) on Dec 17, 2008 at 04:33 UTC
    Solved using the substitution as opposed to the chomp.

    DOG GONE! Now I just feel stupid! Yes I assumed chomp would do what it obviously didn't do...and I was making the issue harder than it actually was...a lesson learned.

    I also change the interpolating directly into the SQL Statement to use a placeholder with a validation check of the initial passed groupName from the client.

    Thanks for y'alls help on this...I really appreciate it.

    Many thanks,
    Danny