[28361] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9725 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 14:05:44 2006

Date: Thu, 14 Sep 2006 11:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 14 Sep 2006     Volume: 10 Number: 9725

Today's topics:
    Re: Boolean Regexp with perlre <caoimhinocrosbai_at@yahoo.com>
    Re: Boolean Regexp with perlre <caoimhinocrosbai_at@yahoo.com>
    Re: Boolean Regexp with perlre <caoimhinocrosbai_at@yahoo.com>
    Re: Boolean Regexp with perlre <caoimhinocrosbai_at@yahoo.com>
    Re: Boolean Regexp with perlre <uri@stemsystems.com>
    Re: Boolean Regexp with perlre <tadmc@augustmail.com>
        Functional Test Using WWW:Mechanize <mumebuhi@gmail.com>
    Re: How to put a single thread to sleep? <benmorrow@tiscali.co.uk>
    Re: How to put a single thread to sleep? <bik.mido@tiscalinet.it>
        How to tie Perl script with cgi <jainarunk@gmail.com>
    Re: How to tie Perl script with cgi <bik.mido@tiscalinet.it>
    Re: How to tie Perl script with cgi <noreply@gunnar.cc>
    Re: How to tie Perl script with cgi xhoster@gmail.com
    Re: How to tie Perl script with cgi <tadmc@augustmail.com>
    Re: I/O with raw disk <benmorrow@tiscali.co.uk>
    Re: log monitor <tadmc@augustmail.com>
    Re: log monitor <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: log monitor <bik.mido@tiscalinet.it>
    Re: Maximum number of sockets <angusma@attglobal.net>
        perl on windows - possible bug? lililevy@hotmail.com
    Re: print cyriilic (UTF-8) characters with PERL on HTML <peter.emmerich@cd-hotel.ch>
    Re: String buffer instead of file handle? <danparker276@yahoo.com>
    Re: String buffer instead of file handle? <nobull67@gmail.com>
    Re: String buffer instead of file handle? <danparker276@yahoo.com>
    Re: username passwd expect <john@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 14 Sep 2006 17:05:07 +0200
From: Kevin Crosbie <caoimhinocrosbai_at@yahoo.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <45096e9c$0$19195$88260bb3@news.teranews.com>

A. Sinan Unur wrote:
> It all depends on what you mean perlre. If you referring to regular 
> expressions as implemented in Perl, then it is the right group. However, 
> if somehow you are referring to some library that implements a regular 
> expression facility similar to Perl's, it is probably not.
> 
> Sinan

You are correct, I'm not actually using perlre.
The library in question is OROMatcher, which claims to implement Regular
Expressions "exactly" as outlined in perlre/Perl5.   It also claims to
support Perl5 extended regular expressions fully.

I have no idea of the credibility of the claim, but it seems likely that
advice for perlre should be the same if not quite close to what I'm
looking for.

I've actually since read that OROMatcher was made opensource for Apache,
but I still think this group is more appropriate.

I've worked with Regular Expressions in the past with various different
languages.   I always find that I need to spend lots of time digging
right back into them to solve the problem I'm tackling.   Hence I posted
here first just to make sure I wasn't going down the wrong path before
investing time.

'Some people, when confronted with a problem, think “I know, I’ll use
regular expressions.” Now they have two problems.' —Jamie Zawinski

The advice/suggestions/critiques I've gotten so far have been great!
They've gone beyond what I had hoped for.   I'm quite impressed with how
helpful the c.l.perl.misc group is.

Many Thanks to all,

Kevin


------------------------------

Date: Thu, 14 Sep 2006 17:36:50 +0200
From: Kevin Crosbie <caoimhinocrosbai_at@yahoo.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <45097603$0$19158$88260bb3@news.teranews.com>

jl_post@hotmail.com wrote:
> Kevin Crosbie wrote:
> 
>    Um, I don't think the "[,$]" is doing what you think it should be
> doing (in fact, I don't think that'll even compile).  What you should
> use in its place is "(,|$)".
> 

Can't you define a character class consisting of , and endline using
[,$]?   I'm probably confused though.   It's been a while since I've
used Regular Expressions.

>    However, it's likely that your 'c' term won't be one character long.
>  In that case, you'll probably want to use a "negative look-ahead"
> assertion (again, look it up in "perldoc perlre" if you want to read
> details about it -- this is one of extended regular expressions I
> mentioned earlier).  That way we would have:
> 
>       m/^((?!c).)*(a|b)((?!c).)*$/

I had played around with this but couldn't get it to do what I wanted.
 Thanks for the example.

> 
>    That's pretty much it.  Are the expressions messy?  Most people
> would say yes, so you might want to seriously consider breaking out
> each of the above regular expressions into more than one, if only for
> readability's sake.
> 

I imagined the solution for this using a single regular expression would
be messy.   Timing is an issue and I'm calling out to an external API to
perform the regular expressions.   I imagine using negative look-ahead
means you must make at least one full pass on your input, but I think
this is a lot less overhead than making multiple calls to an external
API.   My input is never longer than 4000 characters.

>    Another tip:  Whenever you use a complicated regular expression,
> consider putting a comment right above it that clearly states what it's
> searching for.  For example, you might write your code to look like:
> 
>       # Look for (a OR b) AND NOT (c OR d):
>       if ($string =~ m/^((?!c|d).)*(a|b)((?!c|d).)*$/)
> 
> This will make your code easier to understand and to debug.  Without
> the comment, any maintainer that comes after you will have a puzzle to
> solve in order to figure out what you really meant.  And if for some
> reason you (or a future maintainer) introduced a bug in your regular
> expression, the comment can serve as a guide to determine whether or
> not a bug actually exists in the regular expression (otherwise, it
> would be difficult to know for sure).
> 

Good advice.   I agree, just trying to construct the correct expression
seems quite tricky.   I wouldn't like to have anybody try to reverse
engineer this kind of stuff just to find out what it does.

>    I hope this helps, Kevin.

Many Thanks.


------------------------------

Date: Thu, 14 Sep 2006 17:37:06 +0200
From: Kevin Crosbie <caoimhinocrosbai_at@yahoo.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <45097615$0$19158$88260bb3@news.teranews.com>

Xicheng Jia wrote:

> Assumed your a,b,c,d are strings instead of chars, otherwise change
> (a|b) to  [ab]. you may also want to change (a|b) to (?:a|b) for
> efficiency. do the similar thing to (c|d).
> 
> Regards,
> Xicheng
> 

Thanks Xicheng


------------------------------

Date: Thu, 14 Sep 2006 17:41:38 +0200
From: Kevin Crosbie <caoimhinocrosbai_at@yahoo.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <45097725$0$19244$88260bb3@news.teranews.com>

Brian McCauley wrote:
> But REs are really the wrong tool for the job.  If this were a real
> Perl question I'd say change your API to take a CODE ref rather than a
> regex.
> 

Hi Brian,

Thanks for the reply.   If by CODE ref you mean a function pointer, then
you could be right, the problem I have might result in more
readable/maintainable/extendible code were I to pass a function.   But
then I'd write it in Lisp ;)

In this case I don't have that option though.

Kevin


------------------------------

Date: Thu, 14 Sep 2006 13:18:52 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <x7mz925ptv.fsf@mail.sysarch.com>

>>>>> "KC" == Kevin Crosbie <caoimhinocrosbai_at@yahoo.com> writes:

  KC> You are correct, I'm not actually using perlre.  The library in
  KC> question is OROMatcher, which claims to implement Regular
  KC> Expressions "exactly" as outlined in perlre/Perl5.  It also claims
  KC> to support Perl5 extended regular expressions fully.

then they are lying like all perl regex emulators. perl has the ability
to use perl code inside a regex. hard to emulate that without having
perl inside. 

and i always love how every other lang slams perl and always claims perl
compatible regexes. wait until they try to get perl6 grammars emulation
working. but since the PGE will be written in parrot which you can
embed, maybe they will actually do it right. but again, PGE allows perl
code inside so that will again stifle full emulation. too bad.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Thu, 14 Sep 2006 11:28:20 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <slrnegj0p4.7k9.tadmc@magna.augustmail.com>

Kevin Crosbie <caoimhinocrosbai_at@yahoo.com> wrote:
> jl_post@hotmail.com wrote:
>> Kevin Crosbie wrote:
>> 
>>    Um, I don't think the "[,$]" is doing what you think it should be
>> doing (in fact, I don't think that'll even compile).  What you should
>> use in its place is "(,|$)".
>> 
> 
> Can't you define a character class consisting of , and endline using
                                                   ^^^^^^^^^^^^^

s/endline/endstring/


> [,$]?


No, you cannot.

A character class matches exactly one character.

An anchor matches a _position_ (ie. zero characters).

In Perl, it is further complicated in that

   [,$]

is not a character class because $] is a variable, there is
no closing ] for that "class".


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 14 Sep 2006 09:20:15 -0700
From: "mumebuhi" <mumebuhi@gmail.com>
Subject: Functional Test Using WWW:Mechanize
Message-Id: <1158250815.193644.270450@d34g2000cwd.googlegroups.com>

I am trying to _design_ an automated test suite for web functional test
using WWW::Mechanize. I am not sure whether to design it more OO or
procedural.

Consider this simple scenarios. I need to automate the following two
use cases.
1. Login -> Enter Form A and submit -> Logout
2. Login -> Click Link B -> Enter Form B and submit -> Logout
>From these two simple use cases, there are two "identical" actions:
Login and Logout.

If we create use case 1 in one (Perl) script and use case #2 in another
script (more procedural), then we will have unnecessary redundancy. As
we all realize, this type of redundancy might lead to maintenance
problem when the test suite grows larger.

Does anybody have comments for a more OO approach? Any open-source
projects that is parallel to this?

Thank you.


Buhi



------------------------------

Date: Thu, 14 Sep 2006 14:03:47 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: How to put a single thread to sleep?
Message-Id: <ji0ot3-mee.ln1@osiris.mauzo.dyndns.org>


Quoth "A. Sinan Unur" <1usa@llenroc.ude.invalid>:
> Michele Dondi <bik.mido@tiscalinet.it> wrote in 
> news:olsgg2dr28i47dsknkup1ed4nf6ohto35u@4ax.com:
> 
> > And your .sig takes more than four lines, which many people consider
> > impolite and contrary to netiquette...
> >:-P
> 
> It is a single solitary newline in-between two blocks. It really does 
> not affect bandwidth consumed (it is still less than the 320 bytes taken 
> up by a 4 line 80 column sig). After all, the reason for the custom is 
> to reduce the amount of bandwidth dedicated to vanity. Half of my sig is 
> my email address, the other half is a link to the posting guidelines.

The reason for the restriction is not just (or even mainly) because of
bandwidth, it is also to limit screen-estate use on 80x25 terminals,
which some of us still use.

Ben

-- 
And if you wanna make sense / Whatcha looking at me for?          (Fiona Apple)
                       * benmorrow@tiscali.co.uk *


------------------------------

Date: 14 Sep 2006 18:19:11 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to put a single thread to sleep?
Message-Id: <o70jg2pd3ls9u9sdodqq10sj7e5s6feqi2@4ax.com>

On Thu, 14 Sep 2006 14:03:47 +0100, Ben Morrow
<benmorrow@tiscali.co.uk> wrote:

>> > And your .sig takes more than four lines, which many people consider
>> > impolite and contrary to netiquette...
>> >:-P
>> 
>> It is a single solitary newline in-between two blocks. It really does 
>> not affect bandwidth consumed (it is still less than the 320 bytes taken 
>> up by a 4 line 80 column sig). After all, the reason for the custom is 
>> to reduce the amount of bandwidth dedicated to vanity. Half of my sig is 
>> my email address, the other half is a link to the posting guidelines.
>
>The reason for the restriction is not just (or even mainly) because of
>bandwidth, it is also to limit screen-estate use on 80x25 terminals,
>which some of us still use.

Hey, wasn't it clear that I was mainly joking? :-)


Michele
-- 
Se, nella notte in cui concepi' il duce,
Donna Rosa, toccata da divina luce,
avesse dato al fabbro predappiano
invece della fica il deretano,
l'avrebbe presa in culo quella sera
Rosa sola e non l'Italia intera.
- Poesia antifascista


------------------------------

Date: 14 Sep 2006 09:00:12 -0700
From: "Vinay Nagrik" <jainarunk@gmail.com>
Subject: How to tie Perl script with cgi
Message-Id: <1158249612.084165.181650@i3g2000cwc.googlegroups.com>

Hello group,

I am just introduced to Perl and written my first program.  I need to
fire it through a cgi script.

Could someone tell me how to tie two programs together so that when I
send a post request through uri, my script gets fired.

Thanks in advance.

nagrik



------------------------------

Date: 14 Sep 2006 18:31:31 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to tie Perl script with cgi
Message-Id: <8u0jg25sqek8cnhsl7hsn7hb208kr1gqpq@4ax.com>

On 14 Sep 2006 09:00:12 -0700, "Vinay Nagrik" <jainarunk@gmail.com>
wrote:

>Could someone tell me how to tie two programs together so that when I
>send a post request through uri, my script gets fired.

Ask in some webserver configuration group. This one is for discussing
Perl, not applications that incidentally happen to be written in Perl.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Thu, 14 Sep 2006 18:34:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to tie Perl script with cgi
Message-Id: <4mteopF7qd12U1@individual.net>

Vinay Nagrik wrote:
> I am just introduced to Perl and written my first program.  I need to
> fire it through a cgi script.
> 
> Could someone tell me how to tie two programs together so that when I
> send a post request through uri, my script gets fired.

It sounds to me as if you'd better study a CGI tutorial. 
http://www.cgi.resourceindex.com/Documentation/CGI_Tutorials/

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: 14 Sep 2006 16:41:19 GMT
From: xhoster@gmail.com
Subject: Re: How to tie Perl script with cgi
Message-Id: <20060914124217.616$r3@newsreader.com>

"Vinay Nagrik" <jainarunk@gmail.com> wrote:
> Hello group,
>
> I am just introduced to Perl and written my first program.  I need to
> fire it through a cgi script.

This is mainly depended on the caller, not the callee.  So you should
figure how to call external programs in whatever language your cgi script
is written in.

> Could someone tell me how to tie two programs together so that when I
> send a post request through uri, my script gets fired.

If your cgi script is *also* written in perl, then you should probably
turn your existing non-cgi script into a module (perldoc perlmod) and then
incorporate it into the cgi-script that way, rather than starting up
yet another perl run-time.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Thu, 14 Sep 2006 11:36:29 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to tie Perl script with cgi
Message-Id: <slrnegj18d.7k9.tadmc@magna.augustmail.com>

Vinay Nagrik <jainarunk@gmail.com> wrote:

> Subject: How to tie Perl script with cgi


[  "tie" has a special meaning in Perl and it is not the meaning
   that I think you had in mind. See:

   perldoc -f tie

   perldoc perltie
]


> I am just introduced to Perl and written my first program.  I need to
> fire it through a cgi script.
> 
> Could someone tell me how to tie two programs together so that when I
> send a post request through uri, my script gets fired.


I think you are asking how to run an external program from within Perl.

The fact that the external program is written in Perl is not relevant.

The fact that the calling program is running in a CGI environment is
also not relevant.


You run external programs from within Perl using one of:

   perldoc -f system

   perldoc -f qx

   perldoc -f open


See also:

   perldoc -q STDERR

       How can I capture STDERR from an external command?

       There are three basic ways of running external commands:

       ...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 14 Sep 2006 14:00:00 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: I/O with raw disk
Message-Id: <gb0ot3-mee.ln1@osiris.mauzo.dyndns.org>


Quoth dcruncher4@aim.com:
> How can I open a raw disk file and write to it. I have to write a
> program which will
> write few gigs of data to both raw disk and a cooked file to compare
> the write
> performance.

Do you mean read(2)/write(2) vs. fread(3)/fwrite(3)? read(2) and
write(2) are called sysread and syswrite in Perl. See their entries in
perlfunc. You can specify that all IO to a file should use these
syscalls directly by using the :unix PerlIO layer (yes, :unix on all
platforms currently): see PerlIO for a start.

If this is not what you mean you will have to clarify.

Ben

-- 
#!/bin/sh
quine="echo 'eval \$quine' >> \$0; echo quined"
eval $quine
#                                                 [benmorrow@tiscali.co.uk]


------------------------------

Date: Thu, 14 Sep 2006 09:56:18 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: log monitor
Message-Id: <slrnegirci.76b.tadmc@magna.augustmail.com>


[ Please do not top-post! ]


yuetwah2000@hotmail.com <yuetwah2000@hotmail.com> wrote:
>> yuetwah2000@hotmail.com <yuetwah2000@hotmail.com> wrote:
>>
>> > I wanna write a simple perl cgi script 
     ^       ^^^^^
     ^       ^^^^^

> I want to find some source code that does that already,
  ^         ^^^^
  ^         ^^^^


That isn't what you asked for the first time.



You have made 2 posts here so far, both of them asking a FAQ.

Consider not doing that anymore.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 14 Sep 2006 16:00:34 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: log monitor
Message-Id: <C0fOg.11981$xQ1.7935@newsread3.news.pas.earthlink.net>

On 09/14/2006 09:04 AM, yuetwah2000@hotmail.com wrote:
> Hi,
> I wanna write a simple perl cgi script that will imitate the behavior 
> of `tail -f` in unix, log entries are appended at the bottom of the 
> file, I want to create a page that will automatically scroll down. Can 
> you shed some light?
> Rgds,
> 

perldoc -q tail



------------------------------

Date: 14 Sep 2006 18:27:34 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: log monitor
Message-Id: <il0jg2dj0fesmufcd4jsum17bd814vtktt@4ax.com>

On 14 Sep 2006 07:32:39 -0700, yuetwah2000@hotmail.com wrote:

>I want to find some source code that does that already, something like
>/hostname/cgi-bin/tail-f?/tmp/log
>
>Tad McClellan wrote:
[snip full quoted text]

I only have
/hostname/cgi-bin/do-not-top-post?/never/ever
/hostname/cgi-bin/not-an-helpdesk?/clpmisc


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Thu, 14 Sep 2006 11:59:36 -0400
From: "A Ma" <angusma@attglobal.net>
Subject: Re: Maximum number of sockets
Message-Id: <45097c6b@kcnews01>


"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message 
news:45089738$0$5110$afc38c87@news.optusnet.com.au...
>
>
> To get it to build, the exact change I made was to replace:
>
>   w32_pseudo_child_message_hwnds[w32_num_pseudo_children] =
>        (w32_message_hwnd == NULL) ? NULL : INVALID_HANDLE_VALUE;
>
> with:
>
>    if  (w32_message_hwnd == NULL)
> w32_pseudo_child_message_hwnds[w32_num_pseudo_children] = NULL;
>    else w32_pseudo_child_message_hwnds[w32_num_pseudo_children] =
> (HWND__*)INVALID_HANDLE_VALUE;
>

I made the change and was able to build a new version of Perl. However, the 
change of PERL_FD_SETSIZE in socket.h didn't seem to make any difference. I 
wonder if the Windows operating system imposes its own limit on the number 
of sockets that can be opened by one program. In any case, I'll keep looking 
into it but thanks for all your help, 




------------------------------

Date: 14 Sep 2006 08:21:06 -0700
From: lililevy@hotmail.com
Subject: perl on windows - possible bug?
Message-Id: <1158247266.145511.216690@m73g2000cwd.googlegroups.com>

Hello,

I'm using perl58.dll (version 5.8.4, build 810) in a c++ application
with several threads that runs on win2000SP4.
Every thread creates a perl interpreter that runs a perl script from an
arbitrary file.
After a while I'm experiencing a deadlock.
I can see that I have a thread that is stack in the function
_alloc_osfhnd (Microsoft function from the msvcrt.dll that is called
from the _open function).

I found this link http://bugs.mysql.com/bug.php?id=12071 that describes
a Microsoft bug in _alloc_osfhnd that might cause this deadlock.

I can also see that in the perl source win32.c there's an
implementation to the function _alloc_osfhnd with the following
description, but I'm not sure it has something to do with my problem.

/*
 * we fake up some parts of the CRT that aren't exported by MSVCRT.dll
 * this lets sockets work on Win9X with GCC and should fix the problems
 * with perl95.exe
 *	-- BKS, 1-23-2000
*/

Has anyone experienced this problem before?
Is it really a Microsoft bug that affects perl?
Can another version of perl solve the problem?
Can another version of OS solve the problem?

Thanks in advance, 
Lily.



------------------------------

