|
|
Up |
|
|
  |
Author: don.hosekdon.hosek
Date: Oct 12, 2006 21:01
As I'm getting a bit deeper into working with some object-oriented
design in Perl, I'm running into a big problem with how I deal with
things: In, say C++, I could have
class foo {
protected int bar
}
class baz : public foo {
void mymethod {
bar=6;
}
}
to give a grossly simplified example of what I'd like to do. But by
default, there is no data inheritence in perl. So if I have
package foo;
use Class::Std;
my %%bar_of : ATTR;
package baz;
use Class::Std;
use base qw(foo);
|
| Show full article (0.63Kb) |
|
| |
5 Comments |
|
  |
Author: peter.brownpeter.brown
Date: Oct 12, 2006 19:39
Hi - is there a simple way to redirect the output from a Sybase system
stored proc [sp_recompile] to an open filhandle - currently the output
- 'Each stored procedure and trigger that uses table 'xxxxx will be
recompiled the next time it is executed.' - is printed on the console.
thx
pete
here's a snip of the code ...
while ( @row = $sth->fetchrow_array ) {
print LOG "Updating statistics for table $dostats\nSTART $row[0]\n";}
$sth = $dbh->prepare("update statistics $dostats");
$sth->execute || die "update stats failed on table $dostats.\n";
$sth = $dbh->prepare("sp_recompile $dostats"); <== problem cmd
$sth->execute || die "sp_recompile failed on table $dostats.\n";
...
|
| |
|
| |
1 Comment |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Oct 12, 2006 18:03
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
4.36: How can I expand variables in text strings?
Let's assume that you have a string that contains placeholder variables.
$text = 'this has a $foo in it and a $bar';
You can use a substitution with a double evaluation. The first /e turns
$1 into $foo, and the second /e turns $foo into its value. You may want
to wrap this in an "eval": if you try to get the value of an undeclared
variable while running under "use strict", you get a fatal error.
eval { $text =~ s/(\$\w+)/$1/eeg };
die if $@;
It's probably better in the general case to treat those variables as
entries in some special hash. For example:
|
| Show full article (1.89Kb) |
|
8 Comments |
|
  |
Author: thedwigthedwig
Date: Oct 12, 2006 17:53
hi.
%%tar -xvf OpenGL-0.5.tar.gz
%%cd OpenGL-0.5
%%perl Makefile.PL
and then i met messages.....
Note (probably harmless): No library found for -lGLUT
Note (probably harmless): No library found for -lGLX
Note (probably harmless): No library found for -lMesaGLU
Note (probably harmless): No library found for -lMesaGLUT
Note (probably harmless): No library found for -lMesaGLX
Note (probably harmless): No library found for -lXIE
how can i solve this problem? help...
ok. i got it- library isn't exist-
but, how can i install this libraries (GLUT, GLX, etc.)???? -help
|
| |
|
2 Comments |
|
  |
Author: ultimardultimard
Date: Oct 12, 2006 17:20
I am a little rusty w/ perl, haven't done it in a while, but this is
the trouble I am having..
I am having trouble getting to the 3rd condition, it seems to be
ignoring the 3rd condition
if ( $ar{$ar}{loc} eq 'HBR' and \
$ar{$ar}{ar_typ} eq 'DMX' and $ar{$ar}{tier} = 146 )
{ $HBR_pr += $ar{$ar}{fr_r5}; }
Basically testing for 3 or more conditions and then summing up an
element in a hash of hashes.
Any ideas will be appreciated ..
|
| |
|
9 Comments |
|
  |
Author: Mad Scientist JrMad Scientist Jr
Date: Oct 12, 2006 14:20
Is there a myspace type site that is a place for programmers to post
their apps for people to download? It would have to be user friendly
like tucows but allow a programmer to create their own home page where
they can post their apps (including open source if they wish). People
can network and link to each other, rate other's apps, and search for
code by platform/language/keyword/most popular, etc. It would support
EVERY platform imaginable, from 8-bit atari code to .NET and Java apps.
Does anything like this exist?
|
| |
|
1 Comment |
|
  |
Author: Marshall DudleyMarshall Dudley
Date: Oct 12, 2006 12:11
I have a short script to use with the cron to get an ip address so if
the nameserver is down, I will still have a recent ip and the scripts
that communicate with that host do not crash.
#! /usr/bin/perl
use Socket;
$host = ' theurl.com'; #this is NOT the real url I am using
$ip = inet_ntoa(inet_aton($host));
if ($ip =~ /\d+\.\d+\.\d+\.\d+/) {
open (FILE,">/usr/home/kingcart/cgi-bin/host.ip");
print FILE $ip;
close FILE;
}
If I run it by hand from the command prompt, it works every time. When I
put it in the cron, it fails about 80%% of the time with the following
error:
Bad arg length for Socket::inet_ntoa, length is 0, should be 4 at
/usr/home/kingcart/cgi-bin/gethost.pl line 5.
Any ideas why it fails usually when run by the cron, but works fine when
run manually. What does this error mean?
|
| Show full article (0.86Kb) |
|
1 Comment |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Oct 12, 2006 12:03
This is an excerpt from the latest version perlfaq1.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
1.7: How stable is Perl?
Production releases, which incorporate bug fixes and new functionality,
are widely tested before release. Since the 5.000 release, we have
averaged only about one production release per year.
Larry and the Perl development team occasionally make changes to the
internal core of the language, but all possible efforts are made toward
backward compatibility. While not quite all perl4 scripts run flawlessly
under perl5, an update to perl should nearly never invalidate a program
written for an earlier version of perl (barring accidental bug fixes and
the rare new keyword).
--------------------------------------------------------------------
|
| Show full article (1.68Kb) |
|
no comments
|
|
  |
Author: markparkmarkpark
Date: Oct 12, 2006 11:58
I was hoping that someone could help me. I'm new to the list and I'm at
a job
and kind of under pressure and don't know who else to ask.
I new at perl and I wrote a short program to read values from the
command line and then
just output them into a hash. i've grinded through the documentation
and books and wrote
something but it's not quite working. its close though.
I couldn't find a way to attach files so I've included the code below
and then how one would
run the program with various values at the command line ( actually they
aren't options.
they are required ).
#------------------------------------------------------------------------------------------------------------------------------
#!/ms/dist/perl5/bin/perl5.6
use strict;
use Getopt::Long;
my($DRIVER_FILE,$START_DATE,$END_DATE,$START_TIME,$END_TIME,$CURRENCY,$EXCHANGE,$DATA_DIR,$OUT_FILE);
|
| Show full article (3.27Kb) |
|
5 Comments |
|
  |
|
|
  |
Author: Adam FunkAdam Funk
Date: Oct 12, 2006 11:06
On 2006-10-12, Scott Lurndal wrote:
> "Ancient_Hacker" comcast.net> writes:
>>Anybody have any idea why good old FORTRAN had these quirks:
>>
>>
>>(1) three-way arithmetic IF
>
> Simple translation to a "compare" machine instruction. two
> branches to the < > case and fall through to the = case.
Perl's sort and Java's comparators (and no doubt other languages'
analogous features) use three-way comparisons and are extremely useful
that way.
|
| |
|
no comments
|
|
|
|
|
|
|