On Fri, 2004-01-23 at 14:46, drieux wrote:
On Jan 23, 2004, at 1:36 PM, Eric Walker wrote:
[..]
>
> when I tried to add a package to it, I did some test and its not
> reading
> the DATA anymore. Is there a certain order?
[..]
How did you put the package in?
ciao
drieux
---
#!/usr/bin/perl -w
use strict;
my $foo = new Foo::Bar;
while(<DATA>){
$foo->showMe($_);
}
BEGIN {
package Foo::Bar;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.01';
#---------------------------------
# Our Stock Constructor
# note: <http://www.perlmonks.org/index.pl?node_id=52089>
sub new
{
my $class = shift;
my $self = {};
bless $self, $class;
} # end of our simple new
#---------------------------------
# so that AUTOLOAD finds one here
sub DESTROY {}
#------------------------
#
sub showMe
{
my ($me,$line) = @_;
print $line;
} # end of showMe
1; # so that the 'use Foo::Bar'
# will know we are happy
} # end begin
__DATA__
This line
and then the world.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
while <DATA>{
do something;}
package ONE
package stuff;
1;
package main
__DATA__
data stufff