Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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";

Comment on Sockets and Perl App
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053307]
Front-paged by Arunbear
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: (7)
As of 2014-07-12 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls