Perl and Object Oriented Development

I am new to the Perl syntax but have used OOP from Pascal, to C++ to C#.

Can you give me an example of the syntax for using OOP in Perl?

Thanks.
newbiewebSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wilcoxonCommented:
Are you talking about Perl 5 (probably) or Perl 6?

If Perl 5, what sort of OOP do you want to use in Perl?  The built-in OOP is limited compared to a lot of other languages.  Most OOP people highly recommend Moose (or derivatives) for OOP.

If Perl 6, it has much better built-in OOP.

Honestly, I'm not the best person to give examples of any of the Perl OOP as I rarely use OOP.
Dan CraciunIT ConsultantCommented:
Perl has it's own vocabulary. You'll have to map the concepts to what you've learned.

Here is a quick tutorial: http://www.tutorialspoint.com/perl/perl_oo_perl.htm

HTH,
Dan
newbiewebSr. Software EngineerAuthor Commented:
I would use the latest version of Perl, I presume.

I am trying to learn how I would code a report analysis tool which would "consume" the data from a merchant credit card statement, make some calculations, and output an analysis of that report.

PCI issues aside, I have a high bar on getting the technology to handle this logic and would feel much more comfortable knowing whether the OOP support of Perl is up for the task.
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

wilcoxonCommented:
If you want to use Perl 6, the core OOP documentation is at https://docs.perl6.org/language/objects

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wilcoxonCommented:
The documentation link provided by Dan is to the built-in Perl 5 OOP.  For Perl 5 Moose OOP, one tutorial is https://perlmaven.com/object-oriented-perl-using-moose
newbiewebSr. Software EngineerAuthor Commented:
Is it better to use Perl 6 and the built-in OOP capabilities?

Or, Perl 5 and Moose?

It seems Perl 6 skills would be more re-usable, no?
NorieAnalyst Assistant Commented:
Is Perl 6 the latest version of Perl?
newbiewebSr. Software EngineerAuthor Commented:
Here is what they say at Perl.Org

https://www.perl.org/

"Perl 6 is a sister language, part of the Perl family, not intended as a replacement for Perl 5, but as its own thing - libraries exist to allow you to call Perl 5 code from Perl 6 programs and vice versa."

So, that raise the question, which version if better for me to try and master? I want to have the best OOP capabilities available with Perl.
ozoCommented:
Perl6 is a sister language to Perl5, not a version of Perl5. The latest version of Perl5 at this time is 5.26.1, the latest release of Perl6 is Rakudo Star 2017.10
newbiewebSr. Software EngineerAuthor Commented:
So, is this something like a "fork" in the language? Will Perl 5 and Perl 6 continue on with its own unique features?

Why could they not make Perl6 the new version of Perl5?

Are there features which are mutually exclusive? Where Perl6 contains features which would replace still viable features in Perl?

I think understanding this "split" is key before I choose which to use...

Thanks.
serialbandCommented:
Why PERL?  Why not Python?
phoffric\Commented:
Is that python 2.7.x or 3.3.x? They are  a fork in the road and at least  year ago, my group did not know of anything that bound them together.
http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html

Nevertheless, python is becoming much more popular as perl wanes.
https://www.fastcompany.com/3026446/the-fall-of-perl-the-webs-most-promising-language
newbiewebSr. Software EngineerAuthor Commented:
I saw this awesome video which makes Perl 6 looks very expressive and very code efficient...

Look what just three lines can do compared to so may more lines in about a dozen languages, and much better than Python 3.


https://www.youtube.com/watch?v=lpu-3UF_b48

Is Python going to beat Perl 6? This video may change a few minds...

When did Perl 6 come out?
wilcoxonCommented:
Perl 6 does change some of the syntax - it is definitely not fully compatible with Perl 5.  That is probably why they decided not to make it a replacement for Perl 5.

Python is quite popular but has a fundamental design flaw (relevant white space) and there is nothing that can be done in Python that can't be done in Perl with one exception (Stackless Python allows some interesting "tricks" but also requires a different mind-set and does make it harder to do some other things).

The full promise of Perl 6 has not been delivered yet.  It currently only has a working implementation on Moar VM - one of the big selling points (at least for me) was that there is also supposed to be a JVM implementation (which should allow using libs from any other language that runs on JVM).  As long as you don't mind not having JVM, Perl 6 is definitely worth a look.
newbiewebSr. Software EngineerAuthor Commented:
Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.