[30598] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1841 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 6 16:09:43 2008

Date: Sat, 6 Sep 2008 13:09:08 -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           Sat, 6 Sep 2008     Volume: 11 Number: 1841

Today's topics:
    Re: "Selling" Perl (i.e. getting the boss to let me ins <willem@stack.nl>
    Re: "Selling" Perl (i.e. getting the boss to let me ins <hjp-usenet2@hjp.at>
        Any GUI Toolkit Suggestions? <hal@halblog.com>
    Re: Any GUI Toolkit Suggestions? <mjcarman@mchsi.com>
    Re: Compile vs mod_perl vs perl <hjp-usenet2@hjp.at>
    Re: Complex (for me) reference deconstruction <someone@example.com>
    Re: FAQ 6.13 What does it mean that regexes are greedy? <willem@stack.nl>
    Re: FAQ 7.16 How do I create a static variable? <brian.d.foy@gmail.com>
        Perl Strings vs FileHandle <mshadabh@gmail.com>
    Re: submit  to FormMail.pl throwing some error. <vsrawat@gmail.com>
    Re: subprocesses lifecycle <hjp-usenet2@hjp.at>
    Re: subprocesses lifecycle <hjp-usenet2@hjp.at>
        Suggestion For Useful Script -- Google Groups Search an <sorry_no_email@yahoo.com>
    Re: Suggestion For Useful Script -- Google Groups Searc (Randal L. Schwartz)
    Re: Suggestion For Useful Script -- Google Groups Searc <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 6 Sep 2008 07:39:17 +0000 (UTC)
From: Willem <willem@stack.nl>
Subject: Re: "Selling" Perl (i.e. getting the boss to let me install it)
Message-Id: <slrngc4ct5.2qdm.willem@snail.stack.nl>

John Bokma wrote:
) Another thing a lot of editors share is the ability to redefine the 
) keyboard shortcuts (Although it's something I try to avoid).

Well okay, I'll concede that.  But still you have to use key combinations
(ctrl-this, alt-that, I imagine ?)

)> The big advantage vim has over most other editors is that it can be
)> completely controlled from thust the basic alphanumeric keys, so you
)> don't have to lift your hands from the main part of the keyboard to do
)> stuff.
)
) Only thing I can think off that requires the mouse in TextPad is moving 
) the splitter. But I don't mind to move my hands away from the keyboard 
) now and then, I have no problems with the mouse, and some things I do 
) faster with it.

Yes, but you have to use the *whole* keyboard, not just the alphanumeric
bits.  That makes a bit of difference.

)> Vim, on the other hand, is quite different as mentioned before.
)
) I can't see why, or maybe I am too used to vi/vim :-).

Well, there is still the use of easy macro recording, the ease of
combining almost any edit command with almost any move command, and
the ease of adding custom scripts.  Of course, emacs has the first
and the last as well, and probably the second too.
Downside of emacs is escape-meta-alt-control-shift  :-P


In any case, perhaps I could get to comparable speed with another editor,
but I very much doubt it would take me only a week to do so, even if I were
to spend the whole week doing nothing but familiarize myself with the
editor.  I tend to use *a lot* of more powerful functionality of vim,
learned from years of working with it.  Perhaps all of that is also
available in other editors (although I actually doubt all of it is) but
that is *a lot* of stuff to relearn.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


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

Date: Sat, 6 Sep 2008 18:53:22 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: "Selling" Perl (i.e. getting the boss to let me install it)
Message-Id: <slrngc5dc2.pu8.hjp-usenet2@hrunkner.hjp.at>

On 2008-09-03 14:57, John Bokma <john@castleamber.com> wrote:
> P B <newsposter625@gmail.com.invalid> wrote:
>> I'd like to install ActivePerl on a Windows XP machine specifically to
>> run a particular script. The "problem" is that the admins in charge of
>> the PC are very cautious about what is installed and the security
>> implications of everything (as they should be).
>
> You have limited access rights, and Perl will run with your rights. Hence 
> it doesn't provide you with any magic.

On the other hand, "Perl will run with your rights" also means "Perl
will run with your full rights". Whatever you can do, any perl script
you execute can do, too. 

So for a security-conscious admin that boils down to: "can I trust that
user not to download and execute potentially harmful scripts?" Of course
if an admin lets a user download and run exe files, he shouldn't worry
about perl scripts - the danger is exactly the same.

	hp


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

Date: Sat, 06 Sep 2008 16:25:12 GMT
From: Hal Vaughan <hal@halblog.com>
Subject: Any GUI Toolkit Suggestions?
Message-Id: <I9ywk.579$Af3.246@trnddc06>

I've been programming in Perl for about 7 years and in Java, with Swing, for
about 4 years, so I'm used to some GUI programming, but I have not done any
in Perl yet.  I thought there was a GUI Perl programming newsgroup, but I
can't find it, so I'm asking here.

I need to write a GUI program that will basically send streams of data
through a TCP socket depending on what button is pressed in a GUI window. 
The tough parts is that the user will need to be able to add more panels,
like a card layout in Java Swing.  There'll be a drop-down or combo list
where the user can pick which panel they want to use or to make a new one. 
Then, on each different panel, they can pick where to add buttons and
specify the size and color of the button (or possibly pick from a list of
icons to go on the button) and specify a text label that could go on the
button or under it.  Of course, this can get into some trouble with layout
managers because the user would want absolute positioning and sizing of a
button and many GUI toolkits don't always use that kind of layout.

I've browsed through some toolkits along the way, while deciding if this
should be written in Perl or C++ (yes, I'm going with Perl), but
considering that the user will be specifying things like the position and
size of a button, then have the program create a button to those specs,
does anyone of suggestions or opininos on a GUI toolkit that would be
particularly flexible and good for this kind of thing?  I've seen some of
what different toolkits have to say for themselves, but I'm interested in
what people who have been using toolkits have to say.

Thanks!


Hal


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

Date: Sat, 06 Sep 2008 17:54:31 GMT
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Any GUI Toolkit Suggestions?
Message-Id: <rtzwk.275857$TT4.133958@attbi_s22>

Hal Vaughan wrote:
> I thought there was a GUI Perl programming newsgroup, but I can't 
> find it, so I'm asking here.

The closest match is comp.lang.perl.tk. Strictly speaking it's a
newsgroup for Perl/Tk, but there is a little discussion about other GUI
toolkits there as well.

See perldoc -q GUI for a partial list of the toolkits you can use to
create GUIs for Perl programs.

> considering that the user will be specifying things like the position
> and size of a button, then have the program create a button to those
> specs, does anyone of suggestions or opininos on a GUI toolkit that 
> would be particularly flexible and good for this kind of thing?

Tk has three different geometry managers. pack is the one used most
often, grid works better for tabular layouts, and place allows absolute
positioning. You can mix managers within a program (just don't mix them
within a frame!) which would allow you to use pack or grid for your
application while allowing users to get absolute positioning (withing
their sandbox) via place.

> I've seen some of what different toolkits have to say for themselves,
> but I'm interested in what people who have been using toolkits have
> to say.

I've used Perl/Tk for a long time. I've recently transitioned to Tkx but
can't recommend it as a starting point for newcomers.

Perl/Tk is a deep binding to Tcl/Tk. It's mature, well-documented, and
has a rich library of megawidgets. It's also stagnant and in danger of
becoming obsolete. My major complaint is that you can't get a
platform-native look with it. It's probably the most popular of the Perl
GUI options. Because of this and the excellent documentation it should
be relatively easy to get started with.

Tkx is a very thin layer over Tcl/Tk. It's shiny and new, supports all
the newer goodies in Tcl/Tk like tiled (themed) widgets but has scant
documentation and no widget libraries. It's not bad to use if you're
coming from Perl/Tk and it should be pretty easy if you're familiar with
Tcl/Tk. If not, it's probably best to stay away for now. It defers to
the Tcl documentation for most things which means that you're left with
reading Tcl and trying to figure out how to convert it to Perl.

-mjc


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

Date: Sat, 6 Sep 2008 18:30:16 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Compile vs mod_perl vs perl
Message-Id: <slrngc5c0o.pu8.hjp-usenet2@hrunkner.hjp.at>

On 2008-09-03 11:59, Bill H <bill@ts1000.us> wrote:
> From what I have heard and read (and this could be wrong), 
[...]
> compiling just wraps the code in a perl script interpreter (for lack
> of a better term). Are these true?

That depends on the "perl compiler". The programs which turn a perl
program into an executable, usually just pack the perl program, the
modules it uses and a perl interpreter into an executable. They are
sometimes calles "compilers", but the don't compile (in the IT sense of
the word) anything.

> Looking at perldoc perlcompile it mentions that it will make C source
> out of your perl script but then gives caveats about how it is
> incomprehensible.

Perlcc is the exception. Perlcc really translates Perl into C which can
then be compiled into a native executable. The problem is that it
doesn't work for most Perl programs. It is considered a failed
experiment and has been removed from perl 5.10.

	hp


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

Date: Sat, 06 Sep 2008 11:00:28 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Complex (for me) reference deconstruction
Message-Id: <gptwk.149234$nD.102950@pd7urf1no>

Mark Clements wrote:
> Tad J McClellan wrote:
>> sjcampbl@gmail.com<sjcampbl@gmail.com>  wrote:
>>> Ok, I think I understand. Thanks for the help.
>>>
>>> So...
>>>
>>> for $r (@{$t->{rows}}) {
>>>
>>> {rows} is a hash key within a hash referenced by $t
>>> $t->{rows} contains an array reference
>>> @{$t->{rows}} de-references this array reference, returning an actual
>>> array
>>
>> Almost.
>>
>> It does not return an actual array. It returns a list.
>>
>> See:
>>
>>     perldoc -q difference
>>
>>        What is the difference between a list and an array?
>>
> Hmmm... OK - I've read the faq above and it says:
> 
> "
> An array has a changeable length.  A list does not.  An array is 
> something you can push or pop, while a list is a set of values.
> "
> 
> But you *can* pop etc a dereferenced arrayref.
> 
> mark@hermes:~$ perl -Mstrict -Mwarnings -le 'my $c=[qw(a b c)];print pop 
> @{$c}; print "@{$c}"'
> c
> a b
> mark@hermes:~$
> 
> So - the snippet of code above initializes an arrayref, and then pops 
> its dereferenced value. According to the faq this would make the 
> deferenced value an array since I can pop it.
> 
> Am I missing something?

In the example @{$t->{rows}} *is* an array, which in list context 
*returns* a list.



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Sat, 6 Sep 2008 07:42:57 +0000 (UTC)
From: Willem <willem@stack.nl>
Subject: Re: FAQ 6.13 What does it mean that regexes are greedy?  How can I get around it?
Message-Id: <slrngc4d41.2qdm.willem@snail.stack.nl>

PerlFAQ Server wrote:
) 6.13: What does it mean that regexes are greedy?  How can I get around it?
)
)  <snip>

This section could really use a notice that greediness *never* has an impact
on wether or not a regex matches, just on *how* it matches if there is more
way than one.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


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

Date: Sat, 06 Sep 2008 07:45:09 -0700
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 7.16 How do I create a static variable?
Message-Id: <060920080745098050%brian.d.foy@gmail.com>

In article
<ae2aac97-af13-449b-8c71-5d92ee03cef5@b30g2000prf.googlegroups.com>,
Owen <xemoth@gmail.com> wrote:


> Why would you want to do this? Would not a global variable suffice?
> Or put another way, how would using a global variable fail but a
> static variable fulfil a requirement.

One of your biggest tasks as a programmer is to limit the action of any
one bit of code to the smallest scope possbile so it only affects what
it should affect, and nothing else. That's true regardless of the
language you use.


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

Date: Sat, 6 Sep 2008 12:58:09 -0700 (PDT)
From: shadabh <mshadabh@gmail.com>
Subject: Perl Strings vs FileHandle
Message-Id: <9a83b8c1-7eec-434f-a83a-aba036ef5849@k7g2000hsd.googlegroups.com>

Hi all,

Just wanted to run this through Perl gurus to see if fit is correct?.

I have a file that could possibly be 1GB in variable length EBCDIC
data. I will read the file as EBCDIC data and based on some criteria
split it into 100 different files which will add up to the 1GB. This
way a particular copy book can be applied to easy of the split files.

The approach I am using is a filehandle ( IO::FileHandle and
$Strings), substr and write out to 100 different files after applying
the 'logic'. I will use two routine, one to read and one to write, I
have tested this out with 100MB file and it works fine. The question
though is there a memory limit to this, as we are using strings to
break the files. Or is there an alternative way to do this?

Comments, suggestions, improvements and alternatives will really help
to design the code. thanks

Shadab


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

Date: Sat, 06 Sep 2008 12:40:21 +0530
From: V S Rawat <vsrawat@gmail.com>
Subject: Re: submit  to FormMail.pl throwing some error.
Message-Id: <g9tacu$euk$1@aioe.org>

On 9/6/2008 1:42 AM India Time, _Leon Timmermans_ wrote:

> On Sat, 06 Sep 2008 01:16:05 +0530, V S Rawat wrote:
> 
>> I am creating a website.
>>
>> The website root is /www at server.
>>
>> my file ContactUs.html is kept in /www
>>
>> FormMail.pl is kept in /www/cgi-bin
>> It was downloaded from
>> http://nms-cgi.sourceforge.net/formmail_compat-3.14c1/FormMail.pl No
>> changes done.
>>
>> .FormMail.conf is also at /www
>>
> 
> Oy vey! That script is mess. Please do yourself a favor and get something 
> better.
> 
>> What went wrong?
>>
>> It was working OK during the day. I did some tweaking and it is not
>> working now.
>>
>> btw, where are server logs kept. I am not able to find anything on
>> server.
> 
> Without server logs, we can't say anything. You could add
> use CGI::Carp qw(fatalsToBrowser);
> To your script to get those errors to your browser. That will hopefully 
> make clear what's wrong.

I have added the above line as the first line in the script (before use 
Strict), but execution is still showing the same message and not showing 
the real errors on the browser page. What to do?

I am noob so I am not really aware of server error logs, etc. I have 
checked the root of entire server but I couldn't really locate any error 
logs having any decipherable message that I can understand. Where should 
I look?

I think it is a zencart type installation, but my site doesn't have any 
database associated, just static html 4 pages.

And, irrespective of actual error logs, could anyone just enumerate a 
few "main probables" (errors) that I can fiddle around with. Repeat, it 
was working in the day and then I validation the html/css against w3c 
standards to make 0 error/0 warning and it stopped working.

> 
> Regards,
> 
> Leon

Thanks.
-- 
V


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

Date: Sat, 6 Sep 2008 17:19:50 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: subprocesses lifecycle
Message-Id: <slrngc57sm.pu8.hjp-usenet2@hrunkner.hjp.at>

On 2008-08-30 10:10, Eric Pozharski <whynot@pozharski.name> wrote:
> Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>> On 2008-08-29 18:58, Eric Pozharski <whynot@pozharski.name> wrote:
> *SKIP*
>> If you remove print <$h>; the parent will exit immediately, but the
>> child will continue to run.
[...]
> Yes, I know that that will exit immediately.  I've just attempted to
> show that backgrounding doesn't work.
>

But it does work! I.e. it does what Hans wanted. If you want it to do
something else you need to explain what you want it to do first.

	hp



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

Date: Sat, 6 Sep 2008 17:36:34 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: subprocesses lifecycle
Message-Id: <slrngc58s3.pu8.hjp-usenet2@hrunkner.hjp.at>

On 2008-08-30 20:33, Eric Pozharski <whynot@pozharski.name> wrote:
> Eric Pozharski <whynot@pozharski.name> wrote:
>> Matthieu Imbert <breafk@remove.this.gmail.com> wrote:
>> *SKIP*
>>> Currently, when I detect the timeout, I call die "error message". the
>>> message is displayed, but the script does not return until
>>> subprocesses finish (this may take several minutes, depending on what
>>> the subprocesses do).
> *SKIP*
>> However you say that you have a problem.  I suppose you have to
>> investigate why your script attempts to collect zombies.  It should
>> not unless told so.
>
> I've thought (and read) a lot about this.  I believe now, that my guess
> is wrong.
>
> There's no problem with zombies (and respectively waiting for childs).
> As C.DeRykus clearly showed double fork doesn't help.
>
> Now, I think, that B<perl> waits till pipe closes.

It doesn't (at least not during a close which I believe we are talking
about here - of course since Perl is a general purpose programming
language, perl can be made to wait on just about anything). A close on a
filehandle created with "open(... '...|')" waits for the child process
to terminate. If the child process forks again and terminates (as
C.DeRykus) suggested, close returns immediately, as expected.

