On Tue, 2006-06-06 at 12:14 -0500, [EMAIL PROTECTED] wrote:
> I'm trying to debug a failing script. It is chock full of expressions
> like this:
> $self->_read_file($self->{file})
>
> I have never used this syntax in my own scripts which are pretty basic
> and getting a headache trying to figur
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
> use Data::Dumper;
> print Dumper $self;
Thanks for the pointers... I haven't read it all yet but still trying
to get this script to run. It is inlined at the end.
Introducing your code causes a new failure and nothing is printed.
[What I'm
On 6/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
$self->_read_file($self->{file})
$self is an blessed reference to an object (used from inside that object)
$self->_read_file() is the subroutine to call defined inside that object
$self->{'file'}; is a reference to a hash defined insi
[EMAIL PROTECTED] writes:
> I'll post only one of the two cfg files being read and you'll see it
> has very little in it. The documentation with this script appears to
> be out of sync with actual script so hasn't been much help. I suspect
> my problem revolve around miss placing parts of the pa
"Anthony Ettinger" <[EMAIL PROTECTED]> writes:
> The syntax {} is for a hashref, it's just an un-named hashref inside
> that object.
>
> my $foo = new Foo;
> print $foo->getFooKey();
> $foo->setFooKey('new value');
> print $foo->getFooKey();
Thanks for the demo... I'm in well over my head here bu
just execute it with "perl -wl foo"
or add the shebang line: #!/usr/bin/perl -w
On 6/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
"Anthony Ettinger" <[EMAIL PROTECTED]> writes:
> The syntax {} is for a hashref, it's just an un-named hashref inside
> that object.
>
> my $foo = new Foo;
On Tue, 2006-06-06 at 11:44 -0700, Anthony Ettinger wrote:
> just execute it with "perl -wl foo"
>
> or add the shebang line: #!/usr/bin/perl -w
Your script should start with:
#!/usr/bin/perl
use strict;
use warnings;
--
__END__
Just my 0.0002 million dollars worth,
--- Shawn
"Anthony Ettinger" <[EMAIL PROTECTED]> writes:
> just execute it with "perl -wl foo"
> or add the shebang line: #!/usr/bin/perl -w
Yes, I had done that prior to posting error output
The erroring script looks like:
===
#!/usr/local/bin/perl -w
my $foo = new Foo;
print $foo->getFooKey()
The line below was folded, and
$self->{'fookey'} = 'some value here'; #hashref accessible only
within Package Foo;
the Perl interpreter is seeing
within Package Foo;
Outputs:
Can't locate object method "within" via package "Package" (perhaps you forgot to load
"Package"?) at ./myOOP
On Tue, 2006-06-06 at 13:13 -0500, [EMAIL PROTECTED] wrote:
> "Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
>
> > use Data::Dumper;
> > print Dumper $self;
>
> Thanks for the pointers... I haven't read it all yet but still trying
> to get this script to run. It is inlined at the end.
>
>
There's a good book "PHP5 Patterns and Object Oriented Programming"
which I found very instrumental in my understanding of object-oriented
programming, before applying it to Perl.
There are of course Perl books on the subject, and the perldocs, but I
found PHP's object oriented support to be les
"Adriano Ferreira" <[EMAIL PROTECTED]> writes:
> the Perl interpreter is seeing
>
> within Package Foo;
Gack, yes I see it now... I should have noticed that but it slid
right by my unpracticed eye.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROT
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
[...]
Harry wrote:
>> Introducing your code causes a new failure and nothing is printed.
Shawn wrote:
> The line: print Dumper $self;
> should be just before the line you posted in your earlier post:
> $self->_read_file($self->{file});
I'm reall
On Tue, 2006-06-06 at 19:35 -0500, [EMAIL PROTECTED] wrote:
> "Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
>
> [...]
>
> Harry wrote:
> >> Introducing your code causes a new failure and nothing is printed.
>
>
> Shawn wrote:
> > The line: print Dumper $self;
> > should be just before the li
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
[...]
> Yes, Dumper() calls its first variable VAR1 (it calls its second VAR2,
> etc.). This tells more than you know. The line:
>
> 'file' => undef,
>
> means that somewhere in your code (or the class) that 'file' was
> actually assigned a valu
On Tue, 2006-06-06 at 22:23 -0500, [EMAIL PROTECTED] wrote:
> 46: $self->{file} = $args->{file};
This is the line were $self->{file} is set to undef.
> 48: $self->_read_file($self->{file});
>
> ** => 214: my $file = shift;
And here $file is set to $self->{file}, which is undef
So what is $a
> -Original Message-
> From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 07 June, 2006 07:16
> To: beginners@perl.org
> Subject: Re: reading Perl syntax
>
>
> On Tue, 2006-06-06 at 22:23 -0500, [EMAIL PROTECTED] wrote:
> > 46: $self->
On 6/7/06, Ron Goral <[EMAIL PROTECTED]> wrote:
Merely referencing a key in a hash sets it into the hash, though with a
value of undef.
This turns out not to be the case. In Perl, merely referencing a key
in a hash doesn't change the hash. Some non-Perl hash implementations
do change the hash
On Wed, 2006-07-06 at 07:49 -0500, Ron Goral wrote:
> Merely referencing a key in a hash sets it into the hash, though with a
> value of undef.
No, it does not. You have to actually assign it a value for the key to
appear. The value you assign it may be undef, but Data::Dumper will only
show the k
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of
> Tom Phoenix
> Sent: Wednesday, 07 June, 2006 08:00
> To: Ron Goral
> Cc: beginners@perl.org
> Subject: Re: reading Perl syntax
>
>
> On 6/7/06, Ron Goral <[EMAIL
> > Merely referencing a key in a hash sets it into the hash,
> though with a
> > value of undef.
>
> This turns out not to be the case. In Perl, merely referencing a key
> in a hash doesn't change the hash. Some non-Perl hash implementations
> do change the hash in those circumstances, though, s
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
> perl -n -e "/\bargs\b/ && print" lib/Database.pm
Well I didn't learn a thing from that either:
my $args = shift;
$self->{file} = $args->{file};
$self->{is_reversed} = $args->{reversed} ? 1 : 0;
if (defined $args->{views})
$self->{view
On Wed, 2006-07-06 at 16:16 -0500, [EMAIL PROTECTED] wrote:
> Well I didn't learn a thing from that either:
> my $args = shift;
This is the line you should be interested in. Could you show the
subroutine it is in? Also add after it:
use Data::Dumper;
print Dumper $args;
> $self->{file} =
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes:
> my $args = shift
Subroutine:
sub new
{
my $class = shift;
my $self = bless {}, $class;
my $args = shift;
$self->{file} = $args->{file};
$self->{is_reversed} = $args->{reversed} ? 1 : 0;
$self->_read_file($self->{file});
$self->{filt
On Wed, 07 Jun 2006 09:00:12 -0400, Tom Phoenix wrote:
> In Perl, merely referencing a key
> in a hash doesn't change the hash. Some non-Perl hash implementations
> do change the hash in those circumstances, though, so your confusion
> is understandable.
Not to detract from your point in this thre
Peter Scott schreef:
> Tom Phoenix:
>> In Perl, merely referencing a key
>> in a hash doesn't change the hash. Some non-Perl hash implementations
>> do change the hash in those circumstances, though, so your confusion
>> is understandable.
>
> Not to detract from your point in this thread, but jus
26 matches
Mail list logo