[28075] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9439 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 9 09:05:42 2006

Date: Sun, 9 Jul 2006 06:05:04 -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           Sun, 9 Jul 2006     Volume: 10 Number: 9439

Today's topics:
        =?iso-8859-1?B?RW5jb2Rpbmcgb2YgdGhlIHBlcmwgb3V0cHV0ICjD <tomlobato@gmail.com>
        =?iso-8859-1?B?UmU6IEVuY29kaW5nIG9mIHRoZSBwZXJsIG91dHB1 <primzahl@gmail.com>
    Re: converting line input into columns <someone@example.com>
    Re: Encoding of the perl output =?iso-8859-1?Q?=28=C3=A <sherm@Sherm-Pendleys-Computer.local>
    Re: FAQ 3.20 How can I hide the source for my Perl prog <someone@example.com>
    Re: FAQ 3.20 How can I hide the source for my Perl prog <brian.d.foy@gmail.com>
    Re: How to force formatted date (month) language ? <ynleder@nspark.org>
    Re: How to force formatted date (month) language ? <ynleder@nspark.org>
    Re: Need help to find byte offsets for regexps in a fil <xicheng@gmail.com>
    Re: Need help to find byte offsets for regexps in a fil <tadmc@augustmail.com>
        new CPAN modules on Sun Jul  9 2006 (Randal Schwartz)
        Perl + Emacs <ksamp@vp_removeit_.pl>
    Re: Perl + Emacs <1usa@llenroc.ude.invalid>
    Re: Profanity checking, phonetically. axel@white-eagle.invalid.uk
    Re: Profanity checking, phonetically. <john@castleamber.com>
    Re: Profanity checking, phonetically. <sherm@Sherm-Pendleys-Computer.local>
        Stupid Q: Read complete file into variable or string <franzl.wisseworst@mailinator.net>
    Re: Stupid Q: Read complete file into variable or strin <ksamp@vp.pl>
    Re: Stupid Q: Read complete file into variable or strin <1usa@llenroc.ude.invalid>
    Re: Stupid Q: Read complete file into variable or strin <bg1act@yahoo.com.au>
    Re: Stupid Q: Read complete file into variable or strin <franzl.wisseworst@mailinator.net>
    Re: Stupid Q: Read complete file into variable or strin <franzl.wisseworst@mailinator.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 8 Jul 2006 15:07:06 -0700
From: "Tom" <tomlobato@gmail.com>
Subject: =?iso-8859-1?B?RW5jb2Rpbmcgb2YgdGhlIHBlcmwgb3V0cHV0ICjDoSDDqSDDrSDDsyk=?=
Message-Id: <1152396426.849429.24570@p79g2000cwp.googlegroups.com>

Hi,

My perl scripts is generating strange output of the characters when it
is opened by Browsers (mozilla, IE).

#!/usr/bin/perl
print "a e i o u =E1 =E9 =ED =F3 u =E2 =EE =F4 =FB";

The below code outputs the rigth string to the console (or files if I
open with editors), but if I put it (with open FILE,output.html...) in
html file and open with a browser, look the result:
a  e  i  o  u  =C3=A1 =C3=A9 =C3=AD =C3=B3 u =C3=A2 =C3=AE =C3=B4 =C3=BB

the generated file is of the type 'UTF-8 Unicode English text, with
very long lines', as says "file" command on linux.

Any hint about the solution?


Information about my system:
System Linux Ubuntu 6.06
perl, v5.8.7 built for i486-linux-gnu-thread-multi
/etc/environment sets:
LANG=3D"pt_BR.UTF-8"
LANGUAGE=3D"pt_BR:pt:pt_PT"




Thank you
Tom



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

Date: 9 Jul 2006 04:31:36 -0700
From: "Reto" <primzahl@gmail.com>
Subject: =?iso-8859-1?B?UmU6IEVuY29kaW5nIG9mIHRoZSBwZXJsIG91dHB1dCAow6Egw6kgw60gw7Mp?=
Message-Id: <1152444696.027975.289490@35g2000cwc.googlegroups.com>

Hi Tom,

a few points to consider...

1) You should be awared of what kind of character encoding your
   *Webserver* is using. If you're running Apache checkout for this key
   in your httpd.conf:

   AddDefaultCharset UTF-8

   A quick note this might be overruled on the HTML level within the
   header section (see also point 2):

   <meta http-equiv=3D"Content-Type"
              content=3D"text/html; charset=3Diso-8859-1">   or

   <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">


2) You could tell via Perl to wrap the UTF encoding information within
   the HTTP header by adding the carset:

   print $q->header('text/html; charset=3DUTF-8');


3) For the most secure way I suggest to keep your server settings on
   UTF encoding and transform your output to a web encoded format,
   See an example on this page:

   http://www.infocopter.com/perl/web-encoding-decoding.html

--Reto


Tom wrote:
> Hi,
>
> My perl scripts is generating strange output of the characters when it
> is opened by Browsers (mozilla, IE).
>
> #!/usr/bin/perl
> print "a e i o u =E1 =E9 =ED =F3 u =E2 =EE =F4 =FB";
>
> The below code outputs the rigth string to the console (or files if I
> open with editors), but if I put it (with open FILE,output.html...) in
> html file and open with a browser, look the result:
> a  e  i  o  u  =C3=A1 =C3=A9 =C3=AD =C3=B3 u =C3=A2 =C3=AE =C3=B4 =C3=BB
>
> the generated file is of the type 'UTF-8 Unicode English text, with
> very long lines', as says "file" command on linux.



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

Date: Sun, 09 Jul 2006 00:51:53 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: converting line input into columns
Message-Id: <JqYrg.134091$771.21451@edtnps89>

vanagas99@yahoo.com wrote:
> 
> I have a file with formatted output like this:
> 
> Severity: Important
> Status: Unknown
> PDI ID: 1895
> Finding Details
>        This vulnerability... blah, blah, blah
> Vulnerability Discussion
>           blah, blah, blah text
> Fix recommendations
>       blah, blah, blah text
> 
> Please advice on how to parse such a file allowing me to put it in a
> column type format. As you can see, can't use : as a separator since
> not all categories have it. Plus, some of the details of these
> categories are plopped in a separate line instead off next to it. Best
> way would probably be to put all of it in one tab seberated line
> (cleaning out severity, status, etc. later) I just dont know how to do
> that. Please advice.,

#!/usr/bin/perl
use warnings;
use strict;

my @data;
while ( <DATA> ) {
    if ( /:\s*(.+)/ ) {
        push @data, $1;
        }
    else {
        s/\s+$//, s/^\s+// for my $next = <DATA>;
        push @data, $next;
        }
    }
print join( "\t", @data ), "\n";

__DATA__
Severity: Important
Status: Unknown
PDI ID: 1895
Finding Details
       This vulnerability... blah, blah, blah
Vulnerability Discussion
          blah, blah, blah text
Fix recommendations
      blah, blah, blah text




John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 08 Jul 2006 18:40:41 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: Encoding of the perl output =?iso-8859-1?Q?=28=C3=A1_=C3=A9?= =?iso-8859-1?Q?_=C3=AD_=C3=B3=29?=
Message-Id: <m2ejwvn2ja.fsf@Sherm-Pendleys-Computer.local>

"Tom" <tomlobato@gmail.com> writes:

> My perl scripts is generating strange output of the characters when it
> is opened by Browsers (mozilla, IE).
>
> #!/usr/bin/perl
> print "a e i o u á é í ó u â î ô û";
>
> The below code outputs the rigth string to the console (or files if I
> open with editors), but if I put it (with open FILE,output.html...) in

First off, you shouldn't simply assume that the output to FILE will be UTF-8.
Instead, use the appropriate IO layer, like this:

    open(F, ">:utf8", "data.txt") or die "Error opening data.txt: $!";

That way, if you have data that hasn't yet been converted to UTF-8 - say it's
been input from another file that used a different :encoding layer - you can
rest assured that Perl will do the conversion when F is written to.

