t; Subject: Re: OO subclassing, wrong method being called in hierarchy.
>
> >>>>> "Michael" == Michael Kraus <[EMAIL PROTECTED]> writes:
>
> Michael> The package names are actually section, dbh_section
> and checkout (rather
> Michael> t
> If those are the actual package names your using, then you
> are probably picking up the B package in the core...
No, they're not. (I didn't realise there was a B package already,
though!)
The package names are actually section, dbh_section and checkout (rather
than A,B and C respectively).
J
G'day...
I've got three classes in a hierarchy, i.e.:
Class A (Super class)
|
Class B (Subclasses A, Superclasses C)
|
Class C (Subclass)
I have a method (called "go") on both B and A. However, if it is called
on A die is called as it is designed to be overridden in subclasses of
A.
Whe
Hi Anish,
It'd appear that you've written each of the functions ExpiryMessage,
InstructorExpiryMessage and ReviewerExpiryMessage twice.
Check that you've not duplicated your work and confused the parser.
Regards,
Michael S. E. Kraus
B. Info. Tech. (CQU), Dip. Business (Computing)
Software Dev
G'day all...
I'm currently using CGI::Session as part of an online ordering system.
I've been passing database primary keys back and forth between the
client and server, with all values double checked upon being received at
the server.
The only problem is that I need to present the total price t
2005 6:10 PM
> To: 'beginners@perl.org'
> Cc: Michael Kraus
> Subject: RE: RegExp equivalencies
>
> Michael Kraus <[EMAIL PROTECTED]> asked:
> > Is:
> >
> > my ($id) = $item =~ /_(\d+)$/;
> >
> > Equivalent to:
> >
> >
> > Wild Technology Pty Ltd , ABN 98 091 470 692 Sales - Ground
> [...]
>
> And that'll really make you popular around here ;-)
Yes, I've noticed. Unfortunately if I leave off my .sig (as I did in the
original message of this thread), the mail server decides to append an even
longer signature t
G'day...
Is:
my ($id) = $item =~ /_(\d+)$/;
Equivalent to:
$item =~ /_(\d+)$/;
$id = $1;
Thanks heaps...
-Mike
Wild Technology Pty Ltd , ABN 98 091 470 692
Sales - Ground Floor, 265/8 Lachlan Street, Waterloo
G'day...
> > if ($_ !~ /\*{5} InTune/){
>
> This should be:
>
> if ($_ !=~ /\*{5} InTune/) {
Should it?
I always thought that !~ was the inverse of =~
I.e.
$var !~ /pattern/
was the equivalent of
!($var =~ /pattern/)
(at least within test conditions anyway)
Is there somethi
G'day...
> I would like to use a session mechanism that allows to store
> some hashes in a MySQL database, but also allow storing some
> other visitor preferences like the font style, colors, font
> sizes, the language, etc.
>
> Do you know if CGI::Session allows storing some more values
> in
You don't. You create it with HTML and JavaScript. You use perl to read
the select boxes values.
It's simply that Perl is used server-side, not client-side. Perl can be
used to generate the HTML (and javascript if needed).
Javascript is a client-side technology. The two languages don't directly
c
G'day...
I've recently upgraded to Fedora Core 3, and have found that now my Perl
scripts which use the MIME::Lite module no longer work.
According to the error log, the problem is their seems to be permission
problems executing sendmail. (See below)
[Thu Dec 23 10:07:52 2004] [error] [client 1
G'day...
I've got a function which checks that only allowed characters are
contained within a tainted piece of data, part of it looks like this:
if ($tainted =~ /^([$allowed_chars]*)$/) {
return $1;
}
Where $allowed_chars are the allowed characters. Questi
Could you please clearly point out which is line 382.
Just post line 382 and/or line 382 and the surrounding block.
Regards,
Michael S. E. Kraus
Software Developer
Wild Technology Pty Ltd
___
ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017,
G'day...
> Return undef or 0, just like you are doing. Both your calls
> to baz have an argument, so 1 is returned both times. I
> prefer undef for false.
Ahh... But how do you set $! in the enclosing scope?
Thanks...
Regards,
Michael S. E. Kraus
Software Developer
Wild Technology Pty Lt
G'day...
> $file_name = $upload->file_name('sequences');
> $file_type = $uplaod->file_type('sequences');
>
> $file_handle = $upload->file_handle('sequences');
I haven't checked your script that thoroughly, or compared it to how I
have done it - /but/ I have noticed that you've misspelt "upload"
Big thanks to Larry and Edward for their help.
Regards,
Michael S. E. Kraus
Software Developer
Wild Technology Pty Ltd
___
ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia
Telephone 1300-13-9453 | Facsimile 1300-88-9453
http://www
G'day...
I've noticed a lot of modules can be initialised in the form:
my $instance = Module->new( option => "value1", option2 => "value2" )
How is this implemented? Is the above simply passing a hash reference?
Is it something like:
--- SNIP ---
package Module;
sub new {
my $obclas
Hrmmm... Provided my own work-around for this... Comments more than
welcome...
--- SNIP ---
package Second_Object;
use First_Object;
# ... code ...
sub addServerError {
my $self = shift;
my $desc = shift;
if ( $desc !~ /^$self:/ ) {
$desc = "$s
G'day all...
I'm wanting two different classes to share the same error functionality.
OK, rather than trying to talk aroud a lot of what I want to do I'll
show you some code:
---SNIP---
package Error;
sub new {
my $class = shift;
$class = ref $class || $class;
my @error
G'day...
> Comments from others would be appreciated. Michael, what's
> your thinking behind using CGI::Untaint?
OK... My thoughts are this - checking out the module
before casting judgement on it is a good thing(tm) :)
The module leaves validation up to the end user/programmer... It is
simply
G'day...
> Can someone please recommend a book for me. I do some web
> administration w/ perl scripts. I would like to create a web
> page w/ drop down menus... and depending on the selection
> criteria, run that script. I searched on Google a little,
> but not really sure what I'm looking
G'day...
> This is not related to strict. You always have to use () when
> calling methods.
Really? /Always/ or only when passing arguments to the method?
I've got a method that returns a reference to an object, I often call it
without using parentheses.
Let me show you what I mean...
--- In
G'day!
> : Clearly, I'm missing something crucial here... :)
>
> And so are we. Like the code for the method for
> format_cost(), but I imagine that you are not shifting the
> object off at the beginning of that subroutine.
Right you are... :)
Btw... The code was:
sub format_cost {
G'day...
One of my classes has a method called format_cost which takes a number
(integer representing a monetory amount in cents) and pretties it up for
display as a dollar amount. I.e. format_cost(12) returns
"$1,200.00".
When I have the function stand-alone it behaves as it should, however
G'day...
> The clearest way is to use a gool 'ole fashioned conditional:
>
> unless ($sth->execute( 1, $str )) {
>($obj->addError("DB write failed");
>return undef;
> }
Ahh... boc! Thanks! :)
> $sth->execute(1, $str) ||
>do { ($obj->addError("DB write failed"); return undef; }
No n
G'day...
I know when say reading a file handle or performing a database update
that if the function fails you can use one of the or operators to
execute an aleternate statement (either or per say or ||).
What happens if you want to execute more than one statement?
E.g.
$sth->exectute(1, $str) |
Thanks heaps Jonathon and Paul for your help. :)
Regards,
Michael S. E. Kraus
Software Developer
Wild Technology Pty Ltd
___
ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia
Telephone 1300-13-9453 | Facsimile 1300-88-9453
http://w
G'day...
Better yet, use MIME::Lite
E.g.
sub mail() {
my $from = '[EMAIL PROTECTED]';
use MIME::Lite;
my $mail = MIME::Lite->new(
From => $from,
To => $recipient,
Subject => "From Guest Book $subject",
Body =
G'day...
Which is better to use, a for/foreach loop or map function when doing
some basic comparisons and assignments?
E.g.
for my $datum (keys %{$rh_vars}) {
$max_length = length($datum) if length($datum) > $max_length;
}
OR
map { $max_length = ($max_length > length($_) ? $max_length
G'day...
> s/ MATCH / MATCH NEW /;
>
> Which should output:
>
> MATCH NEW.
>
> The "//" don't work. I'm sure my syntax is wrong.
>
> s/ MATCH / MATCH ///NEW /;
>
> Output I require:
>
> MATCH
> NEW
s/MATCH/MATCH\nNEW/g;
Will replace all instances of MATCH with:
MATCH
NEW
You may also wis
G'day...
> Does anyone know how to format a string so that the spaces are padded
> on the right, not the left.
>
> Im using $dates = sprintf("%64s", $dates);
>
> this right justifies the data and pads the left with spaces.
> I need the other way around - left justified and padded with spaces o
> -Original Message-
> From: Michael Kraus [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 25 November 2004 11:27 AM
> To: John W. Krahn; Perl Beginners
> Subject: Spam:RE: Spam:Re: Using regular expressions
>
> John,
>
> Lighten up matey...
>
> The exampl
G'day...
Firstly ***thanks*** to everyone who has been helping me with this
Really appreciated...
Now, for friendly arguments sake...
> > I'm wanting to write a method in an abstract class that must be
> > overriden by it's children. If it is called directly (i.e. without
> > being overrid
John,
Lighten up matey...
The examples I've given are just that examples... Error checking
functionality is up the end programmer... (And you are quite right, you
should check the status of operations.) This is a beginers list, let's
keep it friendly, eh?
... and FWIW ...
for my $line () {
G'day...
If a sublass has overrides a method in a superclass, and the subclasses
method calls the superclass's method, is there any mechanism to detect
that the superclass' method has been overridden?
I'm wanting to write a method in an abstract class that must be
overriden by it's children. If
ion of the copyright owner. If
you have received this email in error, please immediately advise the
sender by return email and delete the message from your system.
> -Original Message-
> From: Michael Kraus [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 24 November 2004 1:45 PM
&g
e the
sender by return email and delete the message from your system.
> -Original Message-
> From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 24 November 2004 1:20 PM
> To: [EMAIL PROTECTED]
> Subject: Spam:Re: How do I create an empty anonymous hash
G'day...
These lines look wrong (but I may be wrong):
> $exit_status = `dir` ;
> print "\nCurrently in -
> >\n$exit_status\n==\nDepth
> ($depth)\n" ;
Shouldn't that be: $exit_status = `pwd`;
Also, check out the glob function - it'
G'day all...
I've got a hash:
---CUT---
our %Super_DB_Object = (
TableName => "",
DBFields => undef,
NotNull => [],
);
---CUT---
...and later (in a function) ...
---CUT---
my $field_hash = {};
$self->{DBFields} = $field_hash;
---CUT---
(Where the hash has been aliased t
G'day...
> > : Should I be using "my" or "our" here for the variables - these
> > : are the variables I want present in all my derived classes and
> > : should be the same for all.
>
> I assume you're referring to things like
> %InheritableClassData... You should be using "our" variables;
> "my
]
Subject: Spam:Re: Autmatic function creation
Michael Kraus wrote:
> Just wondering if this code snippet will behave as expected, and if
> not then why not? :)
>
> --START--
> our %InheritableClassData = (
> DBH => undef,
> Q => undef,
> Handle
Sent: Wednesday, 17 November 2004 5:30 PM
To: [EMAIL PROTECTED]
Subject: Spam:RE: Autmatic function creation
Michael Kraus <[EMAIL PROTECTED]> wrote:
: Just wondering if this code snippet will behave as expected,
: and if not then why not? :)
No, I don't think so. One error is in u
Just wondering if this code snippet will behave as expected, and if not
then why not? :)
--START--
our %InheritableClassData = (
DBH => undef,
Q => undef,
Handler => undef,
);
foreach (qq(DBH Q Handler)) {
sub $_ {
shift;
$Inherita
44 matches
Mail list logo