Mailing List Archive

Input files in Execute and PerlIO layers for theirs + object_base option doesn't work
Dear Gerald,

I have some problems with Embperl 2.4.0 (perl v.5.14.2)
First, i use Embperl in my own environment (no mod_perl, apache, fcgi
and etc). Only process under Starman server

I want to use Embperl as:

my $out;

Embperl::Object::Execute({
inputfile => "/foo/dir/test.epl",
object_base => 'base.epl',
object_stopdir => "/foo/dir",
output => \$out
})

I have some problems:

1) (BUG?) Embperl::Object doesn't see base.epl file.
I have /foo/dir/base.epl in directory!
I see in Starman's logs error as:

[1738]ERR: 404: : Not found '_base.epl', searched:

If i rename base.epl to _base.epl them my template works BUT:

2) (HELP) Other problem. I use everywhere UTF-8 encoding. My scripts
have "use utf8" and in UTF-8 encoding, files are in UTF-8
But i see that $out in my example doesn't have utf8 flag.
I think it's because Embperl open file (inputfile) without ":utf8"
layer. And it reads this file as plain binary file.
If i will use "params" with utf8 perl variables i think i will have a hell.

You write in documentation that Embperl works with UTF-8. Yes, may be
it keeps utf8 flag in variables, in outputs but i think Embperl
doesn't work correctly with input files.
Am i right?

As workaround i see simple option: inputfile_binmode in Execute
function for example. If Embperl will have this option i will happy as
i think! For example: if i use this option then Embperl opens files
under Execute and use PerlIO layer with this layer.

Certainly, i can read files myself and use 'input' option but i want
to use benefits of caching of Embperl. If i use files through Embperl
as i think the Embperl controls modification times of files and caches
theirs.

Perlover

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Input files in Execute and PerlIO layers for theirs + object_base option doesn't work [ In reply to ]
Hi,

I resolved one question (_base.epl)

I found in your mail archive that i should set too 'appname' option
(but no any tips in documentation about this). Now 'base.epl' works

Second question about layer for reading of 'inputfile' is not resolved by me :(

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: Input files in Execute and PerlIO layers for theirs + object_base option doesn't work [ In reply to ]
Hi,

unfortunately implementing this Perlio UTF8 stuff is not done very quickly.

I will put on the TODO list, but don't expect a quick solution.

You can use the input option and read you the files on your own, just pass the mtime of the file as mtime option and Embperl will cache your files the same way if it has read the file on it's own.

Hope this helps

Gerald


> -----Original Message-----
> From: Perlover [mailto:perlover@gmail.com]
> Sent: Wednesday, September 26, 2012 12:18 PM
> To: embperl@perl.apache.org
> Subject: Input files in Execute and PerlIO layers for theirs + object_base
> option doesn't work
>
> Dear Gerald,
>
> I have some problems with Embperl 2.4.0 (perl v.5.14.2) First, i use Embperl in
> my own environment (no mod_perl, apache, fcgi and etc). Only process
> under Starman server
>
> I want to use Embperl as:
>
> my $out;
>
> Embperl::Object::Execute({
> inputfile => "/foo/dir/test.epl",
> object_base => 'base.epl',
> object_stopdir => "/foo/dir",
> output => \$out
> })
>
> I have some problems:
>
> 1) (BUG?) Embperl::Object doesn't see base.epl file.
> I have /foo/dir/base.epl in directory!
> I see in Starman's logs error as:
>
> [1738]ERR: 404: : Not found '_base.epl', searched:
>
> If i rename base.epl to _base.epl them my template works BUT:
>
> 2) (HELP) Other problem. I use everywhere UTF-8 encoding. My scripts have
> "use utf8" and in UTF-8 encoding, files are in UTF-8 But i see that $out in my
> example doesn't have utf8 flag.
> I think it's because Embperl open file (inputfile) without ":utf8"
> layer. And it reads this file as plain binary file.
> If i will use "params" with utf8 perl variables i think i will have a hell.
>
> You write in documentation that Embperl works with UTF-8. Yes, may be it
> keeps utf8 flag in variables, in outputs but i think Embperl doesn't work
> correctly with input files.
> Am i right?
>
> As workaround i see simple option: inputfile_binmode in Execute function
> for example. If Embperl will have this option i will happy as i think! For
> example: if i use this option then Embperl opens files under Execute and use
> PerlIO layer with this layer.
>
> Certainly, i can read files myself and use 'input' option but i want to use
> benefits of caching of Embperl. If i use files through Embperl as i think the
> Embperl controls modification times of files and caches theirs.
>
> Perlover
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Input files in Execute and PerlIO layers for theirs + object_base option doesn't work [ In reply to ]
Hi,

> unfortunately implementing this Perlio UTF8 stuff is not done very quickly.

UTF8 doesn't work quickly in Perl? What problem to add new option like
'binmode' (binmode => ":utf8") and use this binmode for reading all
files by Embperl?

I can use mtime but if i use Embperl::Object i should trace myself not
only mtime of main file but everything under this - base.epl mtime too
for example
It's very not quickly, i think UTF8 file decoding could quickly in many times :)

Ok, i resolved problem already by using Template::Toolkit (he caches a
files but works slowly), sorry

P.S. Embperl i used many years before. But i need now in UTF-8
encoding in files.

Best regards, Perlover

2012/10/3 <richter@ecos.de>:
> Hi,
>
> unfortunately implementing this Perlio UTF8 stuff is not done very quickly.
>
> I will put on the TODO list, but don't expect a quick solution.
>
> You can use the input option and read you the files on your own, just pass the mtime of the file as mtime option and Embperl will cache your files the same way if it has read the file on it's own.
>
> Hope this helps
>
> Gerald
>
>
>> -----Original Message-----
>> From: Perlover [mailto:perlover@gmail.com]
>> Sent: Wednesday, September 26, 2012 12:18 PM
>> To: embperl@perl.apache.org
>> Subject: Input files in Execute and PerlIO layers for theirs + object_base
>> option doesn't work
>>
>> Dear Gerald,
>>
>> I have some problems with Embperl 2.4.0 (perl v.5.14.2) First, i use Embperl in
>> my own environment (no mod_perl, apache, fcgi and etc). Only process
>> under Starman server
>>
>> I want to use Embperl as:
>>
>> my $out;
>>
>> Embperl::Object::Execute({
>> inputfile => "/foo/dir/test.epl",
>> object_base => 'base.epl',
>> object_stopdir => "/foo/dir",
>> output => \$out
>> })
>>
>> I have some problems:
>>
>> 1) (BUG?) Embperl::Object doesn't see base.epl file.
>> I have /foo/dir/base.epl in directory!
>> I see in Starman's logs error as:
>>
>> [1738]ERR: 404: : Not found '_base.epl', searched:
>>
>> If i rename base.epl to _base.epl them my template works BUT:
>>
>> 2) (HELP) Other problem. I use everywhere UTF-8 encoding. My scripts have
>> "use utf8" and in UTF-8 encoding, files are in UTF-8 But i see that $out in my
>> example doesn't have utf8 flag.
>> I think it's because Embperl open file (inputfile) without ":utf8"
>> layer. And it reads this file as plain binary file.
>> If i will use "params" with utf8 perl variables i think i will have a hell.
>>
>> You write in documentation that Embperl works with UTF-8. Yes, may be it
>> keeps utf8 flag in variables, in outputs but i think Embperl doesn't work
>> correctly with input files.
>> Am i right?
>>
>> As workaround i see simple option: inputfile_binmode in Execute function
>> for example. If Embperl will have this option i will happy as i think! For
>> example: if i use this option then Embperl opens files under Execute and use
>> PerlIO layer with this layer.
>>
>> Certainly, i can read files myself and use 'input' option but i want to use
>> benefits of caching of Embperl. If i use files through Embperl as i think the
>> Embperl controls modification times of files and caches theirs.
>>
>> Perlover
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
>> For additional commands, e-mail: embperl-help@perl.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: Input files in Execute and PerlIO layers for theirs + object_base option doesn't work [ In reply to ]
Hi,
>
> > unfortunately implementing this Perlio UTF8 stuff is not done very quickly.
>
> UTF8 doesn't work quickly in Perl? What problem to add new option like
> 'binmode' (binmode => ":utf8") and use this binmode for reading all files by
> Embperl?
>

In done in C, not in Perl, so it's not so easy like in pure Perl

> I can use mtime but if i use Embperl::Object i should trace myself not only
> mtime of main file but everything under this - base.epl mtime too for
> example It's very not quickly, i think UTF8 file decoding could quickly in many
> times :)
>

I understand this, but I don't have time to spend a day implementing utf8 support yet (it will come if I need it for my own projects or if somebody pays for it or if somebody sends a patch)

> Ok, i resolved problem already by using Template::Toolkit (he caches a files
> but works slowly), sorry
>

Embperl is faster because it written in C, Template Toolkit can easier handle UTF-8 because it written only in Perl

You cannot have it all :-)

Gerald


> P.S. Embperl i used many years before. But i need now in UTF-8 encoding in
> files.
>
> Best regards, Perlover
>
> 2012/10/3 <richter@ecos.de>:
> > Hi,
> >
> > unfortunately implementing this Perlio UTF8 stuff is not done very quickly.
> >
> > I will put on the TODO list, but don't expect a quick solution.
> >
> > You can use the input option and read you the files on your own, just pass
> the mtime of the file as mtime option and Embperl will cache your files the
> same way if it has read the file on it's own.
> >
> > Hope this helps
> >
> > Gerald
> >
> >
> >> -----Original Message-----
> >> From: Perlover [mailto:perlover@gmail.com]
> >> Sent: Wednesday, September 26, 2012 12:18 PM
> >> To: embperl@perl.apache.org
> >> Subject: Input files in Execute and PerlIO layers for theirs +
> >> object_base option doesn't work
> >>
> >> Dear Gerald,
> >>
> >> I have some problems with Embperl 2.4.0 (perl v.5.14.2) First, i use
> >> Embperl in my own environment (no mod_perl, apache, fcgi and etc).
> >> Only process under Starman server
> >>
> >> I want to use Embperl as:
> >>
> >> my $out;
> >>
> >> Embperl::Object::Execute({
> >> inputfile => "/foo/dir/test.epl",
> >> object_base => 'base.epl',
> >> object_stopdir => "/foo/dir",
> >> output => \$out
> >> })
> >>
> >> I have some problems:
> >>
> >> 1) (BUG?) Embperl::Object doesn't see base.epl file.
> >> I have /foo/dir/base.epl in directory!
> >> I see in Starman's logs error as:
> >>
> >> [1738]ERR: 404: : Not found '_base.epl', searched:
> >>
> >> If i rename base.epl to _base.epl them my template works BUT:
> >>
> >> 2) (HELP) Other problem. I use everywhere UTF-8 encoding. My scripts
> >> have "use utf8" and in UTF-8 encoding, files are in UTF-8 But i see
> >> that $out in my example doesn't have utf8 flag.
> >> I think it's because Embperl open file (inputfile) without ":utf8"
> >> layer. And it reads this file as plain binary file.
> >> If i will use "params" with utf8 perl variables i think i will have a hell.
> >>
> >> You write in documentation that Embperl works with UTF-8. Yes, may be
> >> it keeps utf8 flag in variables, in outputs but i think Embperl
> >> doesn't work correctly with input files.
> >> Am i right?
> >>
> >> As workaround i see simple option: inputfile_binmode in Execute
> >> function for example. If Embperl will have this option i will happy
> >> as i think! For
> >> example: if i use this option then Embperl opens files under Execute
> >> and use PerlIO layer with this layer.
> >>
> >> Certainly, i can read files myself and use 'input' option but i want
> >> to use benefits of caching of Embperl. If i use files through Embperl
> >> as i think the Embperl controls modification times of files and caches
> theirs.
> >>
> >> Perlover
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> >> For additional commands, e-mail: embperl-help@perl.apache.org
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org