Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Modulino to report ip address changes

by stevieb (Canon)
on Oct 04, 2022 at 03:18 UTC ( #11147239=note: print w/replies, xml ) Need Help??

in reply to Modulino to report ip address changes

I (think) I have something similar to what you're trying to do. It's a module. I, like others, like to keep modules and binaries separate. In all my distributions that require a user usable binary, I just add it in so it gets installed. To do so, I do this in the Makefile.PL script:

my %WriteMakefileArgs = ( NAME => 'Addr::MyIP', AUTHOR => q{Steve Bertrand <>}, VERSION_FROM => 'lib/Addr/', ABSTRACT_FROM => 'lib/Addr/', LICENSE => 'artistic_2', EXE_FILES => [qw(bin/myip)], ...

... see the last line? That will install the distribution's myip binary located in the distribution's bin directory into their path.

My Addr::MyIP is one such module. The core of the functionality is in the Addr::MyIP library, and the script mentioned above is separate. This keeps my code nice and clean.

fwiw, I wrote that distribution (which fetches my devices public IP address) so that I can maintain VPN connections on the locations I have equipment even if they have dynamic/changing addresses.

I call that code from the update-ip binary in my Net::DNS::GoDaddy library, which then updates certain DNS A records for me through GoDaddy's API, so all of my locations are always up-to-date with their current public IP address. I can always use '' for my home VPN connection etc.

Having the two files separate also makes it easier for others to hack at them, and for me to review the patches or pull requests. Documentation is separate, tests are separate, less chance I break one and not the other, and it doesn't have the feeling like there's executable code inside of a library. A library is to be read, not executed (imho), and executing a .pm file just seems so very wrong.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147239]
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: (6)
As of 2023-03-28 21:02 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (69 votes). Check out past polls.