> html file and open with a browser, look the result:
> a  e  i  o  u  á é í ó u â î ô û
>
> the generated file is of the type 'UTF-8 Unicode English text, with
> very long lines', as says "file" command on linux.
>
> Any hint about the solution?

Have you told your browser it's UTF-8? If your HTML is delivered over the
web, you'd do that with the appropriate HTTP headers. If it's loaded from
a local file, you could use a meta element in the HTML itself.

The question of what HTTP headers and/or meta element you need to use should
be directed to a more appropriate forum - likely one in the comp.infosystems.
www.* hierarchy.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sun, 09 Jul 2006 00:38:20 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: FAQ 3.20 How can I hide the source for my Perl program?
Message-Id: <0eYrg.44101$B91.40816@edtnps82>

PerlFAQ Server wrote:
> This is an excerpt from the latest version perlfaq3.pod, which
> comes with the standard Perl distribution. These postings aim to 
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
> 
> --------------------------------------------------------------------
> 
> 3.20: How can I hide the source for my Perl program?
> 
>     Delete it. :-) Seriously, there are a number of (mostly unsatisfactory)
>     solutions with varying levels of "security".
> 
>     First of all, however, you *can't* take away read permission, because
>     the source code has to be readable in order to be compiled and
>     interpreted. (That doesn't mean that a CGI script's source is readable
>     by people on the web, though--only by people with access to the
>     filesystem.) So you have to leave the permissions at the socially
>     friendly 0755 level.
> 
>     Some people regard this as a security problem. If your program does
>     insecure things and relies on people not knowing how to exploit those
>     insecurities, it is not secure. It is often possible for someone to
>     determine the insecure things and exploit them without viewing the
>     source. Security through obscurity, the name for hiding your bugs
>     instead of fixing them, is little security indeed.
> 
>     You can try using encryption via source filters (Starting from Perl 5.8
>     the Filter::Simple and Filter::Util::Call modules are included in the
>     standard distribution), but any decent programmer will be able to
>     decrypt it. You can try using the byte code compiler and interpreter
>     described below, but the curious might still be able to de-compile it.
      ^^^^^^^^^^^^^^^

>     You can try using the native-code compiler described below, but crackers
                                                 ^^^^^^^^^^^^^^^

>     might be able to disassemble it. These pose varying degrees of
>     difficulty to people wanting to get at your code, but none can
>     definitively conceal it (true of every language, not just Perl).
> 
>     It is very easy to recover the source of Perl programs. You simply feed
>     the program to the perl interpreter and use the modules in the B::
>     hierarchy. The B::Deparse module should be able to defeat most attempts
>     to hide source. Again, this is not unique to Perl.
> 
>     If you're concerned about people profiting from your code, then the
>     bottom line is that nothing but a restrictive license will give you
>     legal security. License your software and pepper it with threatening
>     statements like "This is unpublished proprietary software of XYZ Corp.
>     Your access to it does not give you permission to use it blah blah
>     blah." We are not lawyers, of course, so you should see a lawyer if you
>     want to be sure your license's wording will stand up in court.
> 
> 
> 
> --------------------------------------------------------------------
> 
> The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
> are not necessarily experts in every domain where Perl might show up,
> so please include as much information as possible and relevant in any
> corrections. The perlfaq-workers also don't have access to every
> operating system or platform, so please include relevant details for
> corrections to examples that do not work on particular platforms.
> Working code is greatly appreciated.
> 
> If you'd like to help maintain the perlfaq, see the details in 
> perlfaq.pod.

brian, it appears that this FAQ is missing a couple of descriptions.  :-)


John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 09 Jul 2006 07:37:05 -0500
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 3.20 How can I hide the source for my Perl program?
Message-Id: <090720060737055308%brian.d.foy@gmail.com>

rIn article <0eYrg.44101$B91.40816@edtnps82>, John W. Krahn
<someone@example.com> wrote:

> PerlFAQ Server wrote:

