Sponsored Content
Full Discussion: Thank you members and admins
The Lounge What is on Your Mind? Thank you members and admins Post 302963558 by Peasant on Saturday 2nd of January 2016 11:18:43 PM
Old 01-03-2016
Thank you members and admins

Got a raise and a formal position of 'unix system engineer' in 2016.
I would like to thank you members and admins.
This would not be possible without you.

I will mention some..

Thank you Don, for making me learn and understand the importance of standards, which i try to apply as much as i can in my code and advise others to do the same.

Thanks Scrutinizer, RudiC, vgersh, Corona for good awk/shell/C programs from which i have learned so much. I enjoy reading your responses and learn something each time.

Thanks Jillagre, Duke, vbe, achenle,Madeingermany for being explanatory and giving good advices on Solaris and HPUX subforums. No documentation can replace real life experience which you have and share.

At the end i would like to thank everyone i perhaps missed or haven't explicitly mentioned.

Feel free to contact me if you are ever in Croatia, for a good BBQ and beers on my account Smilie

Keep up the good work.
Regards
Peasant.
These 9 Users Gave Thanks to Peasant For This Post:
 

5 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Admins >

Just wanted to say great website and thank you... (0 Replies)
Discussion started by: 98_1LE
0 Replies

2. Post Here to Contact Site Administrators and Moderators

admins and moderators..

hi admins and moderators, thread :https://www.unix.com/showthread.php?t=20620 my first thread in the forum.. i thought of some other answer. i like to tell you to delete that thread.. or tell anyother answer.. (1 Reply)
Discussion started by: sekar sundaram
1 Replies

3. Solaris

Any sys admins from uk?

Hello Guys, im new to this forum. Im from UK and ive recently completed my SCSA I & II and also got trained in Veritas Suite (Veritas Volume Manager and Veritas Clusters, Veritas NetBackup), SAN Configuration. I was trying to get a break as a junior sun solaris admin. I am applying for the jobs... (1 Reply)
Discussion started by: megadeth
1 Replies

4. High Performance Computing

Guides for new HPC admins

In my company, it's fallen on me to serve as the admin of our new HPC cluster, a task that's very new to me. It's very important to me to lay a solid foundation and avoid any unnecessary pitfalls. So, can anyone recommend a succinct guide or list of do's-and-don'ts for adiminstering an HPC cluster?... (0 Replies)
Discussion started by: DBryan
0 Replies

5. Post Here to Contact Site Administrators and Moderators

For the Admins, rouge advert(s)...

Hi guys this problem exists on all my machines... Windows 8.1, Ubuntu, iMac and this MBP. All use fireFox, latest current version. If I log in there is NOT a problem. I usually enter this site as an outsider and I have noticed that there is some rouge code and/or advert that slows the... (5 Replies)
Discussion started by: wisecracker
5 Replies
Moose::Manual::BestPractices(3) 			User Contributed Perl Documentation			   Moose::Manual::BestPractices(3)

