[25359] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7604 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 4 18:05:38 2005

Date: Tue, 4 Jan 2005 15:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 4 Jan 2005     Volume: 10 Number: 7604

Today's topics:
    Re: cross-platform shell scripts <abigail@abigail.nl>
    Re: Curses and getch problem -- stdin, initscr and newt spambox@volja.net
    Re: Curses and getch problem -- stdin, initscr and newt <bik.mido@tiscalinet.it>
    Re: Curses and getch problem <bik.mido@tiscalinet.it>
    Re: Curses and getch problem spambox@volja.net
    Re: Curses and getch problem spambox@volja.net
        Dummy regex question <not@home.net>
    Re: Dummy regex question <sbryce@scottbryce.com>
    Re: FAQ 1.4: What are perl4 and perl5? <uri@stemsystems.com>
    Re: file rename help <ahamm@mail.com>
    Re: file rename help <ahamm@mail.com>
    Re: Is zero even or odd? <ahamm@mail.com>
    Re: Looking at a character <mritty@gmail.com>
    Re: Looking at a character <nospam@nospam.com>
    Re: Looking at a character <jgibson@mail.arc.nasa.gov>
    Re: Looking at a character <spamtrap@dot-app.org>
    Re: Looking at a character <mritty@gmail.com>
    Re: Looking at a character <spamtrap@dot-app.org>
    Re: Newbie question: "Get substring of line" <uri@stemsystems.com>
    Re: Newbie question: "Get substring of line" <cwilbur@mithril.chromatico.net>
    Re: Newbie question: "Get substring of line" <tadmc@augustmail.com>
    Re: Newbie question: "Get substring of line" <bik.mido@tiscalinet.it>
    Re: Newbie question: "Get substring of line" <spamtrap@dot-app.org>
    Re: Newbie question: "Get substring of line" <uri@stemsystems.com>
        Perl and TeX [was: "Re: For your christmas reading plea <bik.mido@tiscalinet.it>
        Perl coding style question <vilain@spamcop.net>
    Re: Perl coding style question (Anno Siegel)
    Re: Program optimisation advice for newbie <bik.mido@tiscalinet.it>
        Searching perl script which calls web page and forwards (Tom Parson)
    Re: Searching perl script which calls web page and forw <not@home.net>
    Re: Searching perl script which calls web page and forw <hyweljenkins@hotmail.com>
    Re: Searching perl script which calls web page and forw <jgibson@mail.arc.nasa.gov>
    Re: Searching perl script which calls web page and forw <usenet3@julietremblay.com.invalid>
    Re: Searching perl script which calls web page and forw <newsTWOme@pacifierDOTcom>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 04 Jan 2005 19:35:19 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: cross-platform shell scripts
Message-Id: <slrnctlrvm.2mg.abigail@alexandra.abigail.nl>

ioneabu@yahoo.com (ioneabu@yahoo.com) wrote on MMMMCXLIV September
MCMXCIII in <URL:news:1104856152.339942.251410@c13g2000cwb.googlegroups.com>:
**  I think I see what you mean.  There are a lot of tools that are
**  available on Unix systems by default that are either non-existent for
**  Windows or have to be installed by the user.  Perl is said to replace
**  Sed and Awk and probably a lot of other Unix programs.  That would make
**  Perl ideal for portable scripts that you might otherwise write with one
**  of these other programs.
**  
**  I was wondering if there is any point in learning Sed, Awk or other
**  programming tools if you are already learning Perl.  I started reading
**  the O'Reilly Sed/Awk book a little and I keep thinking with each
**  example, "I could just do this in Perl."


If your entire OS needs to be installed from a floppy - and it needs
to run on machines whose memory is limited to 8 Mb RAM, with your root
file system as a RAM device, you have a need of knowing C, sed, awk and
other shell programming tools.

I've been programming in such an enviroment the past couple of months.



Abigail
-- 
   my $qr =  qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
      $qr =~  s/$qr//g;
print $qr, "\n";


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

Date: 4 Jan 2005 13:03:58 -0800
From: spambox@volja.net
Subject: Re: Curses and getch problem -- stdin, initscr and newterm issues?
Message-Id: <1104872638.068812.152300@f14g2000cwb.googlegroups.com>


spambox@volja.net wrote:
> open(TTYI, "/dev/tty") or die $!;
> $scr = newterm(undef, STDOUT, TTYI) or die $!;
> set_term($scr);

Okay, at last, here's the solution:


close(STDIN);
^^^^^^^^^^^^^
open(TTYI, "</dev/tty");
$scr = newterm("linux", STDOUT, TTYI) or die $!;
set_term($scr);

I only have to figure out what to pass as the first argument to newterm
or whatever it is that garbles up the screen after usage. 

andrej



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

Date: Tue, 04 Jan 2005 22:51:18 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Curses and getch problem -- stdin, initscr and newterm issues?
Message-Id: <a3clt0lf54bh660i1fcfk4863l9ib03iv4@4ax.com>

On 4 Jan 2005 05:00:33 -0800, spambox@volja.net wrote:

>But for me it still doesn't work:
>[...]
>1 while <>

If you do not supply args on the cmdline, this will wait for STDIN
forever unless you close it (^D - or ^Z), and Curses or not, the code
that follows will never be reached.

>open(TTYI, "/dev/tty") or die $!;
>$scr = newterm(undef, STDOUT, TTYI) or die $!;
>set_term($scr);
>[...]
>
>Please, does anyone know how to make it work?

As I wrote in my followup this has nothing to do with Curses: does the
following "work"?

  1 while <>;
  die "done!";


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


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

Date: Tue, 04 Jan 2005 22:53:53 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Curses and getch problem
Message-Id: <st3mt0hg9i6mdk6asmk1cb03kja4205kle@4ax.com>

On 4 Jan 2005 02:44:59 -0800, spambox@volja.net wrote:

>> ^D (or ^Z).
>>
>> Nothing actually to do with Curses, BTW.
>
>Please elaborate; I fail to see what solution you were proposing.

It was kind of a hint. You must read about @ARGV and <> in the docs.
Your program is waiting for input from STDIN. If you give it eof, the
program will pass to the next instructions...


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


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

Date: 4 Jan 2005 14:05:36 -0800
From: spambox@volja.net
Subject: Re: Curses and getch problem
Message-Id: <1104876336.588069.105780@f14g2000cwb.googlegroups.com>


Michele Dondi wrote:
> It was kind of a hint. You must read about @ARGV and <> in the docs.
> Your program is waiting for input from STDIN. If you give it eof, the
> program will pass to the next instructions...

It seems like you haven't noticed the following from my first post:
-----
If you run it like "script.pl < somefile", pressing 'q' doesn't do
anything, whereas if you run it like "script.pl somefile", it works as
expected.
----

You could have also tried it out to see what I meant. Anyway, I've
already posted the solution. Looks to me to be curses-related after
all. 

Thanks for your input,
andrej



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

Date: 4 Jan 2005 14:12:31 -0800
From: spambox@volja.net
Subject: Re: Curses and getch problem
Message-Id: <1104876751.474449.245500@z14g2000cwz.googlegroups.com>

Now, the final solution. It's enough to do the following:
open(STDIN, "/dev/tty");

and it will work just perfect.

Bye, 
andrej



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

Date: Tue, 04 Jan 2005 21:33:10 GMT
From: "JayEs" <not@home.net>
Subject: Dummy regex question
Message-Id: <qYDCd.7048$F67.1015@newssvr12.news.prodigy.com>

I have been looking at this for a while, looked up regex tutorials, perldoc 
for substr, etc... and just can't come up with the answer that is probably 
staring me right in the face. Maybe the matter is obfuscated by the fact 
that I am really trying to do 2 things.

Here is my stupid little problem:

Given a string that can be:
"$ 12.00"
"USD 187.54"
"CAD 1.20"
"??? 12.65"

(the latter due to special characters not avail in ASCII)

How do I split these strings into 2, separating the currency code and the 
value?

The only thing I know for sure is that there always is a space in the string 
followed directly by a numerical (but not integer) value. Maybe I've just 
been looking at it too long. Can't figure it out. Prompted me to ordering 
"Learning Perl" from the online retailer whose name starts with A and ends 
in mazon, but that is not very helpful right this second.

Any help would be appreciated.

JS 




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

Date: Tue, 04 Jan 2005 15:16:00 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Dummy regex question
Message-Id: <-eCdnaHTHfwEiEbcRVn-gg@comcast.com>

JayEs wrote:

> How do I split these strings into 2, separating the currency code and the 
> value?

The function you want is called split.



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

Date: Tue, 04 Jan 2005 20:45:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 1.4: What are perl4 and perl5?
Message-Id: <x7y8f8x6s8.fsf@mail.sysarch.com>

>>>>> "CM" == Chris Mattern <matternc@comcast.net> writes:

  CM> Uri Guttman wrote:
  >>>>>>> "AJF" == Alan J Flavell <flavell@ph.gla.ac.uk> writes:
  >> 
  AJF> As I recall, both Digital Unix (or whatever it's called today) and
  AJF> Solaris make use of Perl 4 scripts in their maintenance procedures,
  AJF> and come with a version of Perl 4 installed for that reason.  In
  >> fact, AJF> a Solaris user brought this up on the group recently, as I
  >> dimly AJF> recall.
  >> 
  >> solaris 9 at least comes with 5.6.1. i don't think solaris ever came
  >> with perl4. it does have some perl scripts but not perl4 ones. very few
  >> modern unix flavors (i wouldn't call dec unix modern :) come with perl4.
  >> 
  >> uri
  >> 
  CM> Solaris is weird.  9 ships with 5.6.1...and 5.00503.  However, it doesn't
  CM> seem to come with any flavor of Perl 4.

yeah, i found them in /usr/perl5. but only 5.6.1 is linked from /usr/bin
and in /usr/perl5. i wonder if there are scripts which have
usr/perl5/5.00503/bin/perl5.00503 for a #! line?

maybe they kept it in case some older scripts use it. in any case, i
keep perl in /usr/local/bin myself so i never see solaris's perl.

uri

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


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

Date: Wed, 5 Jan 2005 09:54:25 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: file rename help
Message-Id: <340l53F456257U1@individual.net>

Michele Dondi wrote:
>
> ...I'd use
>
>   for (grep !/txt/, <f*>) {

now why didn't I think of that ?-)




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

Date: Wed, 5 Jan 2005 09:59:33 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: file rename help
Message-Id: <340liqF43djv0U1@individual.net>

Michele Dondi wrote:
>
>> ## no warnings 'uninitialized';
>>
> Indeed that is the single warning that most often needs to be disabled
> out of good reason. But since it can still be useful, it should be
> really disabled *locally* only in those situations in which you know
> you could get it but you know you do not want to be warned as you
> expected it.

I've done a lot of SQL/4GL where (sql's)NULL is a very natural variable,
and also from C where I was a fan of exploiting the equivalence of
NULL/0/truth in conditionals, so if I screw up and needed "warnings
uninitialized" I would consider myself ready for the nursing home :-) I
think it's a mistake akin to adding to customer names together and
expecting their account balance to pop out.

But, Shawn's experience shows that this warning is indeed valuable for a
lot of people. It would not have directly explained his problem, but it
could have made him think about a line of code that was failing.

> Incidentally had I known you (and others, now I see) wrote this
> followup, probably I would have not written mine. However the OP's
> script is so full of bizarre constructs that I've not paid extreme
> attention to each single one of them and so he will probably benefit
> from many people supplying their own cm

yeah - the more the merrier. And everyone has been fairly nice too. Just
waiting for Shawn to say "thanks" to everyone ;-)




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

Date: Wed, 5 Jan 2005 10:01:44 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Is zero even or odd?
Message-Id: <340lisF43djv0U2@individual.net>

Androcles wrote:
>
> When I was test engineering for flight simulators, the DC9 sits
>[SNIP]

fascinating!





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

Date: Tue, 04 Jan 2005 19:33:13 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Looking at a character
Message-Id: <ZbCCd.22133$fe5.14053@trndny06>

"daniel kaplan" <nospam@nospam.com> wrote in message
news:1104863288.468300@nntp.acecape.com...
> so if you are coming from that backround, just wanted to say, keep a
pad
> with the proper ways to do "what you do reflexivly in C" in
Perl....saved me
> grief

You may also want to keep
perldoc perltrap
handy.  It lists common traps among Perl programmers who came from other
languages - including C.  (Although, somewhat surprisingly, the == vs eq
trap is not listed...)

Paul Lalli



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

Date: Tue, 4 Jan 2005 14:46:10 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Looking at a character
Message-Id: <1104867963.486089@nntp.acecape.com>

"Paul Lalli" <mritty@gmail.com> wrote in message
news:ZbCCd.22133$fe5.14053@trndny06...
> "daniel kaplan" <nospam@nospam.com> wrote in message
> news:1104863288.468300@nntp.acecape.com...


> You may also want to keep
> perldoc perltrap
> handy.  It lists common traps among Perl programmers who came from other
> languages - including C.  (Although, somewhat surprisingly, the == vs eq
> trap is not listed...)
>

 thank you, i totally missed that one!  although for the record, i can't say
my example was the one...memory ain't what it used to be...;-)




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

Date: Tue, 04 Jan 2005 11:48:58 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Looking at a character
Message-Id: <040120051148586116%jgibson@mail.arc.nasa.gov>

In article <1104854053.559226.80000@f14g2000cwb.googlegroups.com>,
<ipellew@pipemedia.co.uk> wrote:

> Hi all;
> 
> Whats the fasted way to look at a single character?
> 

perldoc -f substr

is the fastest way to look at the fastest way to look at a single
character. :)


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Tue, 04 Jan 2005 15:05:58 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Looking at a character
Message-Id: <CJadnR-uQp-6akfcRVn-qg@adelphia.com>

Paul Lalli wrote:

> You may also want to keep
> perldoc perltrap
> handy.  It lists common traps among Perl programmers who came from other
> languages - including C.  (Although, somewhat surprisingly, the == vs eq
> trap is not listed...)

I suppose it'd be more like the strncmp() vs. cmp trap - but you're 
right, it should be in there.

sherm--

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


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

Date: Tue, 04 Jan 2005 20:28:27 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Looking at a character
Message-Id: <L%CCd.18915$113.10621@trndny03>

"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:CJadnR-uQp-6akfcRVn-qg@adelphia.com...
> Paul Lalli wrote:
>
> > You may also want to keep
> > perldoc perltrap
> > handy.  It lists common traps among Perl programmers who came from
other
> > languages - including C.  (Although, somewhat surprisingly, the ==
vs eq
> > trap is not listed...)
>
> I suppose it'd be more like the strncmp() vs. cmp trap - but you're
> right, it should be in there.

Well, the specific trap I'd be thinking of is the following:
#include <iostream>
#include <string>
using namespace std;

int main (){

  string str1 = "foo";
  string str2 = "bar";

  if (str1 == str2){
    cout << "Equal" << endl;
  } else {
    cout << "Not Equal" << endl;
  }

  return 0;
}

(yes, I know it's C++ rather than C)

as compared to:
#!/usr/bin/env perl
use strict;

my $str1 = "foo";
my $str2 = "bar";

if ($str1 == $str2){
  print "Equal\n";
} else {
  print "Not Equal\n";
}

__END__

Now, granted, perl *will* give a warning for this, if they're enabled.
But I would still consider it a trap of sorts.

Paul Lalli



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

Date: Tue, 04 Jan 2005 17:11:47 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Looking at a character
Message-Id: <sdSdnRR_c5A5iUbcRVn-1A@adelphia.com>

Paul Lalli wrote:

> (yes, I know it's C++ rather than C)

I've been trying to forget about C++. :-)

I wasn't thinking of C++'s string classes and an overloaded ==. I was 
thinking in plain ol' C.

sherm--

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


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

Date: Tue, 04 Jan 2005 20:41:23 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <x71xd1x6z1.fsf@mail.sysarch.com>

>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:

  >> nor did you tell the OP where to learn about regexes or whatever.

  SP> Get off your high horse Uri - your own reply wasn't quite the most
  SP> useful comment ever posted here, either.

i didn't want to give an answer to the OP since he obviously didn't even
lift a finger to try. i help those who help themselves first :)

notice i like to do code review or answer interesting problems. i tend
to ignore most newbie questions unless i get peeved by their attitude.

as for slamming the $' approach, i was annoyed that he fist came up with
that and then mentioned others didn't like it and then showed a more
common regex solution. why even show the $' one (regardless of the speed
issues which are way beyond a newbies scope)? $' is not common because
of the speed issue and i would think most would prefer explicit grabbing
as it is usually clearer and you get more control.

and my horse is only a pony so it isn't that high. :)

uri

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


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

Date: Tue, 04 Jan 2005 20:44:31 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <87is6dndar.fsf@mithril.chromatico.net>

>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:

    SP> You heard it here first, folks: TMTOWTDI has been deprecated.
    SP> The Official Perl Motto is now "Uri's Way or the Highway." :-)

Well, honestly, the fact that TMTOWTDI does not mean that all WTDI are
equally good.  This ought to be self-evident to anyone with a clue,
but the TMTOWTDI mantra seems to obscure it for people new to the language.

Charlton


-- 
cwilbur at chromatico dot net
cwilbur at mac dot com


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

Date: Tue, 4 Jan 2005 07:19:38 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <slrnctl5va.3e1.tadmc@magna.augustmail.com>

Petterson Mikael <mikael.petterson@ericsson.se> wrote:

> I had 
> a shell script that used awk to get part of a string on a line.


Run your awk through the "a2p" awk-to-perl translator that is
installed as part of the perl distribution, and see it in Perl.


> Lines looks like this:
> 
> xdt=a2a
> zdt=b2b
> ....
> 
> Is there a simple way in perl to assign a $str the substring after the 
> equal sign?


(all untested)

   my(undef, $str) = split /=/, $line;
or
   my($str) = $line =~ /=(.*)/s;
or
   my $str = substr($line index($line, '=')+1);
or
   my $str = substr($line, 4);


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


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

Date: Tue, 04 Jan 2005 22:51:17 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <8vblt05083c08g8t4eui8jia2lq9cu1qpa@4ax.com>

On Tue, 04 Jan 2005 13:38:38 +0100, Petterson Mikael
<mikael.petterson@ericsson.se> wrote:

>Here is the code I am trying to get working ( see below).

(no code here!)

>If the cs_data_file has a line that begins with # it should be treated 
>as comment and the next line should be read. However the if-statement is 
>reached anyway. What am  I doing wrong here?

You failed to paste the code! :-)


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


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

Date: Tue, 04 Jan 2005 17:08:17 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <sdSdnRV_c5BPjkbcRVn-1A@adelphia.com>

Uri Guttman wrote:

> i didn't want to give an answer to the OP since he obviously didn't even
> lift a finger to try. i help those who help themselves first :)

I'm entirely with you on that - my own reply was a variation on RTFM too.

> as for slamming the $' approach, i was annoyed that he fist came up with
> that and then mentioned others didn't like it and then showed a more
> common regex solution. why even show the $' one (regardless of the speed
> issues which are way beyond a newbies scope)?

Well, obviously I'm neither the poster of the message we're talking 
about nor psychic, so I'm just guessing here. I read it along the lines 
of "other folks have mentioned regexes, in addition here's a less common 
alternative."

I could just as easily be wrong about that though, so adjust salinity 
accordingly.

sherm--

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


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

Date: Tue, 04 Jan 2005 22:36:53 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <x7r7l0vn24.fsf@mail.sysarch.com>

>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:

  SP> Uri Guttman wrote:

  >> as for slamming the $' approach, i was annoyed that he fist came up with
  >> that and then mentioned others didn't like it and then showed a more
  >> common regex solution. why even show the $' one (regardless of the speed
  >> issues which are way beyond a newbies scope)?

  SP> Well, obviously I'm neither the poster of the message we're talking
  SP> about nor psychic, so I'm just guessing here. I read it along the
  SP> lines of "other folks have mentioned regexes, in addition here's a
  SP> less common alternative."

i don't mind alternatives but posting one and then saying others
deprecate that solution is worthless. and below that was a reasonable
answer. so why even post the poor one and if you do, why put it first?

uri

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


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

Date: Tue, 04 Jan 2005 22:51:14 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Perl and TeX [was: "Re: For your christmas reading pleasure."]
Message-Id: <grqlt09uhh8bnl9iriik24lgr632t6e5qg@4ax.com>

First of all sorry for replying so late. I had originally crossposted
to clpmisc to hear the cmts from other contributors there, but it
seems it hasn't attracted much people for which I see two main
reasons: (i) people there (here) are more concerned with how to do
things in perl than in speculative issues about Perl, (ii) the subject
line was not effective at all. So I changed it, something I should
have done in the first place (interested readers can check the
original thread for reference)...


On Thu, 30 Dec 2004 15:31:46 +0100, David Kastrup <dak@gnu.org> wrote:

>>>Shrug.  There is no particular advantage making Perl particularly
>>
>> Well it's well suited for text processing.
>
>TeX's input processing has very little to with standard text
>processing, and in fact I don't see any advantage Perl would offer
>here.  You could probably use Perl's hash tables for control
>sequences, but that's pretty much all.  The table of equivalents does
>not map comfortably to anything Perl would offer.

Perl parsing already is "a little" different than standard text
processing. Perl6 will go so far that the parser will be radically
modifiable at compile time. Pardon me if I'm wrong, but this (and
other charachteristics) will make it much more similar to TeX than
anything else I can think of...

>> course TeX is a whole another thing.  This is why I thought of
>> Perl6.
>
>So what would Perl6 offer that would be less painful than just
>explicit coding in some more efficient language?

Grammars!

Regular expressions are already not really much regular any more, but
they will be made so powerful and different from the current behaviour
that their name will be changed to "rules". Not only! Just like (in
some sense) classes group methods, a new concept will be introduced:
that of a grammar, such that grammars will group rules and
incidentally this will be much more than a passing similarity.

>>>suited to the task: the list data structures are not particularly
>>
>> Why?!?
>
>Why what?

Why Perl shouldn't be "well suited to handle list data structures"?

While this is not strictly true, IMHO, even of Perl5, it will be
completely false for Perl6 that will allow both for named and
anonymous lists as well as named and anonymous arrays (arrays are
already different from lists, even if there are obvious
relationships).

>>>suited to Perl, the stuff Perl offers for parsing and scanning is
>>>not well-suited for TeX, the main control structures and concepts in
>>>TeX (optimization and parallel execution, which are mostly
>>>hard-coded in current TeX) don't map well to Perl and would still
>>>require mostly hard-coding.

I would like to hear someone else's opinion about this.

>> So what? Perl already supports binary extensions. Rumors have it
>> that creating such extensions will be much easier under Perl6.
>
>So where is _any_ advantage?