> > 3.20: How can I hide the source for my Perl program?

> brian, it appears that this FAQ is missing a couple of descriptions.  :-)

It's just stuff later in perlfaq3. I'll amend the line to make it more
clear when this answer is excerpted.

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Sun, 9 Jul 2006 12:02:26 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: How to force formatted date (month) language ?
Message-Id: <MPG.1f1af2a098586d519897c9@news.free.fr>

In article <1152386522.438934.268850@35g2000cwc.googlegroups.com>, 
DJStunks@gmail.com says...
> in this case, I would say the easiest way to get the same script to
> produce similar** results is to simply use 'english' and 'french' as
> your locale strings.
> 

It would be effectively a middle way, but, after thought I think I'll go 
to the Bart suggestion : convert numeric month to abbreviated month name 
by myself. Thanks anyway.


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

Date: Sun, 9 Jul 2006 12:05:37 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: How to force formatted date (month) language ?
Message-Id: <MPG.1f1af359378fa4529897ca@news.free.fr>

In article <1152387603.366980.217680@p79g2000cwp.googlegroups.com>, 
bart@nijlen.com says...
> A last super-safe option is to switch to the month number (like '7' in
> stead of July). And then manually code out the part to tie it to the
> actual month name/abbreviation you wish (according to the language the
> user specified on the web page). 
> 

Hmm, understood your demonstration about jui/jul ambiguousness... I'll 
take the super-sage way ;) So, just a question : do you know the 
"official" English month abbreviations ? Not found on Wikipedia as for 
French side.

Thanks, Bart


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

Date: 8 Jul 2006 15:36:28 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: Need help to find byte offsets for regexps in a file
Message-Id: <1152398188.934950.221000@75g2000cwc.googlegroups.com>

Robert Dodier wrote:
> Hello,
>
> I am hoping to find byte offsets of regular expressions in a file.
>
> I'm working on the built-in doc system for Maxima, an open-
> source computer algebra system. The doc text is a Texinfo
> output file. I want to find the strings " -- Function: FOO (x, y, z)
> ..."
> and print their byte offsets, and the number of bytes from one such
> string to the end of the corresponding documentation item
> (which might be the next " -- Function: " item or a different regex).
>
> Here is some pseudocode to illustrate what I am attempting --
>
>   let re1 = " --Function: <some name>"
>   let re2 = FOO (not sure what to put here yet)
>   slurp file into string S (this is OK, texinfo limits file to 300 k)
>   byte_offset_1 = 0
>   while seach for re1 beginning from byte_offset_1 succeeds
>     extract <some name> from re1 match
>     search for re2 beginnng from byte_offset_1
>     let byte_offset_2 = byte offset of re2 match
>     print <some name>, byte_offset_1, byte_offset_2
>     let byte_offset_1 = byte_offset_2
>
>
> I'm planning to slurp the resulting output into another program
> that will then carry out matching on the list of <some name> strings
> and use file seek to grab the corresponding texts. That program
> will be written in another programming language so let's not worry
> about that now.
>
> If anyone has some advice about making a workable Perl
> program from this pseudocode, I'll be very grateful.
> Thanks in advance & all the best.
>
> Robert Dodier

you can use *closures* and a subroutine, check another similar problem
in this group:

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/77b98239816faa8a/2c0f61ff2f39de4d?q=&rnum=14&hl=en#2c0f61ff2f39de4d

the detailed soluton should be different, but the way is quite
similar..the thing you want to change, from my understanding, is to
check the number of characters instead of number of newline before the
function-definition point, so change from tr/\n// to tr///. Also change
the $pattern and the s/// expression to suit your problem.

you might also try 'c', 'g' modifiers of m// expression and the '\G'
anchor. that might also be helpful.

Good luck,
Xicheng



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

Date: Sat, 8 Jul 2006 19:39:58 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Need help to find byte offsets for regexps in a file
Message-Id: <slrneb0k2u.pi7.tadmc@magna.augustmail.com>

Robert Dodier <robert.dodier@gmail.com> wrote:

