Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
XP is just a number
 
PerlMonks  

Object oriented perl

by Anonymous Monk
on Mar 23, 2005 at 22:42 UTC ( [id://441948]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hey, my script are still stuck in the days of non-object oriented perl programming

a proffesor friend of mine mentioned how to create objects with the package keyword

what is the syntax to create what I guess woudl be the perl equivalent of a c++ class?

also, he mentioned a perl module which does graphics. what is the name of this library, and does anyone have any info on how to use it?

Replies are listed 'Best First'.
Re: Object oriented perl
by duct_tape (Hermit) on Mar 23, 2005 at 22:59 UTC

    You will want to read the perlboot and perltoot man pages for more information on perl object oriented programming. They should have come with your installation of perl, if not then you can find them here http://perldoc.perl.org/index-tutorials.html. Another good source of information on object oriented perl is the book Object Oriented Perl by Damian Conway.

    For the modules that do graphics, there are quite a few. The most common two are GD and Image::Magick.

Re: Object oriented perl
by Anonymous Monk on Mar 23, 2005 at 23:19 UTC
Re: Object oriented perl
by chas (Priest) on Mar 24, 2005 at 00:07 UTC
    Conways's book mentioned already is great, but for a simple first introduction, Randal Schwartz's book "Learning Perl Objects, References & Modules" (O'Reilly) is very nice! I read the whole book over a weekend for review and learned a lot.
    chas
      His uses of Mister Ed and Gillians Island kind of scared me. Not that I thought they were bad examples. It scared me because I actually knew what he was talking about and had watched those shows as a kid. It made me realize how old I am getting...
Re: Object oriented perl
by perlfan (Parson) on Mar 24, 2005 at 01:00 UTC
    my script are still stuck in the days of non-object oriented perl programming

    This is not necessarily a bad thing.

    Regardless, Damian Conway's book on Object Oriented Perl is extremely useful - even for non-oo features of Perl since you have to understand a few advanced topics to appreciate how Perl achieves oo-ness.
Perl Graphics (was...Re: Object oriented perl)
by satchm0h (Beadle) on Mar 24, 2005 at 10:05 UTC
    Your OO perl question as been addressed....go ye and read merlyn's book.

    I thought I would try and shed some light on your postscript concering graphics in perl. As far as I know there is not a graphics library written entirely in perl, but rather a few modules that are built on top of other libraries.

    For the 2D side of things, take a look at the GD bundle of modules and the various modules built on top of them.

    If you are feeling a bit more adventurous and want to dive into the 3D side of things, try reading Geoff Broadwell's articles over at perl.com (1, 2, 3). He leverages SDL::App and SDL::OpenGL.

    A bit terse...but to the point I hope.

      wow

      this site ne'r seems to actually give help, rather, it points to otehr things which will supposedly help you

      so lets make it exact

      would this syntax for a package be correct?


      package test {

      sub randomSub {

      ($args)=@_;

      #do random stuff

      return $something;

      }#end sub

      }#end package

      if not, how????

      Considered by Tanktalus - code tags, please
      Unconsidered by [castaway - Keep/Edit/Delete: 1/18/1 - It's readable enough.

        We point to things that will help you as long as you go read it. These questions have been asked (and answered) already - and those who wrote the info we're referring you to have spent way more time preparing that info than we are about to do here. So, please read what we point you at. You'll be glad you did.

        (remove the outter-most braces, put a "1;" at the end, and save in "test.pm")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://441948]
Approved by Tanktalus
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.