Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6325705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:56:49+00:00 2026-05-24T16:56:49+00:00

I am looking forward to know some best approaches to manage properties files. We

  • 0

I am looking forward to know some best approaches to manage properties files.

We have a set of devices (say N). Each of these devices has certain properties.
e.g.
Device A has properties

A.a11=valuea11

A.a12=valuea12

.

Device B has properties

B.b11=valueb11

B.b12=valueb12
.

Apart from this they have some common properties applicable for all devices.

X.x11=valuex11

X.x12=valuex12

I am writing an automation for running some test suites on these devices. At a time, test script on run on a single device. The device name will be passed as a argument. Based on the device name, code will grab the respective properties and common properties and update the device with these properties. e.g. for device A, code will grab the A.a11, A.a12 (device A specific) and X.x11, X.x12 (common) properties and upload it to the device before running test script.

So, in code, I need to manage these properties so that only device specific and common properties will be uploaded to the device, ignoring the rest one. I am managing it like this

if ($device eq 'A') then
    upload A's properties
elsif ($device eq 'B') then
    upload B's properties
endif

upload Common (X) properties.

Managing device in this way is becoming little bit difficult as the number of devices are keep on increasing.

So I am looking forward for some other best approach to manage these properties.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:56:50+00:00Added an answer on May 24, 2026 at 4:56 pm

    This is a good case where v (aka traits in generalized OOP literature) will be useful.

    Instead of the classical object is a class, with roles an object *does a * role.

    Check out the appropriate Moose docs for way more information.

    Example:

    package Device::ActLikeA;
    use Moose::Role;
    
    has 'attribute' => (
        isa => string,
        is  => 'rw',
        default => 'Apple',
    );
    
    sub an_a_like_method {
        my $self = shift;
    
        # foo
    }
    
    1;
    

    So now I have a role called Device::ActLikeA, what do I do with it?

    Well, I can apply the role to a class, and the code and attributes defined in ActLikeA will be available in the class:

    package Device::USBButterChurn;
    use Moose;
    
    does 'Device::ActLikeA';
    
    # now has an attribute 'attribute' and a method 'an_a_like_method'
    1;
    

    You can also apply roles to individual instances of a class.

    package Device;
    use Moose;
    
    has 'part_no' => (
      isa => 'Str',
      is  => 'ro',
      required => 1,
    );
    
    has 'serial' => {
      isa  => 'Str',
      is   => 'ro',
      lazy => 1,
      build => '_build_serial',
    );
    
    1;
    

    And then main code that looks at the part and applies appropriate roles:

    my @PART_MATCH = (
        [ qr/Foo/,              'Device::MetaSyntacticVariable' ],
        [ qr/^...-[^_]*[A][^-], 'Device::ActLikeA; ],
        [ qr/^...-[^_]*[B][^-], 'Device::ActLikeB; ],
    # etc
    );
    
    my $parts = load_parts($config_file);
    
    for my $part ( @$parts ) {
    
        my $part_no = $part->part_number();
    
        for my $_ (@PART_MATCH) {
            my ($match, $role) = @$_;
            $part->apply_role($role)
               if $part_no =~ /$match/;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking forward to have an update on the following topic as it does
Hey everyone, I'm back and looking forward to more of your brilliance. I have
I was hoping to get some suggestions on some best approaches to develop a
I am looking forward to implement NFC in iPhone. Can anyone share some sample
I have an application on an Apache2. The applications plays some media files like
I have a new set up for software development for iOS devices. I am
I have been looking for a tutorial or a some guidance as to how
Looking for some opinions on this and trying to start pushing forward with a
I am looking forward to serialize a Dictionary in order to save some of
im looking forward for a 3rd part tool/solution that can monitor my server's network

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.