Date: 14 Sep 2006 09:05:29 -0700
From: "peter_emmerich" <peter.emmerich@cd-hotel.ch>
Subject: Re: print cyriilic (UTF-8) characters with PERL on HTML page
Message-Id: <1158249929.090691.232590@i42g2000cwa.googlegroups.com>

Hi Andi,

assuming you are working with a script running on a webserver (you
mentioned print qq(Content-type: text/html;.....)) here is the perl
code you need at least to print unicode/utf-8 with a script:

#!/usr/bin/perl -w
use CGI;
$my_string =3D qq(=C3=A4 =C3=B6 =C3=BC =C3=A0 =C3=A9 =C3=A8 =C3=84 =C3=96 =
=C3=9C =D0=96 =D0=B6 =D0=97 =D0=B7 =D0=98 =D0=B8 =D0=99 =D0=B9);
print qq(Content-type: text/html; charset=3Dutf-8\n\n
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV=3D"CONTENT-TYPE" content=3D"text/html; charset=3Dutf-8">
<title>UTF-8 Testpage</title>
</head>
<body>
$my_string
</body>
</html>
);

Create the file with Windows Notepad or Notepad++ or another Unicode
capable editor in UTF-8 format, otherwise it will not work!

Best regards
PE

andipfaff schrieb:

