Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Sockets and Perl App

by Anonymous Monk
on Sep 10, 2013 at 15:59 UTC ( #1053307=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've written a perl script which reads from and writes to a MySQL database, and appears to work correctly. However, when I convert it to a standalone executable with PerlApp, the executable cannot connect to the database. Looking at both programs in a debugger, they behave identically until a call to the function "socket", which fails in the the PerlApp executable, but not in the script. The error message when it fails is "An invalid argument was supplied.", but the same arguments were supplied in both cases.

A minimal version of the script that illustrates the problem is given below. As far as I can, I have checked that all of the modules called by the script have been included in the PerlApp executable: I don't know where the function "socket" is defined, so I haven't been able to check that. I'm running on Windows 7, if that makes a difference.

#! C:/perl5.14/bin/perl.exe use Socket; $proto = getprotobyname('tcp'); my($sock); socket($sock, AF_INET, SOCK_STREAM, $proto) or die $!; print "Success\n";

Replies are listed 'Best First'.
Re: Sockets and Perl App
by Anonymous Monk on Sep 10, 2013 at 18:29 UTC
    'socket()' should be defined by "use Socket." FYI, on my Linux and OS/X systems your one-liner works properly as-written.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053307]
Front-paged by Arunbear
[Veltro]: Corion OK, thanks. At least I understand it now.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2018-05-23 11:29 GMT
Find Nodes?
    Voting Booth?