NAME
Moose::Manual::BestPractices - Get the most out of Moose VERSION
version 2.0604 RECOMMENDATIONS
Moose has a lot of features, and there's definitely more than one way to do it. However, we think that picking a subset of these features and using them consistently makes everyone's life easier. Of course, as with any list of "best practices", these are really just opinions. Feel free to ignore us. "namespace::autoclean" and immutabilize We recommend that you remove the Moose sugar and end your Moose class definitions by making your class immutable. package Person; use Moose; use namespace::autoclean; # extends, roles, attributes, etc. # methods __PACKAGE__->meta->make_immutable; 1; The "use namespace::autoclean" bit is simply good code hygiene, as it removes imported symbols from your class's namespace at the end of your package's compile cycle, including Moose keywords. Once the class has been built, these keywords are not needed. (This is preferred to placing "no Moose" at the end of your package). The "make_immutable" call allows Moose to speed up a lot of things, most notably object construction. The trade-off is that you can no longer change the class definition. Never override "new" Overriding "new" is a very bad practice. Instead, you should use a "BUILD" or "BUILDARGS" methods to do the same thing. When you override "new", Moose can no longer inline a constructor when your class is immutabilized. There are two good reasons to override "new". One, you are writing a MooseX extension that provides its own Moose::Object subclass and a subclass of Moose::Meta::Method::Constructor to inline the constructor. Two, you are subclassing a non-Moose parent. If you know how to do that, you know when to ignore this best practice ;) Always call the original/parent "BUILDARGS" If you "override" the "BUILDARGS" method in your class, make sure to play nice and call "super()" to handle cases you're not checking for explicitly. The default "BUILDARGS" method in Moose::Object handles both a list and hashref of named parameters correctly, and also checks for a non- hashref single argument. Provide defaults whenever possible, otherwise use "required" When your class provides defaults, this makes constructing new objects simpler. If you cannot provide a default, consider making the attribute "required". If you don't do either, an attribute can simply be left unset, increasing the complexity of your object, because it has more possible states that you or the user of your class must account for. Use "builder" instead of "default" most of the time Builders can be inherited, they have explicit names, and they're just plain cleaner. However, do use a default when the default is a non-reference, or when the default is simply an empty reference of some sort. Also, keep your builder methods private. Be "lazy" Lazy is good, and often solves initialization ordering problems. It's also good for deferring work that may never have to be done. Make your attributes "lazy" unless they're "required" or have trivial defaults. Consider keeping clearers and predicates private Does everyone really need to be able to clear an attribute? Probably not. Don't expose this functionality outside your class by default. Predicates are less problematic, but there's no reason to make your public API bigger than it has to be. Avoid "lazy_build" As described above, you rarely actually need a clearer or a predicate. "lazy_build" adds both to your public API, which exposes you to use cases that you must now test for. It's much better to avoid adding them until you really need them - use explicit "lazy" and "builder" options instead. Default to read-only, and consider keeping writers private Making attributes mutable just means more complexity to account for in your program. The alternative to mutable state is to encourage users of your class to simply make new objects as needed. If you must make an attribute read-write, consider making the writer a separate private method. Narrower APIs are easy to maintain, and mutable state is trouble. In order to declare such attributes, provide a private "writer" parameter: has pizza => ( is => 'ro', isa => 'Pizza', writer => '_pizza', ); Think twice before changing an attribute's type in a subclass Down this path lies great confusion. If the attribute is an object itself, at least make sure that it has the same interface as the type of object in the parent class. Don't use the "initializer" feature Don't know what we're talking about? That's fine. Use Moose::Meta::Attribute::Native traits instead of "auto_deref" The "auto_deref" feature is a bit troublesome. Directly exposing a complex attribute is ugly. Instead, consider using Moose::Meta::Attribute::Native traits to define an API that only exposes the necessary pieces of functionality. Always call "inner" in the most specific subclass When using "augment" and "inner", we recommend that you call "inner" in the most specific subclass of your hierarchy. This makes it possible to subclass further and extend the hierarchy without changing the parents. Namespace your types Use some sort of namespacing convention for type names. We recommend something like "MyApp::Type::Foo". We also recommend considering MooseX::Types. Do not coerce Moose built-ins directly If you define a coercion for a Moose built-in like "ArrayRef", this will affect every application in the Perl interpreter that uses this type. # very naughty! coerce 'ArrayRef' => from Str => via { [ split /,/ ] }; Instead, create a subtype and coerce that: subtype 'My::ArrayRef' => as 'ArrayRef'; coerce 'My::ArrayRef' => from 'Str' => via { [ split /,/ ] }; Do not coerce class names directly Just as with Moose built-in types, a class type is global for the entire interpreter. If you add a coercion for that class name, it can have magical side effects elsewhere: # also very naughty! coerce 'HTTP::Headers' => from 'HashRef' => via { HTTP::Headers->new( %{$_} ) }; Instead, we can create an "empty" subtype for the coercion: subtype 'My::HTTP::Headers' => as class_type('HTTP::Headers'); coerce 'My::HTTP::Headers' => from 'HashRef' => via { HTTP::Headers->new( %{$_} ) }; Use coercion instead of unions Consider using a type coercion instead of a type union. This was covered in Moose::Manual::Types. Define all your types in one module Define all your types and coercions in one module. This was also covered in Moose::Manual::Types. BENEFITS OF BEST PRACTICES
Following these practices has a number of benefits. It helps ensure that your code will play nice with others, making it more reusable and easier to extend. Following an accepted set of idioms will make maintenance easier, especially when someone else has to maintain your code. It will also make it easier to get support from other Moose users, since your code will be easier to digest quickly. Some of these practices are designed to help Moose do the right thing, especially when it comes to immutabilization. This means your code will be faster when immutabilized. Many of these practices also help get the most out of meta programming. If you used an overridden "new" to do type coercion by hand, rather than defining a real coercion, there is no introspectable metadata. This sort of thing is particularly problematic for MooseX extensions which rely on introspection to do the right thing. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.2 2012-09-19 Moose::Manual::BestPractices(3)
All times are GMT -4. The time now is 03:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy