Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Senior Coder
    Join Date
    Aug 2009
    Mansfield, Nottinghamshire, UK
    Thanked 148 Times in 147 Posts

    oop class in perl

    Evening. I know very little about perl but im a quick learner. I want to convert OOP 5 class I've written into perl.

    From what I've read so far classes are called 'packages'??

    anyway im running on my local machine with ActivePerl.

    For now I have just used an example to get things started but I cant figure out how ti initiate the class.

    I have

    use strict;
    use warnings;
    use Person;
    $object = new Person( "Mohammad", "Saleem", 23234345);
    on my main page and

    use strict;
    package Crawler;
    sub new {
        my $class = shift;
        my $self = {
            _firstName => shift,
            _lastName  => shift,
            _ssn       => shift,
        # Print all the values just for clarification.
        print "First Name is $self->{_firstName}\n";
        print "Last Name is $self->{_lastName}\n";
        print "SSN is $self->{_ssn}\n";
        bless $self, $class;
        return $self;
    in person.pm

    but i get error saying that person.pm did not return a true value. Any ideas?
    Last edited by Phil Jackson; 09-20-2010 at 06:31 PM.
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts