CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] Error while creating code for inheritance: Edit Log



death_metal
Novice

May 26, 2013, 5:22 AM


Views: 897
Re: [FishMonger] Error while creating code for inheritance

Hi FishMonger,
Thank you for your time and reply to my post.

I am using version - v5.10

Yes, both the definitions are in same package.(file name back.pl)

When I try with parent-norequire, it throws me below error:

String found where operator expected at back.pl line # near "norequire 'lolol' "
<Do you need to predeclare norequire?>
syntax error at back.pl line# near "norequire 'lolol'"
Execution of back.pl aborted due to compilation errors.


In Reply To
What version of perl are you using? parent.pm was added to core in v5.10.1. If you're using an older version that would cause the "can't locate parent.pm in @INC" error.

Are both package definitions in the same file, or are they separate files?

You should have them in separate files, but if want them in the same file and you want to setup inheritance, then you need to use the -norequire option/param


Code
use parent -norequire 'lolol';


If you're using an older version, use base instead of parent.
http://perldoc.perl.org/base.html



(This post was edited by death_metal on May 26, 2013, 5:28 AM)


Edit Log:
Post edited by death_metal (Novice) on May 26, 2013, 5:23 AM
Post edited by death_metal (Novice) on May 26, 2013, 5:28 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives