Re: ***SPAM 06.50 / 05.00 *** Re: [mp2] ModPerl-Registry/t/bad_scritps.t returns 403 not 500

2003-09-05 Thread Ernest Lergon
Beau E. Cox wrote:

SPAM:  Start SpamAssassin results --
SPAM: This mail is probably spam.  The original message has been altered
SPAM: so you can recognise or block similar unwanted mail in future.
SPAM: See http://spamassassin.org/tag/ for more details.
SPAM: 
SPAM: Content analysis details:   (6.5 hits, 5 required)
SPAM: Hit! (2.7 points)  BODY: Nigerian scam key phrase ($NN,NNN,NNN.NN)
SPAM: Hit! (1.8 points)  No MX records for the From: domain
SPAM: Hit! (2.0 points)  Received via a relay in relays.osirusoft.com
SPAM:[RBL check: found 131.239.131.213.relays.osirusoft.com.]
SPAM: 
SPAM:  End of SpamAssassin results -

Stas -

Yep - ALL SET! Thanks a $1,000,000.

Aloha = Beau;

PS: I wonder whose anti-spam filter is going to
junk this email? :)



Mine ;-)

Ernest

--
  ProgramV - Alice on Perl - available at
   http://www.virtualitas.net/perl/aiml/
  VIRTUALITAS - Manufacturer of fine OOPPS - since 1996
*
* VIRTUALITAS Inc.   *   http://www.virtualitas.net *
* Ernest Lergon  *mailto:[EMAIL PROTECTED] *
*
  PGP-Fingerprint 6E6F DC17 A886 342D  D63F 7880 12F5 6BA9
PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc
   Member of the Alicebot and AIML Architecture Committee
http://www.alicebot.org/committees/architecture.html
-
SPAM ALERT   http://www.virtualitas.net/spam.html
-




--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


[BUG | ANNOUNCE] Apache::Status segfault | EnglishSave

2002-05-09 Thread Ernest Lergon

Trying to use the 'Memory Usage' feature of Apache::Status, I came
across the English module. 

Using it in a mod_perl Module causes Apache::Status to segfault. It
turned out, that when omitting some vars, the segfault was gone. 

So I put up a little changed version of English - EnglishSave. 

For the more enlightened perl people I also put two strace logs on this
page:

http://www.virtualitas.net/perl/englishsave/

Please download the module for testing. The ZIP file includes a test
module and a raw startup.pl.

I don't plan to upload it to CPAN, because the problem might not be in
English.pm but in Apache::Status - or in the darkness beclouding my head
;-))

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-05-02 Thread Ernest Lergon

Stas Bekman wrote:
 
 Ideally when such a
 situation happens, and you must load all the data into the memory, which
 is at short, your best bet is to rewrite the datastorage layer in XS/C,
 and use a tie interface to make it transparent to your perl code. So you
 will still use the hash but the refs to arrays will be actually C arrays.
 
Sorry, I'm not familiar with C(hinese) - but if someone could develop a
XS/Pascal interface ;-))

 Ernest Lergon wrote:

  Another thing I found is, that Apache::Status seems not always report
  complete values. Therefore I recorded the sizes from top, too.
 
 Were you running a single process? If you aren't Apache::Status could
 have shown you a different process.
 
Running httpd -X shows the same results.

I will use the named %index structure for now. Thanks to the modular OO
perl I can re-code my data package later, if the memory explosion hits
me again ;-))

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-05-01 Thread Ernest Lergon

Hi Stas,

having a look at Apache::Status and playing around with your tips on

http://www.apacheweek.com/features/mod_perl11

I found some interesting results and a compromising solution:

In a module I load a CSV file as class data into different structures
and compared the output of Apache::Status with top.

Enclosed you'll find a test report.

The code below 'building' shows, how the lines are put into the
structures.

The lines below 'perl-status' show the output of Apache::Status.
The line below 'top' shows the output of top.

Examples for the tested structures are:

$buffer = '1\tr1v1\tr1v2\tr1v3\n2\tr2v1\tr2v2\tr2v3\n' ...

@lines = (
'1\tr1v1\tr1v2\tr1v3',
'2\tr2v1\tr2v2\tr2v3',
... )

%data = (
1 = [ 1, 'r1v1' , 'r1v2' , 'r1v3' ],
2 = [ 2, 'r2v1' , 'r2v2' , 'r2v3' ],
... )

$pack = {
1 = [ 1, 'r1v1' , 'r1v2' , 'r1v3' ],
2 = [ 2, 'r2v1' , 'r2v2' , 'r2v3' ],
... }

%index = (
1 = '1\tr1v1\tr1v2\tr1v3',
2 = '2\tr2v1\tr2v2\tr2v3',
... )

One thing I realized using Devel::Peek is, that using a hash of
array-ref, each item in the array has the full blown perl flags etc.
That seems to be the reason for the 'memory explosion'.

Another thing I found is, that Apache::Status seems not always report
complete values. Therefore I recorded the sizes from top, too.

Especially for the the hash of array-refs (%data) and the hash-ref of
array-refs ($pack) perl-status reports only a part of the used memory
size: for $pack only the pointer (16 bytes), for %data only the keys
(?).

As compromise I'll use the %index structure. It is small enough while
providing a fast access. A further optimization will be to remove the
redundant key-field from each line.

Success: A reduction from 26 MB to 7 MB - what I estimated in my first
mail.

A last word from perldebguts.pod:

|| Perl is a profligate wastrel when it comes to memory use.  There is a
|| saying that to estimate memory usage of Perl, assume a reasonable
|| algorithm for memory allocation, multiply that estimate by 10, and
|| while you still may miss the mark, at least you won't be quite so
|| astonished.  This is not absolutely true, but may prvide a good grasp
|| of what happens.
||
|| [...]
||
|| Anecdotal estimates of source-to-compiled code bloat suggest an
|| eightfold increase.

Perhaps my experiences could be added to the long row of anecdotes ;-))

Thank you all again for escorting me on this deep dive.

Ernest

--

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




TEST REPORT
===

CSV file:
14350 records
CSV 2151045 bytes = 2101 Kbytes
CSV_2   2136695 bytes = 2086 Kbytes (w/o CR)

1   all empty
=

building:
none

perl-status:
*buffer{SCALAR}   25 bytes
*lines{ARRAY} 56 bytes
*data{HASH}  228 bytes
*pack{SCALAR} 16 bytes
*index{HASH} 228 bytes

top:
12992  12M 12844   base

2   buffer
==

building:
$buffer .= $_ . \n;

perl-status:
*buffer{SCALAR}  2151069 bytes = CSV + 24 bytes
*lines{ARRAY} 56 bytes
*data{HASH}  228 bytes
*pack{SCALAR} 16 bytes
*index{HASH} 228 bytes

top:
17200  16M 17040   base + 4208 Kbytes = CSV + 2107 KBytes

3   lines
=

building:
push @lines, $_;

perl-status:
*buffer{SCALAR}   25 bytes
*lines{ARRAY}2519860 bytes = CSV_2 + 383165 bytes
 (approx. 27 * 14350 )
*data{HASH}  228 bytes
*pack{SCALAR} 16 bytes
*index{HASH} 228 bytes

top:
18220  17M 18076   base + 5228 Kbytes = CSV_2 + 3142 Kbytes

4   data


building:
@record = split ( \t, $_ );
$key = 0 + $record[0];
$data{$key} = [ @record ];

perl-status:
*buffer{SCALAR}   25 bytes
*lines{ARRAY} 56 bytes
*data{HASH}   723302 bytes = approx. 50 * 14350 ( key +
ref )
 (where is the data?)
*pack{SCALAR} 16 bytes
*index{HASH} 228 bytes

top:
40488  38M 39208   base + 27566 Kbytes = CSV_2 + 25480 Kbytes

Re: Memory explodes loading CSV into hash

2002-04-29 Thread Ernest Lergon

Kee Hinckley wrote:
 
 
  At 17:18 28.04.2002, Ernest Lergon wrote:
  Now I'm scared about the memory consumption:
  
  The CSV file has 14.000 records with 18 fields and a size of 2 MB
  (approx. 150 Bytes per record).
 
  Now a question I would like to ask: do you *need* to read the whole CSV
  info into memory? There are ways to overcome this. For example, looking at
 
 When I have a csv to play with and it's not up to being transfered to a real
 database I use the DBD CSV module which puts a nice sql wrapper around
 it.

I've installed DBD::CSV and tested it with my data:

$dbh =
DBI-connect(DBI:CSV:csv_sep_char=\t;csv_eol=\n;csv_escape_char=)
$dbh-{'csv_tables'}-{'foo'} = { 'file' = 'foo.data'};

3 MB memory used.

$sth = $dbh-prepare(SELECT * FROM foo);

3 MB memory used.

$sth-execute();

16 MB memory used!

If I do it record by record like

$sth = $dbh-prepare(SELECT * FROM foo WHERE id=?);

than memory usage will grow query by query due to caching.

Moreover it becomes VERY slow because of reading every time the whole
file again; an index can't be created/used.

No win :-(

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-04-29 Thread Ernest Lergon

Perrin Harkins wrote:
 
  $foo-{$i} = [ @record ];
 
 You're creating 14000 arrays, and references to them (refs take up space
 too!).  That's where the memory is going.
 
 See if you can use a more efficient data structure.  For example, it
 takes less space to make 4 arrays with 14000 entries in each than to
 make 14000 arrays with 4 entries each.


So I turned it around:

$col holds now 18 arrays with 14000 entries each and prints the correct
results:

#!/usr/bin/perl -w

$col = {};

$line = \t\t\t;   #   4 string fields (4 chars)
$line .= \t10.99x9;   #   9 float fields (5 chars)
$line .= \t . 'A'x17; #   5 string fields (rest)
$line .= \t . 'B'x17; #
$line .= \t . 'C'x17; #
$line .= \t . 'D'x17; #
$line .= \t . 'E'x17; #

@record = split \t, $line;

foreach $j ( 0 .. $#record )
{
$col-{$j} = [];
}

for ( $i = 0; $i  14000; $i++ )
{
map { $_++ } @record;

foreach $j ( 0 .. $#record )
{
push @ { $col-{$j} }, $record [$j];
}

print $i\t$col-{0}-[$i],$col-{5}-[$i]\n   unless $i % 1000;
}

;

1;

and gives:

SIZE   RSS  SHARE
12364  12M  1044

Wow, 2 MB saved ;-))

I think, a reference is a pointer of 8 Bytes, so:

14.000 * 8 = approx. 112 KBytes - right?

This doesn't explain the difference of 7 MB calculated and 14 MB
measured.

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-04-29 Thread Ernest Lergon

Hi,

thank you all for your hints, BUT (with capital letters ;-)

I think, it's a question of speed: If I hold my data in a hash in
memory, access should be faster than using any kind of external
database.

What makes me wonder is the extremely blown up size (mod)perl uses for
datastructures.

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-04-29 Thread Ernest Lergon

Perrin Harkins wrote:
 
 [snip]

 Incidentally, that map statement in your script isn't doing
 anything that I can see.

It simulates different values for each record - e.g.:

$line = \t\t1000\t10.99;

@record = split \t, $line;

for ( $i = 0; $i  14000; $i++ )
{
map { $_++ } @record;

#   $i=0@record=('AAAB','BBBC',1001,11.99);
#   $i=1@record=('AAAC','BBBD',1002,12.99);
#   $i=2@record=('AAAD','BBBE',1003,13.99);
#   etc.
}


 [snip]

Thanks for your explanations about perl's memory usage.

 At any rate, mod_perl doesn't seem to be at fault here.  It's just a
 general perl issue.
 
I think so, too.

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Mod_perl, handler problem with httpd.conf

2002-04-28 Thread Ernest Lergon

Ward W. Vuillemot wrote:
 
 [snip]

 But, apachectl configtest tells me
 Invalid command 'SetHandler', perhaps mis-spelled or defined by a module not
 included in the server configuration
 
 Running httpd -l, returns
 Compiled-in modules:
   http_core.c
   mod_env.c
   mod_log_config.c
   mod_negotiation.c
   mod_include.c
   mod_autoindex.c
   mod_dir.c
   mod_cgi.c
   mod_imap.c
   mod_actions.c
   mod_rewrite.c
   mod_access.c
   mod_auth.c
   mod_so.c
   mod_setenvif.c
   mod_ssl.c
   mod_perl.c
 

Dear Ward,

make sure, you have AddModule directives for each compiled-in module
(except httpd_core) in your httpd.conf  - e.g.

AddModule mod_env.c
AddModule mod_log_config.c
 ...
AddModule mod_ssl.c
AddModule mod_perl.c

See

http://httpd.apache.org/docs/mod/core.html#addmodule


Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Mod_perl, handler problem with httpd.conf

2002-04-28 Thread Ernest Lergon

Ooops,

clicking on send, I saw, that mod_mime is not compiled in.

See

http://httpd.apache.org/docs/mod/mod_mime.html#sethandler

Sorry.

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Memory explodes loading CSV into hash

2002-04-28 Thread Ernest Lergon

Hi,

in a mod_perl package I load a CSV file on apache startup into a simple
hash as read-only class data to be shared by all childs.

A loading routine reads the file line by line and uses one numeric field
as hash entry (error checks etc. omitted):

package Data;

my $class_data = {};

ReadFile ( 'data.txt', $class_data, 4 );

sub ReadFile
{
my $filename  = shift;  # path string
my $data  = shift;  # ref to hash
my $ndx_field = shift;  # field number

my ( @record, $num_key );
local $_;

open ( INFILE, $filename );
while ( INFILE )
{
chomp;
@record = split \t;
$num_key = $record[$ndx_field];
$data-{$num_key} = [ @record ];
}
close ( INFILE );
}

sub new...
creates an object for searching the data, last result, errors etc.

sub find...
method with something like:
if exists $class_data-{$key}   return...
etc.

Now I'm scared about the memory consumption:

The CSV file has 14.000 records with 18 fields and a size of 2 MB
(approx. 150 Bytes per record).

Omitting the loading, top shows, that each httpd instance has 10 MB (all
shared as it should be).

But reading in the file explodes the memory to 36 MB (ok, shared as
well)!

So, how comes, that 2 MB data need 26 MB of memory, if it is stored as a
hash?

Reading perldebguts.pod I did not expect such an increasing:

Description (avg.) CSV  Perl
4 string fields (4 chars)16 bytes   (32 bytes)  128 bytes
9 float fields (5 chars) 45 bytes   (24 bytes)  216 bytes
5 string fields (rest)   89 bytes   (32 bytes)  160 bytes
the integer key (20 bytes)   20 bytes
150 bytes   524 bytes

That will give 14.000 x 524 = approx. 7 MB, but not 26 MB !?

Lost in space...

Ernest


P.S.:

Apache/1.3.19 (Unix) (SuSE/Linux) mod_perl/1.25
This is perl, v5.6.0 built for i586-linux


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Memory explodes loading CSV into hash

2002-04-28 Thread Ernest Lergon

Jeffrey Baker wrote:
 
 I tried this program in Perl (outside of modperl) and the memory
 consumption is only 4.5MB:
 
 #!/usr/bin/perl -w
 
 $foo = {};
 
 for ($i = 0; $i  14000; $i++) {
 $foo-{sprintf('%020d', $i)} = 'A'x150;
 }
 
 ;
 
 1;
 
 So I suggest something else might be going on causing your memory
 problems.
 
Hi Jeffrey,

good idea to boil it down.

Yes, your prog gave me only:

SIZE   RSS  SHARE
 4696  4696  964

Running my code snippet outside mod_perl (with real data) still gives:

SIZE   RSS  SHARE
14932  14M  1012

A simulation like this:

#!/usr/bin/perl -w

$foo = {};

$line = \t\t\t;   #   4 string fields (4 chars)
$line .= \t10.99x9;   #   9 float fields (5 chars)
$line .= \t . 'A'x17; #   5 string fields (rest)
$line .= \t . 'B'x17; #
$line .= \t . 'C'x17; #
$line .= \t . 'D'x17; #
$line .= \t . 'E'x17; #

@record = split \t, $line;

for ($i = 0; $i  14000; $i++)
{
map { $_++ } @record;

$foo-{$i} = [ @record ];

print $i\t$foo-{$i}-[0],$foo-{$i}-[5]\n   unless $i % 1000;
}

;

1;

prints:

0   AAAB,11.99
1000ABMN,1011.99
2000ACYZ,2011.99
3000AELL,3011.99
4000AFXX,4011.99
5000AHKJ,5011.99
6000AIWV,6011.99
7000AKJH,7011.99
8000ALVT,8011.99
9000ANIF,9011.99
1   AOUR,10011.99
11000   AQHD,11011.99
12000   ARTP,12011.99
13000   ATGB,13011.99

and gives:

SIZE   RSS  SHARE
14060  13M  1036

There is no difference between real and random data.

But I think, there is an optimization mechanism in perl concerning
strings, so you need less memory for your code.

So what is going on?  2 MB - 14 MB ?

Still lost in space ;-))

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: [Q maybe OT] forward

2002-04-24 Thread Ernest Lergon

Martin Haase-Thomas wrote:
 
 I am quite certain that recently I saw a server response code concerning
 forwarding. It may have looked like HTTP_DOCUMENT_FORWARDED or anything
 alike.
 
Hi Martin,

just a guess: Do you mean the header entry 'X-Forwarded-For' ?

See

http://take23.org/docs/guide/scenario.xml/8

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




[OT] Re: htaccess

2002-04-15 Thread Ernest Lergon

Paul Williams wrote:
 
 -
 AuthUserFile /dev/null
 AuthGroupFile /dev/null
 RewriteEngine On
 RewriteCond %{HTTP_REFERER} !^http://www.myserver.com [NC]
 RewriteCond %{HTTP_REFERER} !^http://myserver.com [NC]
 RewriteRule /* http://www.myserver.com/error.mv [R,L]
 -
 
 My question is, instead of a RewriteRule that returns a page, how do i
 write it so it returns either A) nothing or, B) some text like Not
 Found?
 

Hi Paul,

maybe you want to tell the user, that it is forbidden to use a page of
your site coming from outside. So use as last rule:

RewriteRule .* - [F]

This will send the standard forbidden status (403) to the user. See:

http://httpd.apache.org/docs/misc/rewriteguide.html

But do NOT rely on the HTTP_REFERER, because some browsers don't send
it:

http://websiteowner.info/articles/pages/hotlinking.asp

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Apache::File correction

2002-04-12 Thread Ernest Lergon

Martin Haase-Thomas wrote:
 
 [snip] Secondly I wonder whether local $/ = undef
 will have any effect. But I've never tried overriding Perl's predefined
 variables.
 
 regards

Dear Martin,

this is the well-known file-slurp mode.

E.g.:

undef $/;   # enable slurp mode
$_ = FH;  # whole file now here
s/\n[ \t]+/ /g;


Look for slurp in your perl docs.

Ernest




-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




Re: Thanks and GoodBye

2002-04-06 Thread Ernest Lergon

Dear John,

on our SuSe 7.3 server I run the shipped ready-made installation of
Apache/mod_perl using DSO.

It works fine, no special problems so far.

Please don't give up, it's worth another try!

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*
   PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc




[OT] CPAN hacked?

2002-03-26 Thread Ernest Lergon

Hi,

is http://search.cpan.org hacked?

Enclosed two traceroutes FYI.

Ernest



cpan.org 209.85.157.220
---

[snip]
  5   160 ms   150 ms   161 ms  dt-gw.wswdc.ip.att.net [194.25.6.234]
  6   160 ms   161 ms   160 ms  12.122.11.233
  7   170 ms   180 ms   180 ms  tbr1-cl4.sl9mo.ip.att.net [12.122.10.30]
  8   180 ms   190 ms   171 ms  tbr2-p012401.sl9mo.ip.att.net [12.122.9.142]
  9 *** Timeout
 10   210 ms   211 ms   220 ms  gbr5-p40.la2ca.ip.att.net [12.122.11.154]
 11   210 ms   221 ms   210 ms  gar2-p360.la2ca.ip.att.net [12.123.28.169]
 12   211 ms   220 ms   210 ms  12.127.139.82
 13   210 ms *  220 ms  vlan1-mdr-lan-access2.mdr.softaware.net [209.85.0.11]
 14   210 ms   220 ms   221 ms  onion.valueclick.com [209.85.157.220]



search.cpan.org 198.246.0.28


[snip]
  5   151 ms   160 ms   160 ms  dt-gw.wswdc.ip.att.net [194.25.6.234]
  6   151 ms   160 ms   160 ms  12.122.11.233
  7   170 ms   181 ms   210 ms  tbr1-cl4.sl9mo.ip.att.net [12.122.10.30]
  8   170 ms   170 ms   171 ms  gbr1-p10.sl9mo.ip.att.net [12.122.11.98]
  9   170 ms   171 ms   180 ms  ar13-p310.sl9mo.ip.att.net [12.123.24.241]
 10   171 ms   180 ms   180 ms  12.119.206.62
 11   171 ms   170 ms   180 ms  gargoyle.webster.edu [198.246.0.28]




-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




[OT] activating multimedia files in cgi-bin

2002-03-26 Thread Ernest Lergon

Daniel Jonda wrote:
 
 http://www.flyerfabrik.de/cgi-bin/gallery/gallery.cgi
 
See

http://httpd.apache.org/docs/mod/mod_alias.html#scriptalias

It is a very bad idea to place content below /cgi-bin.

Everything what is called below /cgi-bin is interpreted as a skript -
apache want's to run it, as Luciano said correctly.

E.g.:

If I call your skript with Netscape (Stylesheets on) I receive an
internal server error for this address:

http://www.flyerfabrik.de/cgi-bin/gallery/skins/default/styles.css

Turning it off, the script runs, but the images are not displayed. It's
the same as above:

http://www.flyerfabrik.de/cgi-bin/gallery/skins/categoryfolder.gif

gives 500 Internal server error.

So relocate your stuff.

Ernest


P.S.: This is OT, IMHO.


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




[OT] CPAN hacked?

2002-03-26 Thread Ernest Lergon

Hi,

is http://search.cpan.org hacked?

A Chaos titled page with a baby-photo saying Question everything is displayed.

Enclosed two traceroutes FYI.

Ernest



cpan.org 209.85.157.220
---

[snip]
  5   160 ms   150 ms   161 ms  dt-gw.wswdc.ip.att.net [194.25.6.234]
  6   160 ms   161 ms   160 ms  12.122.11.233
  7   170 ms   180 ms   180 ms  tbr1-cl4.sl9mo.ip.att.net [12.122.10.30]
  8   180 ms   190 ms   171 ms  tbr2-p012401.sl9mo.ip.att.net [12.122.9.142]
  9 *** Timeout
 10   210 ms   211 ms   220 ms  gbr5-p40.la2ca.ip.att.net [12.122.11.154]
 11   210 ms   221 ms   210 ms  gar2-p360.la2ca.ip.att.net [12.123.28.169]
 12   211 ms   220 ms   210 ms  12.127.139.82
 13   210 ms *  220 ms  vlan1-mdr-lan-access2.mdr.softaware.net [209.85.0.11]
 14   210 ms   220 ms   221 ms  onion.valueclick.com [209.85.157.220]



search.cpan.org 198.246.0.28


[snip]
  5   151 ms   160 ms   160 ms  dt-gw.wswdc.ip.att.net [194.25.6.234]
  6   151 ms   160 ms   160 ms  12.122.11.233
  7   170 ms   181 ms   210 ms  tbr1-cl4.sl9mo.ip.att.net [12.122.10.30]
  8   170 ms   170 ms   171 ms  gbr1-p10.sl9mo.ip.att.net [12.122.11.98]
  9   170 ms   171 ms   180 ms  ar13-p310.sl9mo.ip.att.net [12.123.24.241]
 10   171 ms   180 ms   180 ms  12.119.206.62
 11   171 ms   170 ms   180 ms  gargoyle.webster.edu [198.246.0.28]




-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: [OT] CPAN hacked?

2002-03-26 Thread Ernest Lergon

Sorry,

must have been a problem with a hidden proxy of my ISP or something. I
did'nt tell my browser to use any proxy.

It's all working again.

Please calm down ;-))

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: How to get two perl namespaces in apache

2002-03-26 Thread Ernest Lergon

Thomas K. Burkholder wrote:
 
 So, I guess I'm wondering if there's an easy way to have two completely
 separate apache configurations running on the same machine (listening on
 different ports obviously).
 

Hi Thomas,

just throwing a glance I found:

http://thingy.kcilink.com/modperlguide/modules/Apache_PerlVINC_Allows_Module.html

Maybe someone here has experience with it.

More tips on

http://thingy.kcilink.com/modperlguide/porting/Name_collisions_with_Modules_and.html

and in this discussion:

http://www.mail-archive.com/modperl@apache.org/msg24564.html

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: handler not being called

2002-03-20 Thread Ernest Lergon

Rizwan Majeed wrote:
 
 I have added a handler entry in httpd.conf
 
 location /myhandler
   SetHandler perl-script
   PerlHandler Demo
 /Location
 
 and I have printed a string inside the handler thats it.
 
Hi Riz,

do you load your Module Demo.pm somewhere?

E.g. in httpd.conf:

PerlModule Demo

or in startup.pl

use Demo();

And maybe you have to add butter to the fish ;-) - be more verbose in
your Location definition. See:

http://perl.apache.org/guide/config.html#_Location_Configuration

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: mod_perl does not see multipart POSTs -- SOLVED

2002-03-20 Thread Ernest Lergon

Vuillemot, Ward W wrote:
 
 Using the POST2GET snippet was interferring.  I thought I had turned it off
 when trying Lergon's suggestion.  I must not have.
 As for the actual code. . .I copied it exactly as Lergon's and it works.  I
 know what was different...

 [snip]

Hi Ward, hi Randy!

Thank you for the flowers, Ward, but it I don't want to adorn myself
with borrowed plumes ;-))

So the hint was mine and the code was Randy's!

Ernest




-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: mod_perl does not see multipart POSTs

2002-03-19 Thread Ernest Lergon

Vuillemot, Ward W wrote:
 
 Here is the Apache config
 PerlModule testUpload
 Location /testUpload
   SetHandler perl-script
   PerlHandler testUpload
   PerlSendHeader Off
   # limit POSTS so that they get processed properly
   Limit POST
 PerlInitHandler POST2GET
   /Limit
 /Location
 

Hi Ward,

assumed, you have seen the example from

http://perl.apache.org/guide/snippets.html#Reusing_Data_from_POST_request

and you have written your own POST2GET.pm, more questions are arising:

Is POST2GET.pm loaded anywhere - in a startup.pl or via httpd.conf?

Some more hints:

Add 'use warnings;' to your code and look at your error_log.
CGI.pm should be loaded AND compiled very early.
Be careful with global vars under mod_perl.
Look in CPAN to avoid reinventing the wheel:
http://search.cpan.org/search?mode=modulequery=upload

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Minimum config for proxy+mod_perl / mod_define.so ?

2002-03-16 Thread Ernest Lergon

Hi,

in a 2-server-on-one-machine-environment (proxy/mod_perl) I try to slim
especially the proxy httpd as much as possible by removing all unneeded
modules.

Please help me at 2 questions:

1. What is the minimum of modules to be loaded for the proxy and the
mod_perl apache? (Ok, I'm about to find out by trial and error, but
maybe someone has a working solution).

2. What is the purpose of this module:

LoadModule define_module /usr/lib/apache/mod_define.so

I can't find it in the docs.

I'm running Apache/1.3.19 on SuSE Linux 7.2 (i386).

Xanx!

Ernest




-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: Minimum config for proxy+mod_perl / mod_define.so ?

2002-03-16 Thread Ernest Lergon

Oh, sorry, I forgot:

httpd -l gives:

Compiled-in modules:
  http_core.c
  mod_so.c
suexec: enabled; valid wrapper /usr/sbin/suexec

The rest is DSO.

Ernest




Re: problems returning a hash of hashes using mod_perl

2002-03-14 Thread Ernest Lergon

[EMAIL PROTECTED] wrote:
 
 [snip]

 
 |  return %Actions::Vars::config{$conf}; |
 
-
 
Must read:

return $Actions::Vars::config{$conf};   # returns a hash reference
or
return % { $Actions::Vars::config{$conf} || {} }; # returns plain hash

and should have been created like this:

my %user_conf = ( foo = 1, bar = 'on' );

$Actions::Vars::config{'user'} = { %user_conf };

One more tip: always say:

use strict;
use warnings;

That should have told you, whats wrong ;-))

See also

http://www.perldoc.com/perl5.6/pod/perldsc.html#Declaration-of-a-HASH-OF-HASHES

Ernest



-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: Serious bug, mixing mod-perl content

2002-03-13 Thread Ernest Lergon

 Miroslav Madzarevic wrote:
 
 Ernest: I don't use server aliases but I'm going to fix that. I wish
 that the problem is so simple. Actually the two virt. hosts are
 beta.domain.com and www.domain.com
 
So the httpd.conf should read:

VirtualHost *
ServerName www.domain.com
ServerAlias *.domain.com
ServerAlias domain.com
#   ...
/VirtualHost

VirtualHost *
ServerName beta.domain.com
#   no alias!
#   ...
/VirtualHost

So every request except for beta.domain.com will go to the first VH: The
order of the VirtualHost-entries in httpd.conf are important - see

http://httpd.apache.org/docs/vhosts/details.html

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: Serious bug, mixing mod-perl content

2002-03-12 Thread Ernest Lergon

 Miroslav Madzarevic wrote:
 
 I have virthost1 and virthost2 on mod-perl apache, most of the time
 you get the right content when calling respective virthost but
 sometimes when you call virthost2 you get response from virt. host 1.
 This is a rare bug but happens.
 
Do you have this in your httpd.conf?

VirtualHost *
ServerName www.virthost1.de
ServerAlias *.virthost1.de
ServerAlias virthost1.de
#   ...
/VirtualHost

VirtualHost *
ServerName www.virthost2.de
ServerAlias *.virthost2.de
ServerAlias virthost2.de
#   ...
/VirtualHost

If ServerAlias for the virthost2 is missing and the user types the
server name without 'www', the pages will be served from the first
server apache finds.

I use it like above -  just as wearing braces and belt ;-))

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: Virtual locations in mod_perl

2002-03-07 Thread Ernest Lergon

Milo Hyson wrote:
 
 [snip]
 handler ... virtual location (i.e. one that does not directly
 map to anything in the server's filesystem).
 [snip]


Hi Milo,

that's easy. This is an anonymized excerpt of httpd.conf for a
multilanguage shop. None of the named locations exists on the server:

VirtualHost *
ServerName www.myshop.xxx
ServerAlias *.myshop.xxx
ServerAlias myshop.xxx
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /home/myshop/public_html
CustomLog /home/myshop/log/access_log combined
ErrorLog /home/myshop/log/error_log
ScriptAlias /cgi-bin/ /home/myshop/public_html/cgi-bin/

# This delivers the main page:

LocationMatch ^(/|/index|/de|/de/|/de/index)$
SetHandler  perl-script
PerlSetVar  Languagede
PerlHandler MyShop::Index
/LocationMatch

# This delivers catalogue pages:

Location /de/catalog
SetHandler  perl-script
PerlSetVar  Languagede
PerlHandler MyShop::Catalog
/Location

# Detailed view of articles:

Location /de/zoom
SetHandler  perl-script
PerlSetVar  Languagede
PerlHandler MyShop::Zoom
/Location

# A search form (In/Out):

Location /de/search
SetHandler  perl-script
PerlSetVar  Languagede
PerlHandler MyShop::Search
/Location

# and more...

# Same in English:

LocationMatch ^(/|/index/en|/en/|/en/index)$
SetHandler  perl-script
PerlSetVar  Languageen
PerlHandler MyShop::Index
/LocationMatch


# and as above...

/VirtualHost


Hope, that helps.

Ernest


-- 

*
* VIRTUALITAS Inc.   *  *
**  *
* European Consultant Office *  http://www.virtualitas.net  *
* Internationales Handelszentrum *   contact:Ernest Lergon  *
* Friedrichstraße 95 *mailto:[EMAIL PROTECTED] *
* 10117 Berlin / Germany *   ums:+49180528132130266 *
*




Re: PerlRequire

2001-02-12 Thread Ernest Lergon

Aaron Schlesinger wrote:
 
 I have a line in my httpd.conf:
 
 PerlRequire /path/to/startup.pl
 
 In startup.pl I have this line:
 
 use lib '/path/to/module';
 
 This is not being added to my @INC like it should.

try

use lib '/path/to';
use module;



Ernest





-- 
Yours sincerely
Mit freundlichen Gren

Ernest Lergon

VIRTUALITAS
Artists online, Fine Arts online, Poets online
http://www.virtualitas.com/




Re: How to recognize server shutdown?

2001-01-11 Thread Ernest Lergon

Doug MacEachern wrote:

 I meant "is there a way to run a cleanup handler in the parent after it's
 work is done?", but I don't see one.  Dave says the END block trick worked
 for him, so maybe it only fails under certain circumstances.

 of course, there is such a "trick"
 
[EMAIL PROTECTED]">http://forum.swarthmore.edu/epigone/modperl/thandflunjimp/[EMAIL PROTECTED]

Sorry, I should have dropped earlier into this thread: Doug's "trick"
works great for me!

Thanks!

Ernest




--
Yours sincerely
Mit freundlichen Gren

Ernest Lergon

VIRTUALITAS
Artists online, Fine Arts online, Poets online
http://www.virtualitas.com/




Re: Precompile to protect code?

2000-12-18 Thread Ernest Lergon

Jason Leidigh wrote:

 I have a mod_perl module which I would like to protect.  The code
 is very "private" and I would like to have it exist only as perl byte
 code... which can be used each time the server may be restarted... is
 this possible?  How?

Just out of my head:

Make a directory like /lib/perl/private and chmod 700 it.
Put your module MyModule.pm there and chmod 600 it.
In your startup.pl (called from httpd.conf) put

use lib qw ( /lib/perl/private );
use MyModule;

I think this would work, because httpd is started from root, so it can
read the module.

For all other users than root the directory and module is invisible.

I have not tested it - maybe I'm wrong...

Ernest




--
Yours sincerely
Mit freundlichen Grüßen

Ernest Lergon

VIRTUALITAS
Artists online, Fine Arts online, Poets online
http://www.virtualitas.com/





Re: mime-type headers

2000-11-30 Thread Ernest Lergon

Eustace, Glen wrote:

 But with IE, no go. I have 2 PCs, both with IE5.5 and with acrobat 4 and the
 other acrobat 3. On the first, on both I get no new window, a page of
 hieroglyphics on the first and on the second I get acrobat started but no
 page displayed.

 Any clues ?

Some time ago I had this problem with "Window-Target", too. I wanted
to use it for an elegant solution for a customer - automatic choice of
the target frame depending on content etc. At last I removed all
related code and developed a complete other solution independent of
"Window- Target", because it is working ONLY with Netscape-Browsers
and NOT with M$-IE5!

Unfortunately most of the surfers (according to our webstats) are using
M$-IE5 - so forget "Window-Target"...

Ernest





--
Yours sincerely
Mit freundlichen Grüßen

Ernest Lergon

VIRTUALITAS
Artists online, Fine Arts online, Poets online
http://www.virtualitas.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File Space Usage ... in perl ?

2000-10-21 Thread Ernest Lergon

Dear Fred,

without testing it, just some ideas. Try to exchange:

To be on the safe side:

   my $_size = -s $File::Find::name;
my $_size = -s $File::Find::fullname;

To count links in:

   find ( $wanted, "$dir" );
find ( { wanted = $wanted, follow = 1 }, $dir );

Check out via telnet:

du /etc
du -L /etc

And the results may be different, if you are logged in as root or
if you run your program as user nobody because of access rights.

Ernest




--
Yours sincerely
Mit freundlichen Grüßen

Ernest Lergon

VIRTUALITAS
Artists online, Fine Arts online, Poets online
http://www.virtualitas.com/