I don't see where "C.DeRykus clearly showed double fork doesn't help".
On the contrary, I very clearly showed that it does help in a previous
posting.


> That happens when writer (I intentionally say 'writer' but 'child',
> because it can be child of B<init> (since double fork)) intentionally
> closes pipe or just terminates.

When the writer closes the pipe, the reader will get an EOF indication.

	hp


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

Date: Sat, 6 Sep 2008 04:52:07 -0700 (PDT)
From: EdwardATeller <sorry_no_email@yahoo.com>
Subject: Suggestion For Useful Script -- Google Groups Search and Archive
Message-Id: <291b93fe-c8b4-4a8d-8020-d0f10b48876b@z66g2000hsc.googlegroups.com>

The search function on Google Groups was recently broken.  More info
here:

http://groups.google.com/group/Is-Something-Broken/browse_thread/thread/77921dbaa7f27893/4ffc98ca7b9eaca6?hl=en#4ffc98ca7b9eaca6

Made me realize how important this is.  I thought someone with way
more talent than me might write a Perl script that takes as input a
Google Groups search for oranges (for example):

http://groups.google.com/groups/search?qt_s=1&q=oranges

and return most of the posts found as a series of linked HTML
documents.

Seems like a non-trivial problem, but maybe it's simple to one of you
Perl gods.  Based on the level of concern when the search function
went away, I'd say people would be interested in archiving some of
their favorite searches.  I know I am.  Thanks for taking the time to
read this post.


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

Date: Sat, 06 Sep 2008 07:26:33 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Suggestion For Useful Script -- Google Groups Search and Archive
Message-Id: <86abel73l2.fsf@blue.stonehenge.com>

>>>>> "EdwardATeller" == EdwardATeller  <sorry_no_email@yahoo.com> writes:

EdwardATeller> Made me realize how important this is.  I thought someone with
EdwardATeller> way more talent than me might write a Perl script that takes as
EdwardATeller> input a Google Groups search for oranges (for example):

EdwardATeller> http://groups.google.com/groups/search?qt_s=1&q=oranges

EdwardATeller> and return most of the posts found as a series of linked HTML
EdwardATeller> documents.

You're not allowed to scrape the HTML[1].  And it looks like
<http://code.google.com/apis/ajaxsearch/documentation/> doesn't (currently)
have a Google Groups searching component.

So, it's not a matter of being talented.  It's a matter of respecting Google's
permissions for you not to be a robot when you hit their site, because they
certainly respect the robots.txt you put up as well.  It's about ethics.

print "Just another Perl hacker,"; # the original

[1] Section 5.3 of [http://www.google.com/accounts/TOS] says:

  5.3 You agree not to access (or attempt to access) any of the Services by
    any means other than through the interface that is provided by Google,
    unless you have been specifically allowed to do so in a separate agreement
    with Google. You specifically agree not to access (or attempt to access)
    any of the Services through any automated means (including use of scripts
    or web crawlers) and shall ensure that you comply with the instructions
    set out in any robots.txt file present on the Services.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Sat, 06 Sep 2008 08:30:47 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Suggestion For Useful Script -- Google Groups Search and Archive
Message-Id: <1a85c4h36hqmth1h8218ksck6lnv9unv6d@4ax.com>

EdwardATeller <sorry_no_email@yahoo.com> wrote:
>The search function on Google Groups was recently broken.  More info
>here:
>
>http://groups.google.com/group/Is-Something-Broken/browse_thread/thread/77921dbaa7f27893/4ffc98ca7b9eaca6?hl=en#4ffc98ca7b9eaca6
>
>Made me realize how important this is.  I thought someone with way
>more talent than me might write a Perl script that takes as input a
>Google Groups search for oranges (for example):
>
>http://groups.google.com/groups/search?qt_s=1&q=oranges
>
>and return most of the posts found as a series of linked HTML
>documents.

Should be fairly simple by using LWP to get the page with the search
results, then one of the HTML parser modules to extract the links
(mostly copy-and-paste; AFAIR that task is even used as an example in
the documentation), and LWP again to get the target pages.

jue


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

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


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