[29703] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 947 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 18 03:09:40 2007

Date: Thu, 18 Oct 2007 00:09: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, 18 Oct 2007     Volume: 11 Number: 947

Today's topics:
    Re: Change date on-the-fly <joe@inwap.com>
    Re: Change date on-the-fly <ldolan@thinkinghatbigpond.net.au>
    Re: Change date on-the-fly <rkb@i.frys.com>
    Re: dynamically creating labentry widgets with a subrou <paduille.4061.mumia.w+nospam@earthlink.net>
        Elisp Tutorial: HTML Syntax Coloring Code Block <xah@xahlee.org>
    Re: Elisp Tutorial: HTML Syntax Coloring Code Block <bignose+hates-spam@benfinney.id.au>
    Re: How to manipulate the cases of letters in a string? <1usa@llenroc.ude.invalid>
        Is perl a good candidate for Data Mining <struggleyb@gmail.com>
    Re: Is perl a good candidate for Data Mining <zaxfuuq@invalid.net>
    Re: Is perl a good candidate for Data Mining <vilain@NOspamcop.net>
    Re: jabba the tuh <tadmc@seesig.invalid>
    Re: line 16 <joe@inwap.com>
    Re: line 16 <joe@inwap.com>
    Re: line 16 <zaxfuuq@invalid.net>
    Re: line 16 <zaxfuuq@invalid.net>
        new CPAN modules on Thu Oct 18 2007 (Randal Schwartz)
    Re: perl Vs Shell <joe@inwap.com>
    Re: please help optimize sub <1usa@llenroc.ude.invalid>
    Re: SCP putting file problem <joe@inwap.com>
    Re: SCP putting file problem <ced@blv-sam-01.ca.boeing.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Oct 2007 18:48:12 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Change date on-the-fly
Message-Id: <GcadnfavYbzqJovanZ2dnUVZ_urinZ2d@comcast.com>

Peter Jamieson wrote:

> 1. The $to_date is always "yesterday" ie the day before the current date
> 2. The $from_date is always the day after the previous $to_date

perl -le 'print "Today is ".localtime(time); print "Yesterday was ".localtime(time-86400); print "Day before was ".localtime(time-2*86400)'
Today is Wed Oct 17 18:46:56 2007
Yesterday was Tue Oct 16 18:46:56 2007
Day before was Mon Oct 15 18:46:56 2007

	-Joe


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

Date: Thu, 18 Oct 2007 05:48:01 GMT
From: "Peter Jamieson" <ldolan@thinkinghatbigpond.net.au>
Subject: Re: Change date on-the-fly
Message-Id: <lsCRi.839$CN4.468@news-server.bigpond.net.au>

Thanks to Gunnar Hjalmarsson, Joe Smith and "all mail refused" for
your constructive help....much appreciated!
I will look at your suggestions asap...cheers, Peter 




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

Date: 17 Oct 2007 23:09:14 -0700
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Change date on-the-fly
Message-Id: <1192662748.758544.215190@v23g2000prn.googlegroups.com>

On Oct 17, 3:42 pm, "Peter Jamieson"
<ldo...@thinkinghatbigpond.net.au> wrote:
> Hi all,
> I collect data from a web site at irregular intervals using a script
> part of which is below. In the code snippet shown I manually
> insert date values for $from_date and $to_date, save and close the
> script then run it from the command line.
>
> I would like to avoid the manual step of entering the $from_date and
> $to_date
> values, instead have the code determine them for me based on a couple of
> rules:
>
> 1. The $to_date is always "yesterday" ie the day before the current date
> 2. The $from_date is always the day after the previous $to_date, that is
> the $to_date used when the script was previously run....the idea being
> as time passes to cover all dates.
>
> For example if $from_date = '2007/10/13' and $to_date = '2007/10/15'
> and the script was run then if I want to run the script today, 2007/10/18
> I need the script to set $from_date = '2007/10/16' and $to_date =
> '2007/10/17'
>
> I *think* I need to store the most recently completed date range within the
> script
> somehow and then update it after each run or before each new but cannot see
> how.
> Hope this makes sense!....any suggestions appreciated...cheers, Peter
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use HTTP::Cookies;
> use LWP;
> use Time::Local;
> use Win32::ODBC;
>
> my($db) = new Win32::ODBC('expenses');
>
> # YYYY/MM/DD format
> my $from_date = '2007/10/13';
> my $to_date = '2007/10/15';
>
> my ($from_year, $from_mon, $from_day) = split('/', $from_date);
> my ($to_year, $to_mon, $to_day) = split('/', $to_date);
>
> my $from_datetime = timelocal(0,0,0,$from_day,$from_mon-1,$from_year);
> my $to_datetime = timelocal(0,0,0,$to_day,$to_mon-1,$to_year);
>
> # snipped rest of Perl script to collect data for the stipulated date
> range......

I would use the strftime funcion from POSIX module.

use POSIX qw(strftime);

use constant ONE_DAY => 86400;

my $from_date = strftime("%Y/%m/%d", localtime(time - 3 * ONE_DAY));
my $to_date = strftime("%Y/%m/%d", localtime(time - ONE_DAY));



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

Date: Thu, 18 Oct 2007 00:18:27 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: dynamically creating labentry widgets with a subroutine and getting right textvariable out
Message-Id: <13hdtqj429qclc7@corp.supernews.com>

On 10/17/2007 04:37 PM, ben.rogers@gmail.com wrote:
> Howdy,
> 
> I have a few LabEntry widgets that do similar things so I thought I
> would create them with a sub and pass params to it. As you can see, I
> pass filetypes4bin to the sub and it displays the list of file types
> ok. However, when the user edits the entry field --say to add a few
> more filetypes to look for--the textvariable is not updated.
> 
> 1: How do I get the user modified textvariable out of the sub.
> 2: How do I keep the params I pass from breaking validatecommand.
> $_[1] use to work for checking user input, but now of course it's
> getting the value of the label param.
> 
> thanks,
> 
> ben
> 
> $filetypes4bin = "gif|jpg|bmp";
> 
> createLabEntryForFileTypes($dircleanPanelToolsSub1, "Pipe-separated
> list of file types:", $filetypes4bin);
> 
> # Parent, title, textvariable.
> sub createLabEntryForFileTypes{
> 
> 	my $parentwidget = $_[0];
> 	my $label = $_[1];
> 	my $filetypes = $_[2];
> 
> 	$parentwidget -> LabEntry(
> 	    -label => $label,
> 	    -labelPack => [ "-side" => "left" ],
> 	    -textvariable => $filetypes,
> [...]

Try changing that line to this:

-textvariable => \$_[2],

Note, I don't have Tk::LabEntry installed and can't test your code.

I don't have an answer for the validatecommand question.


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

Date: Wed, 17 Oct 2007 21:15:26 -0700
From:  Xah Lee <xah@xahlee.org>
Subject: Elisp Tutorial: HTML Syntax Coloring Code Block
Message-Id: <1192680926.420317.16630@v29g2000prd.googlegroups.com>

Elisp Tutorial: HTML Syntax Coloring Code Block

Xah Lee, 2007-10

This page shows a example of writing a emacs lisp function that
process a block of text to syntax color it by HTML tags. If you don't
know elisp, first take a gander at Emacs Lisp Basics.

HTML version with color and links is at:
http://xahlee.org/emacs/elisp_htmlize.html

---------------------------------------
THE PROBLEM

SUMMARY

I want to write a elisp function, such that when invoked, the block of
text the cursor is on, will have various HTML style tags wrapped
around them. This is for the purpose of publishing programing language
code in HTML on the web.

DETAIL

I write a lot computer programing tutorials for several computer
languages. For example: Perl and Python tutorial, Java tutorial, Emacs
Lisp tutorial, Javascript tutorial. In these tutorials, often there
are code snippets. These code need to be syntax colored in HTML.

For example, here's a elisp code snippet:

(if (< 3 2)  (message "yes") )

Here's what i actually want as raw HTML:

(<span class=3D"keyword">if</span> (&lt; 3 2)  (message <span
class=3D"string">"yes"</span>) )

Which should looks like this in a web browser:

(if (< 3 2)  (message "yes") )

There is a emacs package that turns a syntax-colored text in emacs to
HTML form. This is extremely nice. The package is called htmlize.el
and is written (1997,...,2006) by Hrvoje Niksic, available at
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el.

This program provides you with a few new emacs commands. Primarily, it
has htmlize-region, htmlize-buffer, htmlize-file. The region and
buffer commands will output HTML code in a new buffer, and the htmlize-
file version will take a input file name and output into a file.

When i need to include a code snippet in my tutorial, typically, i
write the code in a separate file (e.g. =E2=80=9Ctemp.java=E2=80=9D, =E2=80=
=9Ctemp.py=E2=80=9D), run
it to make sure the code is correct (compile, if necessary), then,
copy the file into the HTML tutorial page, inside a =C2=ABpre=C2=BB block. =
In
this scheme, the best way for me to utilize htmlize.el program is to
use the =E2=80=9Chtml-buffer=E2=80=9D command on my temp.java, then copy th=
e htmlized
output and paste that into my HTML tutorial file inside a =C2=ABpre=C2=BB b=
lock.
Since many of my tutorials are written haphazardly over the years
before seeing the need for syntax coloration, most exist inside =C2=ABpre=
=C2=BB
tags already without a temp code file. So, in most cases, what i do is
to select the text inside the =C2=ABpre=C2=BB tag, paste into a temp buffer=
 and
invoke the right mode for the language (so the text will be fontified
correctly), then do htmlize-buffer, then copy the html output, then
paste back to replace the selected text.

This process is tedious. A tutorial page will have several code
blocks. For each, i will need to select text, create a buffer, switch
mode, do htmlize, select again, switch buffer, then paste. Many of the
steps are not pure push-buttons operations but involves eye-balling.
There are few hundred such pages.

It would be better, if i can place the cursor on a code block in a
existing HTML page, then press a button, and have emacs magically
replace the code block with htmlized version colorized for the code
block's language. We proceed to write this function.

---------------------------------------
SOLUTION

For a elisp expert who knows how fontification works in emacs, the
solution would be writing a elisp code that maps emacs's string's
fontification info into html tags. This is what htmlize.el do exactly.
Since it is already written, a elisp expert might find the essential
code in htmlize.el. (the code is licensed under GPL) .

Unfortunately, my lisp experience isn't so great. I spent maybe 30
minutes tried to look in htmlize.html in hope to find a function
something like htmlize-str that is the essence, but wasn't successful.
I figured, it is actually faster if i took the dumb and inefficient
approach, by writing a elisp code that extracts the output from
htmlize-buffer. Here's the outline of the plan of my function:

    * 1. Grab the text inside a <pre class=3D"=C2=ABlang=C2=BB">...</pre> t=
ag.
    * 2. Create a new buffer. Paste the code in.
    * 3. Make the new buffer =C2=ABlang=C2=BB mode (and fontify it)
    * 4. Call htmlize-buffer
    * 5. Grab the (htmlized) text inside =C2=ABpre=C2=BB tag in the htmlize
created output buffer.
    * 6. Kill the htmlize buffer and my temp buffer.
    * 7. Delete the original text, paste in the new text.

To achieve the above, i decided on 2 steps. A: Write a function
=E2=80=9Chtmlize-string=E2=80=9D that takes a string and mode name, and ret=
urns the
htmlized string. B: Write a function =E2=80=9Chtmlize-block=E2=80=9D that d=
oes the
steps of grabbing text and pasting, and calls =E2=80=9Chtmlize-string=E2=80=
=9D for the
actual htmlization.

Here's the code of my htmlize-string function:

(defun htmlize-string (ccode mn)
"Take string ccode and return htmlized code, using mode mn.\n
This function requries the htmlize-mode.el by Hrvoje Niksic, 2006"
(let (cur-buf temp-buf temp-buf2 x1 x2 resultS)
    (setq cur-buf (buffer-name))
    (setq temp-buf "xout-weewee")
    (setq temp-buf2 "*html*") ;; the buffer that htmlize-buffer
creates

    ; put the code in a new buffer, set the mode
    (switch-to-buffer temp-buf)
    (insert ccode)
    (funcall (intern mn))

    (htmlize-buffer temp-buf)
    (kill-buffer temp-buf)
    (switch-to-buffer temp-buf2)

    ; extract the core code
    (setq x1 (re-search-forward "<pre>"))
    (setq x1 (+ x1 1))
    (re-search-forward "</pre>")
    (setq x2 (re-search-backward "</pre>"))
    (setq resultS (buffer-substring-no-properties x1 x2))
    (kill-buffer temp-buf2)

    (switch-to-buffer cur-buf)
    resultS
)
)

The major part in this code is knowing how to create, switch, kill
buffers. Then, how to set a mode. Lastly, how to grab text in a
buffer.

Current buffer is given by =E2=80=9Cbuffer-name=E2=80=9D. To create or swit=
ch buffer
is done by =E2=80=9Cswitch-to-buffer=E2=80=9D. Kill buffer is =E2=80=9Ckill=
-buffer=E2=80=9D. To
activate a mode, the code is =E2=80=9C(funcall (intern my-mode-name))=E2=80=
=9D. I
don't know why this is so in detail, but it is interesting to know.

The grabbing text is done by locating the desired beginning and ending
locations using re-search functions, and buffer-substring-no-
properties for actually extracting the string.

Here, note the =E2=80=9Cno-properties=E2=80=9D in =E2=80=9Cbuffer-substring=
-no-properties=E2=80=9D.
Emacs's string can contain information called properties, which is
essentially the fontification information.

Reference: Elisp Manual: Buffers.

Reference: Elisp Manual: Text-Properties.

Here's the code of my htmlize-block function:

(defun htmlize-block ()
  "Replace the region enclosed by <pre> tag to htmlized code.
For example, if the cursor somewhere inside the tag:

<pre cla ss=3D\"code\">
codeXYZ...
</pre>

after calling, the =E2=80=9CcodeXYZ...=E2=80=9D block of text will be htmli=
zed.
That is, wrapped with many <span> tags.

The opening tag must be of the form <pre cla ss=3D\"lang-str\">.
The =E2=80=9Clang-str=E2=80=9D determines what emacs mode is used to colori=
ze
the code.
This function requires htmlize.el by Hrvoje Niksic."

(interactive)
(let (mycode tag-begin styclass code-begin code-end tag-end mymode)
  (progn
    (setq tag-begin (re-search-backward "<pre class=3D\"\\([A-z-]+\\)
\""))
    (setq styclass (match-string 1))
    (setq code-begin (re-search-forward ">"))
    (re-search-forward "</pre>")
    (setq code-end (re-search-backward "<"))
    (setq tag-end (re-search-forward "</pre>"))
    (setq mycode (buffer-substring-no-properties code-begin code-end))
    )
  (cond
   ((equal styclass "elisp") (setq mymode "emacs-lisp-mode"))
   ((equal styclass "perl") (setq mymode "cperl-mode"))
   ((equal styclass "python") (setq mymode "python-mode"))
   ((equal styclass "java") (setq mymode "java-mode"))
   ((equal styclass "html") (setq mymode "html-mode"))
    ((equal styclass "haskell") (setq mymode "haskell-mode"))
   )
  (save-excursion
    (delete-region code-begin code-end)
    (goto-char code-begin)
    (insert (htmlize-string mycode mymode))
    )
  )
)

The steps of this function is to grab the text inside a =C2=ABpre=C2=BB blo=
ck,
call htmlize-string, then insert the result replacing text.

Originally, i wrote the code to grab text by inside plain =E2=80=9C<pre>...=
</
pre>=E2=80=9D tags, then use some heuristics to determine what language it =
is,
then call htmlize-string with the mode-name passed to it. However,
since my html pages already has the language information in the form
of =E2=80=9C<pre class=3D"=C2=ABlang=C2=BB">...</pre>=E2=80=9D (for CSS rea=
sons), so, now i search
text by that form, and use the =E2=80=9Clang=E2=80=9D part to determine a m=
ode.

Emacs is beautiful.

Postscript:

The story given above is slightly simplified. For example, when i
began my language notes and commentaries, they were not planned to be
some systematic or sizable tutorial. As the pages grew, more quality
are added in editorial process. So, a plain un-colored code inside
=C2=ABpre=C2=BB started to have =E2=80=9Clanguage comment=E2=80=9D strings =
colorized (e.g.
=E2=80=9C<span class=3D"cmt">#...</span>), by using a simple elisp code that
wraps a tag on them, and this function is mapped to shortcut key for
easy execution. As pages and languages grew, i find colorizing comment
isn't enough, then i started to look for a syntax-coloring html
solution. There are solutions in Perl, Python, PHP, but I find emacs
solution best suites my needs in particular because it integrates with
emacs's interactive nature, and my writing work is done in a
accumulative, editorial process.

In the beginning i used htmlize-region and htmlize-buffer as they are
for new code. Note that this is still a laborious process. Gradually i
need to colorized my old code. The problem is that many already
contain my own =C2=ABspan class=3D"cmt"=C2=BB tags, and strings common in c=
omputer
languages such as =E2=80=9C<=3D=E2=80=9D have already been transformed into=
 required
html encoding =E2=80=9C&lt;=3D=E2=80=9D. So, the elisp code will first =E2=
=80=9Cun-htmlize=E2=80=9D
these in my htmlize-block code. But once all my existing code has been
so newly colorized, the part of code to transform strings for un-
htmlize is no longer necessary, so they are taken out in htmlize-block
and resumes a cleaner state. Also, htmlize-block went thru many
revisions over the year. Sometimes in recent past, i had one code
wrapper for each language. For example, i had htmlize-me-perl, htmlize-
me-python, htmlize-me-java, etc. The need for unification into a
single coherent wrapper code didn't materialize. In general, it is my
experience, in particular in writing elisp customization for emacs,
that tweaking code periodically thru the year is practical, because it
adapts to the constant changes of requirements, environment, work
process. For example, eventually i might write my own htmlize.el, if i
happen to need more flexibility, or if my elisp experience
sufficiently makes the job relatively easy.

Also note: a whole-sale solution is to write a program, in say,
Python, that process html files and replace proper sections by
htmlized string. This is perhaps more efficient if all the existing
html files are in some uniform format. However, i need to work on my
tutorials on a case-by-case basis. In part, because, some pages
contain multiple languages or contains pseudo-code that i do not wish
colorized. (For example, some pages contains codes of the Mathematica=E2=86=
=97
language. Mathematica code is normally done in Mathematica's
mathematical typesetting capable =E2=80=9Cfront-end=E2=80=9D IDE called =E2=
=80=9CNotebook=E2=80=9D and
is not =E2=80=9Csyntax-colored=E2=80=9D as such.)

  Xah
  xah@xahlee.org
=E2=88=91 http://xahlee.org/



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

Date: Thu, 18 Oct 2007 15:20:08 +1000
From: Ben Finney <bignose+hates-spam@benfinney.id.au>
Subject: Re: Elisp Tutorial: HTML Syntax Coloring Code Block
Message-Id: <87r6jtyp6f.fsf@benfinney.id.au>

Xah Lee <xah@xahlee.org> writes:

> Elisp Tutorial: HTML Syntax Coloring Code Block

Utterly irrelevant to most of the groups in the Newsgroups field.

Followups set to comp.lang.lisp and comp.emacs only, please.

-- 
 \     "[The RIAA] have the patience to keep stomping. They're playing |
  `\      whack-a-mole with an infinite supply of tokens."  -- kennon, |
_o__)                                             http://kuro5hin.org/ |
Ben Finney


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

Date: Thu, 18 Oct 2007 02:11:02 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to manipulate the cases of letters in a string?
Message-Id: <Xns99CCE1AAB2B5Basu1cornelledu@127.0.0.1>

"Petr Vileta" <stoupa@practisoft.cz> wrote in
news:fe4fgi$1623$1@ns.felk.cvut.cz: 

> Jim Gibson wrote:
>> In article <1191541667.632448.15320@g4g2000hsf.googlegroups.com>, xz
>> <zhang.xi.cn@gmail.com> wrote:
>>
>>> Say, change "i LOVE this Game" into "I LOVE THIS GAME" or "i love
>>> this game"
>>
>> perldoc -f uc
>> perldoc -f lc
> 
> Your answer is short and to the subject, but not all perl programmers
> use Linux. I can mention only that some of us are using ActiveState
> Perl and we have not any perldoc.exe on our Windows PCs :-)

C:\DOCUME~1\asu1\LOCALS~1\Temp> perldoc -f uc
    uc EXPR
    uc      
Returns an uppercased version of EXPR. This is the internal
function implementing the "\U" escape in double-quoted strings.
Respects current LC_CTYPE locale if "use locale" in force. See
perllocale and perlunicode for more details about locale and
Unicode support. It does not attempt to do titlecase mapping on
initial letters. See "ucfirst" for that.

If EXPR is omitted, uses $_.

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Thu, 18 Oct 2007 09:39:26 +0800
From: Bo Yang <struggleyb@gmail.com>
Subject: Is perl a good candidate for Data Mining
Message-Id: <ff6h8b$rjq$1@news.cn99.com>

Hi,
   I am wondering is perl a good candidate for Data Mining? I intend to 
use Perl to analyze tons of data and fetch some useful informatino from 
them. Does perl designed for this?
Thanks in advance!

Regards!
Bo


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

Date: Wed, 17 Oct 2007 22:09:54 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Is perl a good candidate for Data Mining
Message-Id: <V5SdnSQ-OcARQYvanZ2dnUVZ_vShnZ2d@comcast.com>



"Bo Yang" <struggleyb@gmail.com> wrote in message 
news:ff6h8b$rjq$1@news.cn99.com...
> Hi,
>   I am wondering is perl a good candidate for Data Mining? I intend to use 
> Perl to analyze tons of data and fetch some useful informatino from them. 
> Does perl designed for this?
> Thanks in advance!
So-called data mining is methodologically flawed.

You can breathe your own smoke in any language.
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen." 




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

Date: Wed, 17 Oct 2007 21:16:33 -0700
From: Michael Vilain <vilain@NOspamcop.net>
Subject: Re: Is perl a good candidate for Data Mining
Message-Id: <vilain-A9AA51.21163317102007@comcast.dca.giganews.com>

In article <ff6h8b$rjq$1@news.cn99.com>, Bo Yang <struggleyb@gmail.com> 
wrote:

> Hi,
>    I am wondering is perl a good candidate for Data Mining? I intend to 
> use Perl to analyze tons of data and fetch some useful informatino from 
> them. Does perl designed for this?
> Thanks in advance!
> 
> Regards!
> Bo

I'd be more concerned that "Are YOU designed for this?"

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...





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

Date: Thu, 18 Oct 2007 02:18:31 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: jabba the tuh
Message-Id: <slrnfhde9l.c2e.tadmc@tadmc30.sbcglobal.net>

Wade Ward <zaxfuuq@invalid.net> wrote:


> my $s4 = join("\n", map ($_->[$subject_offset],@xover)),"\n";
                                                         ^^^^^
                                                         ^^^^^

> One question:
> what is this warning telling me:
> Useless use of a constant in void context at jabba1.pl line 57.
> line 57 is:


In addition to what perldiag.pod says about that message,
it is telling you that the "\n" at the end there isn't
doing anything. You should remove it.

Due to the precedence of the operators involved (perldoc perlop),
it is the same as:

    (my $s4 = join("\n", map ($_->[$subject_offset],@xover))),"\n";


If you were trying to get a newline at the end of $s4,
then this would have done it:

    my $s4 = join("\n", map ($_->[$subject_offset],@xover), '');


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Wed, 17 Oct 2007 20:34:30 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: line 16
Message-Id: <ZcqdnSmsvbD9SYvanZ2dnUVZ_rrinZ2d@comcast.com>

Wade Ward wrote:

> Testing for return values is a bit more than my current perl game.

You should always test return values.
If you feel you are not competent enough to do that, then you should
hire someone else to do the programing for you.


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

Date: Wed, 17 Oct 2007 20:50:53 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: line 16
Message-Id: <ZcqdnSisvbClRYvanZ2dnUVZ_rrinZ2d@comcast.com>

Wade Ward wrote:

> I got the upper hand on this one already.  It was the use of the newnews 
> method that is unsupported by comcast.

Didn't we tell you that back on 7/6/2007?


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

Date: Wed, 17 Oct 2007 22:06:12 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: line 16
Message-Id: <9OudnRTlDr8yRovanZ2dnUVZ_qqgnZ2d@comcast.com>



"Joe Smith" <joe@inwap.com> wrote in message 
news:ZcqdnSmsvbD9SYvanZ2dnUVZ_rrinZ2d@comcast.com...
> Wade Ward wrote:
>
>> Testing for return values is a bit more than my current perl game.
>
> You should always test return values.
> If you feel you are not competent enough to do that, then you should
> hire someone else to do the programing for you.
2 interpersonal normative statements, which are philosophically 
unintelligible.

How do I test for return values?
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen." 




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

Date: Wed, 17 Oct 2007 22:07:55 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: line 16
Message-Id: <DcGdnZztF4uIQYvanZ2dnUVZ_gSdnZ2d@comcast.com>



"Joe Smith" <joe@inwap.com> wrote in message 
news:ZcqdnSisvbClRYvanZ2dnUVZ_rrinZ2d@comcast.com...
> Wade Ward wrote:
>
>> I got the upper hand on this one already.  It was the use of the newnews 
>> method that is unsupported by comcast.
>
> Didn't we tell you that back on 7/6/2007?
Yeah.  I relocated in the meantime, so I packed up the whole show, and 
forgot some of the things I had learned.

The cure was xover.
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen." 




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

Date: Thu, 18 Oct 2007 04:42:15 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Oct 18 2007
Message-Id: <Jq3BqF.1vB2@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.

Apache2-Filter-Minifier-CSS-1.04_02
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-CSS-1.04_02/
CSS minifying output filter 
----
Apache2-Filter-Minifier-JavaScript-1.04_02
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-JavaScript-1.04_02/
JS minifying output filter 
----
Apache2-PageKit-2.15
http://search.cpan.org/~borisz/Apache2-PageKit-2.15/
MVCC web framework using mod_perl, XML and HTML::Template 
----
Astro-SIMBAD-Client-0.009
http://search.cpan.org/~wyant/Astro-SIMBAD-Client-0.009/
Fetch astronomical data from SIMBAD 4. 
----
CSS-Minifier-XS-0.01_04
http://search.cpan.org/~gtermars/CSS-Minifier-XS-0.01_04/
XS based CSS minifier 
----
Cache-FastMmap-1.23
http://search.cpan.org/~robm/Cache-FastMmap-1.23/
Uses an mmap'ed file to act as a shared memory interprocess cache 
----
Catalyst-Plugin-FormValidator-Simple-Messages-0.01
http://search.cpan.org/~miyazaki/Catalyst-Plugin-FormValidator-Simple-Messages-0.01/
FormValidator::Simple can be handled by plural Catalyst application in mod_perl 
----
Class-Accessor-Complex-0.01
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.01/
arrays, hashes, booleans, integers, sets and more 
----
Class-Accessor-Complex-0.02
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.02/
arrays, hashes, booleans, integers, sets and more 
----
Class-Accessor-Complex-0.03
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.03/
arrays, hashes, booleans, integers, sets and more 
----
Clone-Closure-0.01
http://search.cpan.org/~bmorrow/Clone-Closure-0.01/
A clone that knows how to clone closures 
----
Color-Similarity-HCL-0.04
http://search.cpan.org/~mbarbon/Color-Similarity-HCL-0.04/
compute color similarity using the HCL color space 
----
Config-File-1.41
http://search.cpan.org/~gwolf/Config-File-1.41/
Parse a simple configuration file 
----
Config-General-2.36
http://search.cpan.org/~tlinden/Config-General-2.36/
Generic Config Module 
----
DBIx-Perlish-0.31
http://search.cpan.org/~gruber/DBIx-Perlish-0.31/
a perlish interface to SQL databases 
----
Data-Bucket-0.03
http://search.cpan.org/~tbone/Data-Bucket-0.03/
indexed data store (bucket hashing) 
----
Data-Bucket-0.05
http://search.cpan.org/~tbone/Data-Bucket-0.05/
indexed data store (bucket hashing) 
----
Data-Bucket-0.07
http://search.cpan.org/~tbone/Data-Bucket-0.07/
indexed data store (bucket hashing) 
----
Data-Container-0.02
http://search.cpan.org/~marcel/Data-Container-0.02/
base class for objects containing a list of items 
----
DateTime-Format-Natural-0.55
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.55/
Create machine readable date/time with natural parsing logic 
----
Decision-ParseTree-0.02
http://search.cpan.org/~notbenh/Decision-ParseTree-0.02/
Replacing waterfall IF-ELSIF-ELSE blocks 
----
Error-Hierarchy-0.01
http://search.cpan.org/~marcel/Error-Hierarchy-0.01/
support for hierarchical exception classes 
----
FCGI-IIS-0.01
http://search.cpan.org/~cosmicnet/FCGI-IIS-0.01/
FCGI wrapper for MS IIS FastCGI 
----
FCGI-IIS-0.03
http://search.cpan.org/~cosmicnet/FCGI-IIS-0.03/
FCGI wrapper for MS IIS FastCGI 
----
File-Read-0.07
http://search.cpan.org/~saper/File-Read-0.07/
Unique interface for reading one or more files 
----
File-Tee-0.02
http://search.cpan.org/~salva/File-Tee-0.02/
replicate data sent to a Perl stream 
----
Gungho-0.08014
http://search.cpan.org/~dmaki/Gungho-0.08014/
Yet Another High Performance Web Crawler Framework 
----
HTML-RobotsMETA-0.00002
http://search.cpan.org/~dmaki/HTML-RobotsMETA-0.00002/
Parse HTML For Robots Exclusion META Markup 
----
IPC-Cmd-0.40
http://search.cpan.org/~kane/IPC-Cmd-0.40/
finding and running system commands made easy 
----
JavaScript-Minifier-XS-0.01_04
http://search.cpan.org/~gtermars/JavaScript-Minifier-XS-0.01_04/
XS based JavaScript minifier 
----
MIME-Lite-TT-HTML-0.04
http://search.cpan.org/~chunzi/MIME-Lite-TT-HTML-0.04/
Create html mail with MIME::Lite and TT 
----
Net-Proxy-0.12
http://search.cpan.org/~book/Net-Proxy-0.12/
Framework for proxying network connections in many ways 
----
Net-UKDomain-Nominet-Automaton-1.07
http://search.cpan.org/~cliffordj/Net-UKDomain-Nominet-Automaton-1.07/
Module to handle the Nominet Automaton for domain registration and modification. 
----
NetSNMP-LogParser-1.0530
http://search.cpan.org/~nito/NetSNMP-LogParser-1.0530/
An incremental logparser to be used with Net-SNMP 
----
NetSNMP-MibProxy-1.0530
http://search.cpan.org/~nito/NetSNMP-MibProxy-1.0530/
Simple pass_persist script for Net-SNMP 
----
Parse-IASLog-0.01
http://search.cpan.org/~bingos/Parse-IASLog-0.01/
A parser for Microsoft IAS-formatted log entries. 
----
Parse-IASLog-0.02
http://search.cpan.org/~bingos/Parse-IASLog-0.02/
A parser for Microsoft IAS-formatted log entries. 
----
Parse-IASLog-0.03
http://search.cpan.org/~bingos/Parse-IASLog-0.03/
A parser for Microsoft IAS-formatted log entries. 
----
Parse-IRC-1.06
http://search.cpan.org/~bingos/Parse-IRC-1.06/
A parser for the IRC protocol. 
----
Perl-Dist-0.06
http://search.cpan.org/~adamk/Perl-Dist-0.06/
Perl Distribution Creation Toolkit 
----
Perl-Dist-Downloads-0.01
http://search.cpan.org/~adamk/Perl-Dist-Downloads-0.01/
The downloads required to build Vanilla Perl distros 
----
Perl-Dist-Downloads-0.02
http://search.cpan.org/~adamk/Perl-Dist-Downloads-0.02/
The downloads required to build Vanilla Perl distros 
----
SVN-Class-0.04
http://search.cpan.org/~karman/SVN-Class-0.04/
manipulate Subversion workspaces with Perl objects 
----
Socket-Class-1.13
http://search.cpan.org/~chrmue/Socket-Class-1.13/
A class to communicate with sockets 
----
String-FlexMatch-0.08
http://search.cpan.org/~marcel/String-FlexMatch-0.08/
flexible ways to match a string 
----
Term-Visual-0.08
http://search.cpan.org/~lunartear/Term-Visual-0.08/
split-terminal user interface 
----
Test-Harness-Straps-0.28
http://search.cpan.org/~mschwern/Test-Harness-Straps-0.28/
detailed analysis of test results 
----
Test-Harness-Straps-0.29
http://search.cpan.org/~mschwern/Test-Harness-Straps-0.29/
detailed analysis of test results 
----
Test-Weaken-0.001_007
http://search.cpan.org/~jkegl/Test-Weaken-0.001_007/
Test for leaks after weakening of circular references 
----
Text-Iconv-1.6.1
http://search.cpan.org/~mpiotr/Text-Iconv-1.6.1/
Perl interface to iconv() codeset conversion function 
----
Text-Iconv-1.7
http://search.cpan.org/~mpiotr/Text-Iconv-1.7/
Perl interface to iconv() codeset conversion function 
----
Tk-Wizard-2.118
http://search.cpan.org/~mthurn/Tk-Wizard-2.118/
GUI for step-by-step interactive logical process 
----
Web-Scraper-0.22
http://search.cpan.org/~miyagawa/Web-Scraper-0.22/
Web Scraping Toolkit inspired by Scrapi 
----
WebService-Audioscrobbler-0.06
http://search.cpan.org/~nilsonsfj/WebService-Audioscrobbler-0.06/
An object-oriented interface to the Audioscrobbler WebService API 
----
WebService-Audioscrobbler-0.07
http://search.cpan.org/~nilsonsfj/WebService-Audioscrobbler-0.07/
An object-oriented interface to the Audioscrobbler WebService API 
----
Wx-0.79
http://search.cpan.org/~mbarbon/Wx-0.79/
interface to the wxWidgets cross-platform GUI toolkit 
----
YAML-Active-1.03
http://search.cpan.org/~marcel/YAML-Active-1.03/
Combine data and logic in YAML 
----
parrot-0.4.17
http://search.cpan.org/~coke/parrot-0.4.17/


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: Wed, 17 Oct 2007 19:08:15 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: perl Vs Shell
Message-Id: <hNSdnUEZlIG3XYvanZ2dnUVZ_qKgnZ2d@comcast.com>

DriVE_mE_cRazY wrote:
> what the advantage of using perl script in the place of shell script.

#!/bin/sh
count=1
while [ $count -le 5 ]; do
   echo "Count is $count";
   count=`expr $count + 1`
done



#!/usr/bin/perl
for ($count=1;$count<=5;$count++) {
   print "Count is $count\n";
}



#!/usr/bin/perl
print "Count is $_\n" for (1..5);


Doing arithmetic on variables is easier in perl.
Things like `tr`, `grep`, and `sed` operations are built-in.
Sorting is much easier.

When perl first came out, a lot of sysadmins started converting Bourne shell
scripts to perl.  In many cases, the resultant perl scripts were much shorter
and more suitable for adding new features.

	-Joe


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

Date: Thu, 18 Oct 2007 01:29:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: please help optimize sub
Message-Id: <Xns99CCDA9215648asu1cornelledu@127.0.0.1>

QoS@domain.invalid wrote in news:T9yRi.15082$fm1.8984@trnddc01:

> sub optimizeMePlease
> {
>   my $input = $_[0];
>   my $return;
>   my @array = (
>     1.6931595338935,  5.07947860168049, 8.46579766946749,
>     11.8521167372545, 15.2384358050415, 18.6247548728285,
>     22.0110739406155, 25.3973930084025, 28.7837120761895,
>     32.1700311439765, 35.5563502117635, 38.9426692795505,
>     42.3289883473375, 45.7153074151245, 49.1016264829115,
>     52.4879455506985, 55.8742646184855, 59.2605836862725,
>     62.6469027540595, 66.0332218218465, 69.4195408896335,
>     72.8058599574205, 76.1921790252075, 79.5784980929945,
>     82.9648171607815, 86.3511362285685, 89.7374552963554,
>     93.1237743641424, 96.5100934319294, 100,
>   );

 ...

I first moved the definition of @array outside of the subroutine. That 
resulted in a speed-up of about 55% on my system.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Wed, 17 Oct 2007 19:31:10 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: SCP putting file problem
Message-Id: <WLOdnThOE4EUWIvanZ2dnUVZ_oCvnZ2d@comcast.com>

lerameur wrote:

> well I do not see .ssh/authorized_keys

So?  Just create one.

    remote% cat >>.ssh/authorized_keys
    <copy-and-paste the contents of id_rsa.pub here>
    ^D
    remote% ls -l .ssh

>  but I do see /dir/.ssh/known_hosts

Irrelevant; that file is not used for incoming connections.

	-Joe


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

Date: Wed, 17 Oct 2007 21:56:17 -0700
From:  "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: SCP putting file problem
Message-Id: <1192683377.251483.321280@q5g2000prf.googlegroups.com>

On Oct 17, 7:31 pm, Joe Smith <j...@inwap.com> wrote:
> lerameur wrote:
> > well I do not see .ssh/authorized_keys
>
> So?  Just create one.
>
>     remote% cat >>.ssh/authorized_keys
>     <copy-and-paste the contents of id_rsa.pub here>
>     ^D
>     remote% ls -l .ssh
>
> >  but I do see /dir/.ssh/known_hosts
>
> Irrelevant; that file is not used for incoming connections.

<off topic>
That's true and I haven't used Net::SCP  but, the scp could
potentially fail because the local ssh config forces a manual
acceptance check of the
remote host IP if there hasn't been an earlier
SSH connection. Once the connection is accepted,
the remote IP and its public key is added to
'known_hosts'.
</off topic>

--
Charles DeRykus







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

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 V11 Issue 947
**************************************


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