> Hi there,
>
> beginners question: I have written a small website with a PERL script
> which can be viewed in 4 western european languages. Each text to be
> displayed is stored in arrays like
> $text1[1] =3D qq(Hallo);
> $text1[2] =3D qq(Salut);
> $text1[3] =3D qq(Saluti);
> $text1[4] =3D qq(Hello);
> and printed to STDOUT. Now I want to extend this with cyrillic
> characters (5th language: russian). Unfortunately I have no idea how to
> do that. I simply tried to cut&paste cyrillic letters from websites
> like wikipedia cyrillic aplphabet, but in my Editor (DZSoft) I just get
> a question mark when pasting. In Notepad pasting is OK, because he is
> capable of UTF-8. DZSoft does not seem to be.
>
> What are the minimum requirements to print a cyrillic character with
> PERL into a website? I am working with Windows 2k english or german,
> IIS 5 on a W2k Server, ActiveState PERL, and a MySQL database.
>
> The PERL script is using CGI, but HTML code is written directly:
> print qq(Content-type: text/html\n\n
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html>
> <head> etc.
>
> Does anybody can give me a simple script which I can test with Notepad
> as en editor?
>=20
> Thanks in advance
> Andi Pfaff



------------------------------

Date: 14 Sep 2006 10:34:16 -0700
From: "danparker276@yahoo.com" <danparker276@yahoo.com>
Subject: Re: String buffer instead of file handle?
Message-Id: <1158255256.344247.40390@b28g2000cwb.googlegroups.com>


I just changed to module to use a string instead of a file handle and
it works fine (oh man I rule, can you say genius!!).  I'm not gonna
upgrade to 5.8 and risk other stuff not working.

being a .net programmer puts me on a higher evolutionary scale, and I
get more chicks that way.


Michele Dondi wrote:
> On 13 Sep 2006 15:31:58 -0700, "danparker276@yahoo.com"
> <danparker276@yahoo.com> wrote:
>
> >" open($fh, '>', \$variable)"  This would work perfect, just not the
> >right version of perl.
>
> This *should* work perfectly. But *you* say it didn't. And in a way
> that clearly shows that your perl does not support thay feature. Thus
> your perl must be considerably old and I recommend you to follow the
> good piece of advice you've been given: i.e. upgrade it.
>
> >And your quote:
> >"> Did you do that?
> >>
> >> (obviously not...)"
> >
> >Makes me want to punch you in the face.  Why do you have to be such a
> >smart a**?
> >I guess with a name like Tad, you're used to being picked on.
>
> Such an attitude as yours makes me *possibly* want to punch one in the
> face. Both for your refusal of listening to good suggestions after
> having asked for help and for bringing a personal attack -albeit a
> very weak one, due to its stupidity- as means to support your "point".
>
> >Why does everyone have to always say "read the docs".  This is
>
> Because some people tries very hard to keep the docs up to date and
> rich and helpful, maybe? Because it is the best way to teach one how
> to find quickly help without bothering people with questions that do
> not really deserve being asked?
>
> >something simple I thought someone knew off the top of their head.
> >Maybe I don't have to use the open function.
>
> In fact someone knew. Most of us do. The answer is
>
>   open my $fh, '>', \$buffer or die "horribly: $!\n";
>
> That's the first answer you got. And since it is now a standard open()
> feature you've been pointed to its documentation as well. Of course
> you were not strictly required to check it soon, but you definitely
> should have, upon verifying that the ready made solution above didn't
> work. You would have realized that the feature we pointed you to
> appears not to be documented on your system. Thus you could have
> realized that your system is outdated too. Then it could have been
> fair to ask "how do I do it with an outdated perl?" if you *really* do
> not want to update, which remains the best thing to do in any case...
>
> >Oh yeah, and I top-posted on purpose.  Everyone on this group is so
>
> Oh! Very kind of you to make communication more difficult for everyone
> here (but possibly you), for no real good reason. You will be
> *PLONKED* on purpose.
>
> Ignorance one can cope with, stupidity one can cope with. Arrogance is
> just a little bit too much for me and for quite about of others here.
> With this attitude you will be left alone with the "expertise" of
> those who "will answer questions"...
>
> >stuck up.  .NET 2.0 blows everything away anyway.  At least on their
> >formus, people from microsoft will answer questions instead of "Look at
> >the docs"
>
> And who gives a fuck?!? Should this increase my consideration about
> them? Should this decrease that of one of the most resourceful and
> helpful newsgroups I've ever been in, namely this one?
>
> "Give a man a fish, he'll live for a day. Teach him how to fish, he'll
> tell you that he has no time to play with lines and hooks."
>
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,



------------------------------

Date: 14 Sep 2006 10:56:21 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: String buffer instead of file handle?
Message-Id: <1158256581.694662.182650@h48g2000cwc.googlegroups.com>

Michele Dondi wrote:

> On 13 Sep 2006 15:31:58 -0700, "danparker276@yahoo.com"
> <danparker276@yahoo.com> wrote:
>
> >Why does everyone have to always say "read the docs".  This is
>
> Because some people tries very hard to keep the docs up to date and
> rich and helpful, maybe? Because it is the best way to teach one how
> to find quickly help without bothering people with questions that do
> not really deserve being asked?

That's only part of it. There's also the fact that to an experienced
programmer just looking at an inappropriate denormalization is painful.
Retyping information that's covered in the standard docs is a
denomalization.  So even if it weren't for the fact that it's more
effort for the person answering and less help to the person asking I'd
still be uncomfortable retyping.



------------------------------

Date: 14 Sep 2006 11:03:01 -0700
From: "danparker276@yahoo.com" <danparker276@yahoo.com>
Subject: Re: String buffer instead of file handle?
Message-Id: <1158256981.827674.284670@e3g2000cwe.googlegroups.com>


Brian McCauley wrote:
> Michele Dondi wrote:
>
> > On 13 Sep 2006 15:31:58 -0700, "danparker276@yahoo.com"
> > <danparker276@yahoo.com> wrote:
> >
> > >Why does everyone have to always say "read the docs".  This is
> >
> > Because some people tries very hard to keep the docs up to date and
> > rich and helpful, maybe? Because it is the best way to teach one how
> > to find quickly help without bothering people with questions that do
> > not really deserve being asked?
>
> That's only part of it. There's also the fact that to an experienced
> programmer just looking at an inappropriate denormalization is painful.
> Retyping information that's covered in the standard docs is a
> denomalization.  So even if it weren't for the fact that it's more
> effort for the person answering and less help to the person asking I'd
> still be uncomfortable retyping.

So if your friend asked you what's on TV tonight (and you know you were
watching Prison Break), you'd tell him "Look it up in the TV guide".
It's called being nice.

Look at me, I got over 9000 MySpace friends!!!!  I'm a stud.



------------------------------

Date: 14 Sep 2006 16:28:33 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: username passwd expect
Message-Id: <Xns983E74BA86C58castleamber@130.133.1.4>

"Dr.Ruud" <rvtol+news@isolution.nl> wrote:

> john   f5q*d&7d

Thanks, now I have to change my password :-(

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9725
***************************************


home help back first fref pref prev next nref lref last post