It's my complete content.
Because use pp packing my script is so slowly, so i use perlapp
my script mongo.pl:
#!/usr/bin/perl -w
use strict;
use MongoDB;
use MongoDB::Connection;
use MongoDB::Database;
# mongodb
my $conn = MongoDB::Connection->new(host => '127.0.0.1:27017',
+ query_timeout => 1000 * 6000);
my $db = $conn->ygzj_dev;
print "$db";
Use "perl mongo.pl" it print "MongoDB::Database=HASH(0x33b2e8)", It worked fun.
when I use perlapp compiling it to exe,My command is "perlapp --shared public --norunlib --gui --verbose --warnings --exe mongo.exe mongo.pl", perlapp generate a mongo.exe and there have 5 warnings ,the warnings is:
<1>
Devel\GlobalDestruction.pm:
warn: auto\Devel\GlobalDestruction\GlobalDestruction.dll not found
refby: C:\Perl64\lib\Moose\Meta\Role.pm line 16
refby: C:\Perl64\lib\Moose\Object.pm line 14
refby: C:\Perl64\lib\Moose\Meta\Method\Destructor.pm line 13
refby: C:\Perl64\lib\Class\MOP\Package.pm line 15
file: C:\Perl64\lib\Devel\GlobalDestruction.pm
....
....
<2>
Mouse\Util.pm:
warn: auto\Mouse\Util\Util.dll not found
refby: C:\Perl64\site\lib\Mouse.pm line 11
refby: C:\Perl64\site\lib\Mouse\Meta\Attribute.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Class.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Module.pm line 2
refby: C:\Perl64\site\lib\Mouse\Util\TypeConstraints.pm line 2
refby: C:\Perl64\site\lib\Mouse\Object.pm line 2
refby: C:\Perl64\site\lib\Mouse\Exporter.pm line 17
refby: C:\Perl64\site\lib\Mouse\Meta\Role.pm line 2
refby: C:\Perl64\site\lib\Mouse\PurePerl.pm line 11
refby: C:\Perl64\site\lib\Mouse\Meta\TypeConstraint.pm line 2
refby: C:\Perl64\site\lib\Mouse\Util\MetaRole.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Role\Composite.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Role\Application.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Method\Destructor.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Method\Constructor.pm line 2
refby: C:\Perl64\site\lib\Mouse\Meta\Method\Accessor.pm line 2
file: C:\Perl64\site\lib\Mouse\Util.p
....
....
<3>
Perl\Tidy.pm:
warn: Can't locate Perl\Tidy.pm
refby: C:\Perl64\lib\Eval\Closure.pm line 151
...
...
<4>
SetDualVar.pm:
warn: Can't locate SetDualVar.pm
refby: C:\Perl64\lib\Win32\TieRegistry.pm line 39
...
...
<5>
VMS\Feature.pm:
warn: Can't locate VMS\Feature.pm
refby: C:\Perl64\lib\Cwd.pm line 211
I have already installed Mouse, Devel-GlobalDestruction, VMS-FileUtils..., I think these all warning msg is not important, Because when I compiled other script also had some warnings. When I executed the mongo.exe file,there have run error, error msg:
{.\mongo.exe}
Could not find a suitable Params::Validate implementation: Can't locat
+e Params/Validate/XS.pm in @INC (@INC contains:) at /<C:\Users\Admini
+strator\Desktop\tmp\mongo.exe>Module/Runtime.pm line 317.
Can't locate Params/Validate/PP.pm in @INC (@INC contains:) at /<C:\Us
+ers\Administrator\Desktop\tmp\mongo.exe>Module/Runtime.pm line 317.
at /<C:\Users\Administrator\Desktop\tmp\mongo.exe>Params/Validate.pm
+line 66.
BEGIN failed--compilation aborted at /<C:\Users\Administrator\Desktop\
+tmp\mongo.exe>DateTime/Duration.pm line 12.
BEGIN failed--compilation aborted at /<C:\Users\Administrator\Desktop\
+tmp\mongo.exe>DateTime.pm line 43.
BEGIN failed--compilation aborted at /<C:\Users\Administrator\Desktop\
+tmp\mongo.exe>MongoDB/GridFS.pm line 24.
BEGIN failed--compilation aborted at /<C:\Users\Administrator\Desktop\
+tmp\mongo.exe>MongoDB/Database.pm line 23.
BEGIN failed--compilation aborted at mongo.pl line 5.
I have allready installed "Params-Validate
Validate method/function parameters", Can I compile the script to exe file with could execute. You can test it. my os is windows7 64 bit, my perl is 5.16(active state perl), Thank you very much!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.