Click here to get back home

Namespace is changed before "package" line is reached

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Namespace is changed before "package" line is reached David Worenklein 11-30-2007
Posted by David Worenklein on November 30, 2007, 1:49 pm
Please log in for more thread options
Try this. test.pl is being loaded before the "package" line, yet it
is evaluating within the package. Why would that be? Thanks.

use test;

<<<test.pm>>>

print __FILE__, ":", __LINE__, " - package is ", __PACKAGE__, "\n";
require "test2.pl";
print __FILE__, ":", __LINE__, " - package is ", __PACKAGE__, "\n";

package test;


1;


<<<test2.pl>>>

print __FILE__, ":", __LINE__, " - package is ", __PACKAGE__, "\n";
1;



Here's what I get:

test.pm:1 - package is main
test2.pl:1 - package is test <<==== Expected this to say main
test.pm:3 - package is main




Similar ThreadsPosted
Has the interface to Proc::PID_File changed? January 5, 2005, 4:49 am
kill process when file count reached,,. July 1, 2008, 7:25 pm
What to do when CPAN module authors can't be reached? (Bug + fix for Frontier::RPC2) May 6, 2006, 2:50 pm
How do I install this package using ppm? September 28, 2005, 2:44 pm
XML::Generator::DBI - use of uninitialized value on line 180 and 187 September 12, 2004, 8:00 pm
XPath to Line Number? June 26, 2007, 2:39 pm
Shebang line for modules? January 8, 2008, 4:31 pm
how do I package a CPAN module? October 23, 2004, 1:13 pm
how to package perl applications? November 16, 2004, 9:58 am
lwp package head question August 16, 2005, 10:47 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap