et, but I didn't want to
fiddle with my exisiting Perl 5.8.0 installation (also from RH 9.0).
My solution: Install Perl 5.8.2 in '/usr/local', the point
'/usr/bin/perl' to the Perl executable located under the 'local' path;
ln -s /usr/local/bin/perl /usr/bin/pe
he usernames.
Easy enough. What have you tried so far?
--
Tore Aursand <[EMAIL PROTECTED]>
"A teacher is never a giver of truth - he is a guide, a pointer to the
truth that each student must find for himself. A good teacher is
merely a catalyst." -- Bruce Lee
--
To unsubscri
y need to use a regular expression to do this? What about the
'eq' operator?
if ( $source eq 'Help' ) {
# Match
}
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
on is heavier; It
check if a number really _is_ a number - the above don't, really...)
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
good thing; A lot of the modules may need to be
recompiled with the new Perl.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
7;t in this case).
> $_ = $$Rules{$yes}{rule_desc};
> s/"/\\"/;
> $$Rules{$yes}{rule_desc} = $_;
These three lines could easily have been shortened down to only one;
$$Rules{$yes}{rule_desc} =~ s/"/\\"/g;
However: Why do you need to quote the " characters?
--
Tore Aursan
nt to. I would rather point you to a part of the Perl
documentation relating to OO:
perldoc perlobj
perldoc perltoot
perldoc perltooc
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Sun, 16 Nov 2003 23:24:29 -0800, R. Joseph Newton wrote:
> If you want to round, use:
> my $rounded = int ($float_value + 0.5);
...which only works if you have a positive number. You must make it a bit
more foolproof;
my $rounded = ($nr > 0) ? int($nr + 0.5) : int($nr - 0.5);
On Mon, 17 Nov 2003 01:08:46 -0800, perl wrote:
> In any case, I'm wondering if use CGI is the package to use [...]
Why don't you bother finding out? 'perldoc CGI'. Search for 'upload'.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e
On Mon, 17 Nov 2003 12:46:08 +0100, Tore Aursand wrote:
>> i wanna look at the (source code of) modules which give a basic
>> understanding of OOPS programming style in Perl. any pointers will be
>> helpful .
> Pointers to what? Just take a look at come of the OO module
is
to the terminal and block buffered otherwise."
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
e, and then prepend each
command with 'man' and then see what you get.
Example:
man cat
Easy! :-)
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ntioned, you could always split into an array
and the retrieve the two last elements of that array;
my @parts = split( /\./, $host );
my $left = $parts[-2] || '';
my $right = $parts[-1] || '';
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL
_has_ a redirect()
function;
use CGI;
my $cgi = CGI->new();
print $cgi->redirect( 'http://www.google.com/' );
More information:
perldoc CGI
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
're using a cannon to get rid
of your neighbours cat.
As long as $diff is numeric, you can use this code;
if ( $diff > 0 ) {
# ...
}
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
my $class = shift;
my $sysData = shift;
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
>}
> }
Doesn't this work? I would have inserted a 'last' in the loop, though,
and chomp'ed the $_;
while ( ) {
chomp;
if ( $email eq $_ ) {
$OK = 1;
last;
}
}
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe,
On Thu, 13 Nov 2003 20:15:18 +0530, Sachin Mathur wrote:
> I Wanted to know what are the differences in version 5.005 and version
> v.5.8.0 of perl
Check out perldelta for each version.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
On Thu, 13 Nov 2003 09:05:45 -0600, Dan Muey wrote:
>> In Perl that is usually written as:
>>
>> for $count ( 1 .. 5 ) {
>> print "$count\n";
>> }
> Or even easier:
> for(1..5) { print; }
Or _even_ easier;
print 1..5;
Hah! :-)
--
Tore Au
On Wed, 12 Nov 2003 23:05:53 -0800, perl wrote:
> Can someone help me with validating email address chars?
This is a FAQ:
perldoc -q "valid mail"
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
are you
referring to?
And could you please give some examples on what the input to this function
could look like?
Thanks.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
reating code in general?
1. Learn Perl.
2. Try to do something.
3. If #2 fails, read any documentation you can find.
4. comp.lang.perl.misc
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
tric, while
Perl is easier to use when dealing with that _and_ "other things" (like
system administration, for example).
I'd love to see examples on what Perl can't do compared to PHP.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
r,blackhole";
my $dsn = "DBI:mysql:database=webmaster;host=blackhole";
As long as the user has access to the database 'webmaster' on the host
'blackhole', this should work. If it doesn't, then you should surf over
to www.mysql.com and read the documentation.
--
Tore
ld FROM table WHERE field = ?',
undef, $variable);
> Variables are GETed or POSTed automatically with the form on submit.
That has nothing to do with the programming language on the server side,
actually, but is a part of the HTTP implementation.
On Tue, 11 Nov 2003 16:06:18 -0600, Dan Muey wrote:
> What do I need to do to make a script that will take that input and log
> the user in to an apache .htaccess protected directory?
Have you searched CPAN? I'm sure I've seen module(s) there which does
what you request.
teract
with any database?
The latter doesn't make sense, though; That would be to create a language
which multiple DB platforms comply with. SQL already does that, more or
less (just try avoiding the DB-specific solutions).
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscrib
treat it like x digits what-so-ever;
$number = sprintf("%05d", $number);
Hence, you might want to check if the number really _is_ a number, and
that's a whole other story alltogether. :-)
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTE
ww.perlmonks.org/index.pl?node_id=145790
Neither of the benchmarks on that address uses a real-life mod_perl
scenario as basis for the testing.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
My point is still valid, though; Why do one want to use CGI::Lite instead
of CGI.pm? Is it better? No. Is it safer? No. Is it faster? No. Is
it more widely used? No. Does it come with the Perl distribution? No.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-m
);
> #split up main / pvc info
> ($siteLink,$siteNoOfPVCs,$siteAllPVCs)=split(/:/,$site,3);
As long as we don't know what the contents of $site looks like, we can't
comment on this.
> for ($i = 0; $i < $siteNoOfPVCs ; $i++ ) { # loop for each PVC
I guess this should do the trick:
g the first file
3. For each line in the first file, read a line from
the other files. Push the lines to an array.
4. Process the array, output the result, go back to #3.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
t
> you can't do without hacking it.
This might not justify as "hacking" the CGI.pm, but once I had to do
something really special related to session handling. The solution wasn't
to hack, change or write my own CGI handling module, but simply subclass
the original CGI.pm.
On Wed, 05 Nov 2003 17:22:10 -0500, Dan Anderson wrote:
> So I got so far with my own creation and am wondering if it should be
> given the axe or continued.
Axe it. Really. There is absolutely _no_ reason why one shouldn't use
the CGI.pm module.
--
Tore Aursand <[EMAIL PROTEC
quot;No directory/file at position $key";
print $element . "\n";
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
array.
Easy enough; Just open both files and read one line at a time from both
of them. But what do you want to do if one of the files have more lines
in it than the other?
> Does anyone have any example code?
For what? Reading from files? What are you having trouble with?
--
Tore Aur
ying to one. That way you _don't_ have to scroll past that many posts
to find out what the thread is all about.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
h ( @list ) {
$i++;
if ( /match/ ) {
# ...
}
}
> If (/$logs[i]/)
Please post _real_ Perl code. The code above has no meaning and won't
even compile.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional c
> print `time`;
> print "";
No need to do a system call for 'time' here, when you got all you need
built-in in Perl;
perldoc -f localtime
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Tue, 04 Nov 2003 13:58:41 -0500, mgoland wrote:
> %hash=( 1 => funca(),
> 2 => funcb(),
> );
Try this:
%hash = (1 => \&funca(),
2 => \&funcb());
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECT
er template modules) on CPAN;
http://www.cpan.org/
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
\%hash );
Never bothered to read the documentation for Data::Dumper. Maybe I should
some day.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Thu, 30 Oct 2003 23:37:55 -0500, Scott, Joshua wrote:
> How can I split the data in a line by a single whitespace but also keep
> portions between quotes together?
This is a FAQ:
perldoc -q delimit
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PR
On Thu, 30 Oct 2003 23:45:25 +0100, Kevin Pfeiffer wrote:
> print Dumper(\$hash_ref);
I guess $hash_ref already _is_ a hash reference, so you don't need to
reference it again;
print Dumper( $hash_ref );
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL
On Thu, 30 Oct 2003 17:18:06 -0500, William.Ampeh wrote:
> I am looking for a Web-based calendar manager [...]
What excactly is a calendar manager? To me it sounds like software (web
based, this time) which manages calendars. Do you really have that many? :-)
--
Tore Aursand <
of all: Post your _actual_ code. The code above won't even
compile, and it's really easy to see (or find out) why.
Secondly, you're trying to write to a file you opened for reading.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
index? Have
you considered push()'ing data onto the array?
> I tried to create a second array and store it by
> reference like this:
>
> my $a = [];
> $me->{a} = \$a;
$a is _already_ an array reference. No need to make a reference of a
reference. :-)
my @array= ();
On Tue, 28 Oct 2003 11:53:44 -0700, Wiggins d Anconia wrote:
> or if you know the length of the array ahead of time:
>
> my @rows = ('','','');
I prefer the following instead:
my @rows = ('') x 3;
Easier to read...?
--
Tore Aursand <[EM
epare( ... );
$stInsert->execute();
$stInsert->finish();
my $last_insert_id = $stInsert->{ 'mysql_insertid' };
> I know for a fact that another INSERT won't happen before the SELECT
> because they happen immediately one after the other.
Do yuo really? Is there _always_
'a[0]: ' . $a->[0] . "\n";
print 'b[0]: ' . $b->[0] . "\n";
}
As I _hope_ you can see, $a->[n] is easier to read than $$a[n]. Don't you
agree?
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Sun, 26 Oct 2003 01:52:21 -0700, perl wrote:
>> sub mysub {
>> my( $x, $y, $z ) = @_;
> Can I have three arrays instead?
Why would you have that? There are a lot of advantages by using
references.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
above?
This _could_ be solved by locking the table before the insert, and then
unlocking it again after you've select the maximum id from the same table.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
t what RDBMS you're using? With MySQL you
could easily look up the information you're looking for in the manual,
while other database systems need other approaches. Stick with an RDBMS
which gives you transactions.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mai
{
return unless ( /\.txt$/ );
if ( open(FILE, $_) ) {
while ( ) {
print $_;
}
close( FILE );
}
else {
# Couldn't open the file
}
}
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [E
data also goes into a CSV file; [...]
There are CSV modules on CPAN, as well. You might want to check them out.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
iece
Date::Calc
Date::Manip
I guess Date::Calc is the most relevant for you in this case.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Wed, 15 Oct 2003 17:34:33 -0400, Dan Anderson wrote:
> How is speed affected in the following scenarios:
> [...]
Why don't you find out? Take a look at the Benchmark module. There is
also a 'SWITCH' module out there, I think. You might look at that one,
too.
--
y ($inf, $sup, $str) = split(/\s+/, $_, 3);
foreach ( keys %data ) {
if ( $_ > $inf && $_ < $sup ) {
$data{ $str } = $str;
}
}
}
close( F2 );
# You might want to sort %data here
foreach ( keys %data ) {
print $_ . "\t"
ver, humans tend to
look upon lines filled with spaces as blank lines, too. :-)
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ft;
chomp( $string );
$string =~ s,^\s+,,;
$string =~ s,\s+$,,;
return $string;
}
This is clean _to me_, but I have no idea if you really need that chomp()
thing. Never tested the code above.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
= $cgi->param( 'direction' ) || '';
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Fri, 10 Oct 2003 08:40:17 -0500, James Edward Gray II wrote:
> I want to insert data from sms_log ie 10.100.208.254 server to
> 10.100.200.47 table ie sms_log1.
Well. What have you tried so far? It should be easy as long as you
create two database connections?
--
Tore Aursand &
rict;
use warnings;
use Time::Seconds;
use Time::Piece;
my $today = localtime;
my $yesterday = $today - ONE_DAY;
my $tomorrow = $today + ONE_DAY;
Install Time::Piece and do a 'perldoc Time::Piece' for more information.
--
Tore Aursand <[EMAIL PROTECTED]>
--
On Fri, 10 Oct 2003 14:57:47 +0200,
[EMAIL PROTECTED] wrote:
> i search hiw can i work on time.
> i want to get day number and make -1
Check out the heap of Date-related modules on http://www.cpan.org/.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PR
On Thu, 09 Oct 2003 21:12:38 -0400, chad kellerman wrote:
> Can anyone point me in the right direction?
Seems like you're trying to read a configuration file. There are modules
to do that work for you. Check out CPAN.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe,
On Wed, 08 Oct 2003 17:56:03 -0700, perl wrote:
> Can someone offers some recommendation into using dates?
Take a look at CPAN [1] for Date-related modules. My personal favorite
has become Time::Piece, although all the Date::* modules should be looked
upon.
[1] http://www.cpan.org/>
--
On Wed, 08 Oct 2003 12:39:40 +0200, Daniel Stellwagen wrote:
> if (-d $file)
>
> What does it mean, and are there more
Try 'perldoc -f -d'.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
use a regular expression:
$string =~ s/^.(.*).$/$1/;
Another solution, and most probably a lot faster, is this one:
$string = substr( $string, 1, (length($string) - 2) );
If you don't need the speed, stick with the first solution.
--
Tore Aursand <[EMAIL PROTECTED]>
-
On Mon, 06 Oct 2003 14:20:05 -0400, Chris Charley wrote:
> Then, on the command line I type: perl prepend.pl somefile.txt, but
> somefile.txt does not have the changes(Line: ).
Try writing 'perl prepend.pl somefile.txt > newfile.txt' instead.
--
Tore Aursand <[EMAI
69 matches
Mail list logo