> I am hoping to find byte offsets of regular expressions in a file.


   perldoc -f pos


> Here is some pseudocode to illustrate what I am attempting --
> 
>   let re1 = " --Function: <some name>"


Why _pseudo_ when making it Real Perl is so darn easy?


   my $re1 = " --Function: <some name>";


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


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

Date: Sun, 9 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jul  9 2006
Message-Id: <J24D27.zvB@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Alien-SeleniumRC-0.13
http://search.cpan.org/~lukec/Alien-SeleniumRC-0.13/
Packages the Selenium Remote Control server.
----
Bundle-SenseClusters-0.93
http://search.cpan.org/~tpederse/Bundle-SenseClusters-0.93/
Bundle of CPAN modules required for SenseClusters
----
CGI-Application-Search-1.00
http://search.cpan.org/~wonko/CGI-Application-Search-1.00/
Base class for CGI::App Swish-e site engines
----
Data-Bind-0.26
http://search.cpan.org/~clkao/Data-Bind-0.26/
Bind and alias variables
----
Data-Constraint-1.08
http://search.cpan.org/~bdfoy/Data-Constraint-1.08/
prototypical value checking
----
Data-Constraint-1.09
http://search.cpan.org/~bdfoy/Data-Constraint-1.09/
prototypical value checking
----
Devel-Caller-0.11
http://search.cpan.org/~rclamp/Devel-Caller-0.11/
meatier versions of caller
----
Devel-PPPort-3.09
http://search.cpan.org/~mhx/Devel-PPPort-3.09/
Perl/Pollution/Portability
----
Locale-Maketext-Utils-v0.0.3
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-v0.0.3/
Adds some utility functionality and failure handling to Local::Maketext handles
----
Mail-Sendmail-0.79_16
http://search.cpan.org/~mivkovic/Mail-Sendmail-0.79_16/
v. 0.79_16 - Simple platform independent mailer
----
Net-Address-Ethernet-1.074
http://search.cpan.org/~mthurn/Net-Address-Ethernet-1.074/
find hardware ethernet address
----
POE-Stage-0.0082
http://search.cpan.org/~rcaputo/POE-Stage-0.0082/
a proposed base class for formalized POE components
----
Sub-Multi-0.001_1
http://search.cpan.org/~clkao/Sub-Multi-0.001_1/
Data::Bind-based multi-sub dispatch
----
TL-0.10_03
http://search.cpan.org/~mikage/TL-0.10_03/
Tripletail, Framework for Japanese Web Application
----
TL-0.10_04
http://search.cpan.org/~mikage/TL-0.10_04/
Tripletail, Framework for Japanese Web Application
----
Test-File-1.16
http://search.cpan.org/~bdfoy/Test-File-1.16/
test file attributes
----
Text-Same-0.04
http://search.cpan.org/~kim/Text-Same-0.04/
Look for similarities between files or arrays
----
WWW-CheckPad-0.032
http://search.cpan.org/~takeshige/WWW-CheckPad-0.032/
An API to control the check*pad (http://www.checkpad.jp/)
----
WWW-CheckPad-0.033
http://search.cpan.org/~takeshige/WWW-CheckPad-0.033/
An API to control the check*pad (http://www.checkpad.jp/)
----
WWW-CheckPad-0.034
http://search.cpan.org/~takeshige/WWW-CheckPad-0.034/
An API to control the check*pad (http://www.checkpad.jp/)
----
XML-DifferenceMarkup-1.00
http://search.cpan.org/~vbar/XML-DifferenceMarkup-1.00/
XML diff and merge
----
YAML-Tiny-0.03
http://search.cpan.org/~adamk/YAML-Tiny-0.03/
Read/Write YAML files with as little code as possible
----
YAML-Tiny-0.04
http://search.cpan.org/~adamk/YAML-Tiny-0.04/
Read/Write YAML files with as little code as possible
----
YAML-Tiny-0.05
http://search.cpan.org/~adamk/YAML-Tiny-0.05/
Read/Write YAML files with as little code as possible


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sun, 09 Jul 2006 13:16:02 +0100
From: ks <ksamp@vp_removeit_.pl>
Subject: Perl + Emacs
Message-Id: <irs1b2dp5aihm6ugdi6ok9n6u6s9n93d29@4ax.com>

Hi all,
i wonder which additional modules do you use to extend Emacs to ease
your work with big/medium and small projects? i've found many cool
features in modern IDEs like code assistant, providing function
documentation when typed in, real-time code check, documentation
browser, bookmarks, TODO list generators, tabs (easy switching between
many files) etc. could anyone who is using Emacs provide his/her
configuration, modules used, tips and suggestions? maybe someone knows
any useful modules to use which could be of any help?

best regards,
ks


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

Date: Sun, 09 Jul 2006 11:42:14 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl + Emacs
Message-Id: <Xns97FB4E778E204asu1cornelledu@127.0.0.1>

ks <ksamp@vp_removeit_.pl> wrote in news:irs1b2dp5aihm6ugdi6ok9n6u6s9n93d29@4ax.com:

> i wonder which additional modules do you use to extend Emacs to ease

 ...

> maybe someone knows any useful modules to use which could be of 
> any help?

I don't use Emacs, but

http://groups.google.com/group/comp.lang.perl.misc/search?q=emacs+faq
http://search.cpan.org/search?query=emacs&mode=all
http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlfaq3.pod#Where_can_I_get_perl-mode_for_emacs%3F

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Sat, 08 Jul 2006 23:30:11 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: Profanity checking, phonetically.
Message-Id: <7eXrg.3596$5K2.1281@fed1read03>

John Bokma <john@castleamber.com> wrote:
> "shrike@cyberspace.org" <shrike@cyberspace.org> wrote:
 
>> Howdy,
 
>> I have a randomly generated alphabetic string, and I need to profanity
>> check it,  phonetically. I didn't see anything like this on CPAN.
 
>> Anybody done anything like this? 

> Soundex? And there is a better algorithm IIRC.

> OTOH, why bother, people start using fsck, or f*kc etc.

It sounds more that the OP does not want to annoy people by presenting
them with something like a randomly generated password which has
rude connotations... but of course this will very widely depending
on the recipient.

Axel
 


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

Date: 9 Jul 2006 02:45:31 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Profanity checking, phonetically.
Message-Id: <Xns97FADD5653F48castleamber@130.133.1.4>

axel@white-eagle.invalid.uk wrote:

> John Bokma <john@castleamber.com> wrote:
>> "shrike@cyberspace.org" <shrike@cyberspace.org> wrote:
>  
>>> Howdy,
>  
>>> I have a randomly generated alphabetic string, and I need to profanity
>>> check it,  phonetically. I didn't see anything like this on CPAN.
>  
>>> Anybody done anything like this? 
> 
>> Soundex? And there is a better algorithm IIRC.
> 
>> OTOH, why bother, people start using fsck, or f*kc etc.
> 
> It sounds more that the OP does not want to annoy people by presenting
> them with something like a randomly generated password which has
> rude connotations... but of course this will very widely depending
> on the recipient.

*hits self with Perl Cookbook*

Indeed, didn't read good.

-- 
John Bokma          Freelance software developer
                                &
                    Experienced Perl programmer: http://castleamber.com/


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

Date: Sat, 08 Jul 2006 23:31:45 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: Profanity checking, phonetically.
Message-Id: <m21wsvmp26.fsf@Sherm-Pendleys-Computer.local>

John Bokma <john@castleamber.com> writes:

> *hits self with Perl Cookbook*
>
> Indeed, didn't read good.

Try a smaller book next time - seeing double from a concussion isn't likely
to improve things. :-)

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Sun, 9 Jul 2006 13:50:39 +0200
From: Franzl Wisseworst <franzl.wisseworst@mailinator.net>
Subject: Stupid Q: Read complete file into variable or string
Message-Id: <e8qrgh$6dh$02$1@news.t-online.com>

How can I store the contents of a complete file in a variable for some 
other use? My failed attempt is as follows:

  open (BLA,"bla.txt");
  $myfile = <BLA>;
  close(BLA);

If I try to print it for example only the first line is displayed, as I'm 
sure everyone here would be aware of:

   print $myfile;

The file itself however contains several lines of text. How exactly can I 
read in the complete file into the string or variable?


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

Date: Sun, 09 Jul 2006 14:31:03 +0100
From: ks <ksamp@vp.pl>
Subject: Re: Stupid Q: Read complete file into variable or string
Message-Id: <2v02b2tku0bi21p32l04l0vlcjkvmnd1tf@4ax.com>

On Sun, 9 Jul 2006 13:50:39 +0200, Franzl Wisseworst
<franzl.wisseworst@mailinator.net> wrote:

>The file itself however contains several lines of text. How exactly can I 
>read in the complete file into the string or variable?

you can e.g. load all the lines from a file to an array variable:

open (BLA,"bla.txt");
my @lines = <BLA>;
close(BLA);

after that you have each line in subsequent array elements:
$lines[0], $lines[1] ...

use for, foreach to iterate over these lines

if you need an entire file in one scalar variable then you can use
'join' function on this array, use while (<BLA>) {} and many others to
do it - as always :)

it depends on how you want to use it later.

best regards,
ks


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

Date: Sun, 09 Jul 2006 12:46:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Stupid Q: Read complete file into variable or string
Message-Id: <Xns97FB594F133A1asu1cornelledu@127.0.0.1>

Franzl Wisseworst <franzl.wisseworst@mailinator.net> wrote in
news:e8qrgh$6dh$02$1@news.t-online.com: 

> How can I store the contents of a complete file in a variable for some
> other use? My failed attempt is as follows:

http://search.cpan.org/~uri/File-Slurp-9999.12/lib/File/Slurp.pm

Sinan

PS: Setting X-No-Archive means fewer people will see your posts.

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 9 Jul 2006 05:51:33 -0700
From: "goho" <bg1act@yahoo.com.au>
Subject: Re: Stupid Q: Read complete file into variable or string
Message-Id: <1152449493.084702.6820@35g2000cwc.googlegroups.com>


Franzl Wisseworst wrote:
> How can I store the contents of a complete file in a variable for some
> other use? My failed attempt is as follows:
>
>   open (BLA,"bla.txt");
>   $myfile = <BLA>;
>   close(BLA);
>
> If I try to print it for example only the first line is displayed, as I'm
> sure everyone here would be aware of:
>
>    print $myfile;
>
> The file itself however contains several lines of text. How exactly can I
> read in the complete file into the string or variable?

Read the article from Uri Guttman at
http://www.perl.com/pub/a/2003/11/21/slurp.html
- it may now be a few years old, but its still good.



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

Date: Sun, 9 Jul 2006 14:34:15 +0200
From: Franzl Wisseworst <franzl.wisseworst@mailinator.net>
Subject: Re: Stupid Q: Read complete file into variable or string
Message-Id: <e8qu29$cl3$02$1@news.t-online.com>

ks wrote:

[..]

> it depends on how you want to use it later.

Many thanks for the answer to my trivial question.

The idea is just to include the contents of the file in a form textarea,  
generated through CGI.pm:

textarea('text',$myfile)

I guess the while loop is a good way to go as the script won't know how 
many lines there are.


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

Date: Sun, 9 Jul 2006 14:38:20 +0200
From: Franzl Wisseworst <franzl.wisseworst@mailinator.net>
Subject: Re: Stupid Q: Read complete file into variable or string
Message-Id: <e8qu8u$cl3$02$2@news.t-online.com>

A. Sinan Unur wrote:

[..]

> http://search.cpan.org/~uri/File-Slurp-9999.12/lib/File/Slurp.pm

Many thanks for this tasty looking module!

> PS: Setting X-No-Archive means fewer people will see your posts.

And less spam, or flames....



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

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 9439
***************************************


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