That if you're concerned about Perl's ability to cope with certain
tasks you can rely on the possibility of writing the problematic code
in some other language you consider to be more well suited to it.

>>>In short: there is nothing that would particularly recommend Perl.
>>
>> Certainly it would be better suited than other languages.
>
>That is a blanket statement for which I see no support at all.  You
>have not pointed out anything in which Perl would offer something of
>particular value for TeX programming.

I hope I have done so above...

>> Other than I love it? Well, as I said I think that even in its
[snip]

>How can you love a language that does not even yet exist?  Anyway, if
>we want vaporware, there is no shortage of it in the TeX world.

Indeed! The point is however, that I love Perl, I've tried other
languages, but could stick fundamentally only with it. I understand
perfectly well that it's not well suited for _any_ kind of
application, but that's "my" language. Perl6 will be a different
language and most certainly (seeing the discussions about what we know
of it, e.g. on p6l) every Perl programmer will find one of its
charachteristics or another to be unattracting, but it will definitely
still be Perl, so I know I'll love it too. And OTOH I'm eager to see
its new features.

>Anyway, I see quite more compelling arguments for something like ML
>derivatives.  Not to a degree that I'd be really gung-ho on some

Huh?!?

If you are thinking of that path because of the side-effects-freedom
implicit in functional languages, and of the inherent reliability,
then I can take your point, because indeed Perl will allow you to
write any bad code you like: it's (_mostly_) up to you to write it
good in the first place.

If you're only saying that because of generic functional languages
features, then indeed Perl6 will support most of them: e.g. currying,
closures (they're _already_ supported too), etc.

>solution there, but at least quite more useful than what I've seen
>from Perl, including Perl6, for TeX-like tasks up to now.

Have you seen much from Perl6 for TeX-like tasks?!?

This is a whole another matter, however: believe me! In fact an actual
issue with Perl is the extreme abundance of extremely bad code lying
around. That's unpleasant, but that's how things are: it may well be
that you're judging Perl from some bad perl code.

For example I gave a peek into texdoctk and I can sincerely tell you
that it's the kind of code for which a newbie could be severely bashed
on clpmisc.


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


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

Date: Tue, 04 Jan 2005 14:47:30 -0800
From: Michael Vilain <vilain@spamcop.net>
Subject: Perl coding style question
Message-Id: <vilain-81F384.14473004012005@news.giganews.com>

IIRC, Perl 4 required functions to start with "&" but that doesn't seem 
to be a requirement for Perl 5.  What's "good practice"?  Use the "&" or 
not?

[sorry if this is a rather obvious question...if it's a FAQ, just point 
me to the appropriate perldoc]

TIA,

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





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

Date: 4 Jan 2005 23:01:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl coding style question
Message-Id: <crf78m$t7e$1@mamenchi.zrz.TU-Berlin.DE>

Michael Vilain  <vilain@spamcop.net> wrote in comp.lang.perl.misc:
> IIRC, Perl 4 required functions to start with "&" but that doesn't seem 
> to be a requirement for Perl 5.  What's "good practice"?  Use the "&" or 
> not?

Don't use "&" unless you know why you're using it.  It has an effect
(more than one, really), described in perlsub.  This isn't just a
question of style, use of an ampersand where none is needed is misleading
and wrong.

Anno


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

Date: Tue, 04 Jan 2005 22:51:16 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Program optimisation advice for newbie
Message-Id: <4rblt05q5l61ehb34ggk7ofrqv27blf916@4ax.com>

On Tue, 04 Jan 2005 15:51:21 +0100, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>  my %names = map split /\@\@/, <$fh>;

While what I wrote is still fundamentally correct IMHO, the kind of
code others suggested is definitely better, especially if you *really*
have to work with a multi-line string.


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


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

Date: Tue, 4 Jan 2005 20:40:13 +0100
From: tom.parson@gm.com (Tom Parson)
Subject: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <creret$vvp$03$1@news.t-online.com>

My company where I am working offers an internet access but filters out some web pages like ebay
by a firewall. So I cannot access ebay auctions web page directly.

However I have access to another server which is NOT filtered out by our firewall.

I am searching now I perl script which I can install on the third party server and which acts as
an intermediate broker between me and ebay.

For that I want to enter the real ebay address into an entry filed on a web page on the middle
server. The perl script should fetch the entered ebay web page, then change the ebay URLs inside
and display the modified page to me. When I click now on some links inside the modified
web pages the new link should be transferred to the middle server which in turn gets the next page
and so on.

Does there such a perl script exist?

Tom



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

Date: Tue, 04 Jan 2005 21:22:05 GMT
From: "JayEs" <not@home.net>
Subject: Re: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <0ODCd.7044$F67.6543@newssvr12.news.prodigy.com>

> My company where I am working offers an internet access but filters out 
> some web pages like ebay
> by a firewall. So I cannot access ebay auctions web page directly.

It appears to me that there is a perfectly valid reason for a company to 
restrict access to certain sites from within their network and any attempt 
to circumvent this restriction is most likely against the company policy and 
should therefore not be attempted unless you'd rather sit at home with 
access to said site, without any income and a blemish on your resume.

"Got fired due to visiting restricted web sites" does not look good to *ANY* 
hiring manager. 




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

Date: Tue, 4 Jan 2005 21:43:55 -0000
From: Hywel Jenkins <hyweljenkins@hotmail.com>
Subject: Re: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <MPG.1c451e742ceb4e90989738@news.individual.net>

In article <creret$vvp$03$1@news.t-online.com>, tom.parson@gm.com 
says...
> My company where I am working offers an internet access but filters out some web pages like ebay
> by a firewall. So I cannot access ebay auctions web page directly.
> 
> However I have access to another server which is NOT filtered out by our firewall.
> 
> I am searching now I perl script which I can install on the third party server and which acts as
> an intermediate broker between me and ebay.
> 
> For that I want to enter the real ebay address into an entry filed on a web page on the middle
> server. The perl script should fetch the entered ebay web page, then change the ebay URLs inside
> and display the modified page to me. When I click now on some links inside the modified
> web pages the new link should be transferred to the middle server which in turn gets the next page
> and so on.
> 
> Does there such a perl script exist?

http://www.megaproxy.com/

There's probably a good reason, if not a number of good reasons, why you 
shouldn't be doing this, though.

-- 
Hywel     http://kibo.org.uk/
I do not eat quiche.


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

Date: Tue, 04 Jan 2005 14:45:25 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <040120051445250032%jgibson@mail.arc.nasa.gov>

In article <KUCCd.25553$2X6.1695@trnddc07>, Brian
<usenet3@julietremblay.com.invalid> wrote:

> Tom Parson wrote:
> 
> > I want to enter the real ebay address into an entry filed on a web 
> > page on the middle server. The perl script should fetch the entered 
> > ebay web page,
> 
> This is likely copyright infringement.

Why? He is just implementing something like firewall tunneling (not
sure that is the correct term, though). It's just an HTTP relay. No
copyright infrigement there.

> 
> > then change the ebay URLs inside and display the modified page to me.
> > 
> Will this url be publicly accessible?

It would be publicly accessible to anyone with access to the middle
server.

> 
> > When I click now on some links inside the modified web pages the new 
> > link should be transferred to the middle server which in turn gets 
> > the next page and so on.
> > 
> > Does there such a perl script exist?
> 
> I don't know. Why did you x-post this to a group on html authoring? Or
> for that matter to a group on javascript? Please stop wasting our time
> and keep your Perl posts confined to Perl groups.

Sounds like a Perl question to me: "How do I implement X in Perl?"


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Tue, 04 Jan 2005 20:20:58 GMT
From: Brian <usenet3@julietremblay.com.invalid>
Subject: Re: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <KUCCd.25553$2X6.1695@trnddc07>

Tom Parson wrote:

> I want to enter the real ebay address into an entry filed on a web 
> page on the middle server. The perl script should fetch the entered 
> ebay web page,

This is likely copyright infringement.

> then change the ebay URLs inside and display the modified page to me.
> 
Will this url be publicly accessible?

> When I click now on some links inside the modified web pages the new 
> link should be transferred to the middle server which in turn gets 
> the next page and so on.
> 
> Does there such a perl script exist?

I don't know. Why did you x-post this to a group on html authoring? Or
for that matter to a group on javascript? Please stop wasting our time
and keep your Perl posts confined to Perl groups.

-- 
Brian


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

Date: Tue, 04 Jan 2005 12:49:03 -0800
From: News Me <newsTWOme@pacifierDOTcom>
Subject: Re: Searching perl script which calls web page and forwards to me / displays with adjusted URLs
Message-Id: <10tm09s94vlv793@corp.supernews.com>

Tom Parson wrote:
> My company where I am working offers an internet access but filters out some web pages like ebay
> by a firewall. So I cannot access ebay auctions web page directly.
> 
> However I have access to another server which is NOT filtered out by our firewall.
> 
> I am searching now I perl script which I can install on the third party server and which acts as
> an intermediate broker between me and ebay.
> 
> For that I want to enter the real ebay address into an entry filed on a web page on the middle
> server. The perl script should fetch the entered ebay web page, then change the ebay URLs inside
> and display the modified page to me. When I click now on some links inside the modified
> web pages the new link should be transferred to the middle server which in turn gets the next page
> and so on.
> 
> Does there such a perl script exist?
> 
> Tom
> 

Why don't you just tell your manager you need access to eBay to perform 
the duties of your job.  I am sure he/she would be glad to provide that 
access for you.

NM

-- 
convert uppercase WORDS to single keystrokes to reply


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

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


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