Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Okay folks, here is the results of playing with this idea:

  • Don't trust Windows, well to be specific, don't trust Perl in Windows to return what you think it should return. In my case I am developing in Komodo, so when I have Komodo run the programme, the value of $0 is something else altogether!
  • If I use PerlApp from Komodo (which I do anyway) then $0 returns a sensibble value. BUT JediWizard the exec($0); doesn't work as you would expect. But purely using exec("appname.exe"); works just fine.
  • Now, sgifford: I have packaged the app using PerlApp. This is some testing code:
    unlink 'appname_old.exe'; rename ( 'appname.exe', 'appname_old.exe'); use Win32; my $localdir = Win32::GetCwd(); print "My idea of a local directory: " . $localdir . "\n"; print "I think I am program: $0 \n"; use Net::FTP; my $ftp = Net::FTP->new( "myftpserver.net", Timeout => 30, Debug => 0 ) or warn "Can't connect: $@\n"; $ftp->login( 'anonymous', 'guest') or die "Couldn't authenticate"; $ftp->cwd("/pub"); $ftp->type( "I" ); $ftp->get('appname.exe'); $ftp->quit; debug( "Quitting, restart programme please." ); exec("appname.exe");
    As you can see with the programme running I renamed the .exe file, and then copied a new file from the ftp server with the same name. So that all worked nicely.
  • Now waswas-fng suggests using PAR and running with parts of the programme remote. That's a neat idea. My application packages nicely with PAR and the idea of caching in-between is rather nice. I will lookinto it, thank you!
  • Now finally, Zero_Flop, thanks for the suggestion. Sadly, these folk are typical Windows users - ask them to open a command prompt and they go all glassy-eyed on you!
Once again to all of you, thank you!

jdtoronto


In reply to Re: Windows - have program replace itself by jdtoronto
in thread Windows - have program replace itself by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found