Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: Modulino to report ip address changes by stevieb
in thread Modulino to report ip address changes by davies

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 admiring the Monastery: (5)
As of 2024-04-24 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found