Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Modulino to report ip address changes

by stevieb (Canon)
on Oct 04, 2022 at 03:18 UTC ( [id://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 <steveb@cpan.org>}, VERSION_FROM => 'lib/Addr/MyIP.pm', ABSTRACT_FROM => 'lib/Addr/MyIP.pm', 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 'home.domain.com' 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147239]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-20 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found