[19327] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1522 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 14 14:10:39 2001

Date: Tue, 14 Aug 2001 11:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <997812614-v10-i1522@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 14 Aug 2001     Volume: 10 Number: 1522

Today's topics:
        help :) <jtjohnston@courrier.usherb.ca>
    Re: help :) <yanoff@yahoo.com>
    Re: help :) <ilya@martynov.org>
    Re: help :) <rsherman@ce.gatech.edu>
    Re: help :) (Tad McClellan)
    Re: How do I assing an entire array? (Stan Brown)
        Importing subroutines into the CORE::GLOBAL package doe <murat.uenalan@gmx.de>
    Re: Length of strings and arrays <mjcarman@home.com>
    Re: Line counting in a file <iltzu@sci.invalid>
    Re: Line counting in a file <joe+usenet@sunstarsys.com>
        Module installation problem (Rajesh Katnuri)
        multiple striping of leading/trailing chars <achatz@forthnet.gr>
    Re: multiple striping of leading/trailing chars (Anno Siegel)
        NT4  fullname to username (John)
        Pattern Matching Qeustion <admin@salvador.venice.ca.us>
    Re: Pattern Matching Qeustion (Tad McClellan)
    Re: perldoc is like Greek to a beginner?? (Tad McClellan)
        print to e-mail, good solution wanted (Mikko Koljander)
    Re: Redirect Script with Form Variables <iltzu@sci.invalid>
    Re: regex question... <ren@tivoli.com>
    Re: regexp help please! (Tad McClellan)
    Re: Socket Question <skpurcell@hotmail.com>
    Re: validate IP address (John Stanley)
    Re: VIER/NEUN problem <cberry@cinenet.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 14 Aug 2001 17:11:51 GMT
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: help :)
Message-Id: <3B795C49.2A5F8080@courrier.usherb.ca>

Can someone help?

@MyArray = (split/\n/,"Spicy Sichuan-style Shrimp
Cashew Chicken
Northern-style Cold Noodles
Peking-style Caramel Walnuts
Stir-fried Mixed Vegetables");

I want to check input (case insensitive) to cjeck if it matches one of
the lines in the  array above. I have tried and fialed. Here is what I
have so far.

---------snip---------
    $user_input = $in{'P2WC3Q4'};
    $Return_Value = 0;
    foreach $i (0..$#MyArray)
    {
       if (/$MyArray[$i]/i  eq  /$user_input/i)  #obviously not
correct
        {
        $Return_Value = 1;
        }
    }
 print "$Return_Value <hr>";
---------snip---------

Thanks,
John



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

Date: Tue, 14 Aug 2001 12:26:37 -0500
From: Scott Yanoff <yanoff@yahoo.com>
To: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: Re: help :)
Message-Id: <3B795F4D.B32B21B1@yahoo.com>

jtjohnston wrote:
> 
> Can someone help?
> 
> I want to check input (case insensitive) to cjeck if it matches one of
> the lines in the  array above. I have tried and fialed. Here is what I
> have so far.
> 
> ---------snip---------
>     $user_input = $in{'P2WC3Q4'};
>     $Return_Value = 0;
>     foreach $i (0..$#MyArray)
>     {
>        if (/$MyArray[$i]/i  eq  /$user_input/i)  #obviously not
> correct

Try using =~ instead of eq in the above equation.
Note that you are matching patterns, so if your user enters "chicken" it
will be matched up with "Cashew Chicken".  If that is not what you want,
you might want to do something like:
if (lc $MyArray[$i] eq lc $user_input) 

Good luck,
-- 
-Scott
yanoff@yahoo.com | http://www.yanoff.org | AOL IM: SAY KJY


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

Date: 14 Aug 2001 21:33:37 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: help :)
Message-Id: <87vgjqwnpq.fsf@abra.ru>


j> Can someone help?
j> @MyArray = (split/\n/,"Spicy Sichuan-style Shrimp
j> Cashew Chicken
j> Northern-style Cold Noodles
j> Peking-style Caramel Walnuts
j> Stir-fried Mixed Vegetables");

j> I want to check input (case insensitive) to cjeck if it matches one of
j> the lines in the  array above. I have tried and fialed. Here is what I
j> have so far.

j> ---------snip---------
j>     $user_input = $in{'P2WC3Q4'};
j>     $Return_Value = 0;
j>     foreach $i (0..$#MyArray)
j>     {
j>        if (/$MyArray[$i]/i  eq  /$user_input/i)  #obviously not
j> correct
j>         {
j>         $Return_Value = 1;
j>         }
j>     }
j>  print "$Return_Value <hr>";
j> ---------snip---------

I'm not sure what is your criteria of match. Is it exact case
insensitive equality of strings?

Then it should be

  lc($MyArray[$i]) eq lc($user_input)

Regexp match ($user_input contains regexp)?

  $MyArray[$i] =~ /$user_input/i

Substring match ($user_input is substring of $MyArray[$i])?

  $MyArray[$i] =~ /\Q$user_input\E/i

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Tue, 14 Aug 2001 13:54:44 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: help :)
Message-Id: <3B78E754.D0719B6C@ce.gatech.edu>

jtjohnston wrote:
> 
> Can someone help?
> 
> I want to check input (case insensitive) to cjeck if it matches one of
> the lines in the  array above. I have tried and fialed. Here is what I
> have so far.
> 
<snip>


use 

$var = qr/regex/

to create a variable for use as a regular expression, like so: 

----------------------------------------------------------
@array = qw(foo bar baz blah widget);

$user_input = "glamrock widgetbox";

foreach $item (@array){
$item_re = qr/$item/;
if ($user_input =~ /$item_re/i){print "found $item\n";}
}
----------------------------------------------------------

read perldoc perlop for more details on qr


--
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa


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

Date: Tue, 14 Aug 2001 13:15:30 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: help :)
Message-Id: <slrn9nin5i.acs.tadmc@tadmc26.august.net>

Scott Yanoff <yanoff@yahoo.com> wrote:
>jtjohnston wrote:
>> 
>> Can someone help?
>> 
>> I want to check input (case insensitive) to cjeck if it matches one of
>> the lines in the  array above. I have tried and fialed. Here is what I
>> have so far.
>> 
>> ---------snip---------
>>     $user_input = $in{'P2WC3Q4'};
>>     $Return_Value = 0;
>>     foreach $i (0..$#MyArray)
>>     {
>>        if (/$MyArray[$i]/i  eq  /$user_input/i)  #obviously not
>> correct
>
>Try using =~ instead of eq in the above equation.


That is really silly.

   /$MyArray[$i]/i  =~  /$user_input/i

if the first pattern matched, then you will be trying to match
against a string representing a true value, probably "1".

if it does not match, then you will be trying to match
against a string representing a false value, probably the
empty string.


>If that is not what you want,
>you might want to do something like:
>if (lc $MyArray[$i] eq lc $user_input) 


That sounds better (because it will work, your earlier suggestion won't).

:-)


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


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

Date: 14 Aug 2001 11:09:00 -0400
From: stanb@panix.com (Stan Brown)
Subject: Re: How do I assing an entire array?
Message-Id: <9lbeuc$ees$1@panix1.panix.com>

In <nv9int8acm2do74mieul0h0fffc8jd7eno@4ax.com> Bart Lateur <bart.lateur@skynet.be> writes:

>Stan Brown wrote:

>>>You can keep a reference to a  variable in a hash, and when the variable
>>>goes out of scope, the hash is the only way left to access it. Until you
>>>get rid of the reference in the hash, the variable's value itself will
>>>not be destroyed, although the variable itself is gone.
>>
>>Thanks.
>>
>>Hey Toto, I don't think we are in C anymore :-(

>Why the ":-("? You think that's bad? I think it's a very good thing: as
>long as one thing (say, a variable) is hanging on to the data, it won,'t
>be destroyed. It's extremely handy. Neither dangling pointers nor memory
>leaks.

Well, perhaps because I'm still thinking in C, but I do ahve a largish
script that runs as a daemon, and it's got a memory leak somewhere. I have
to eventually find it, because it eventuallu runs out of memory, after
several weeks.


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

Date: Tue, 14 Aug 2001 20:05:10 +0200
From: "Murat Uenalan" <murat.uenalan@gmx.de>
Subject: Importing subroutines into the CORE::GLOBAL package does not work (perlbug)
Message-Id: <9lbp2u$8m8ef$1@ID-71895.news.dfncis.de>

After getting ill not getting it work for me, if found this posting:

    [ID 20001220.004] CORE::GLOBAL support broken in 5.6.0

with the above heading at a perl5-porters bug reports.

Is this true for all perl 5.6+ ? And how to circumvent this ?

Many thanks,
Murat





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

Date: Tue, 14 Aug 2001 09:46:41 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Length of strings and arrays
Message-Id: <3B7939D1.71FA477@home.com>

Nils Bertling wrote:
> 
> Infact I do have some problems concerning a program, which doesn't
> run at the moment.

Define "doesn't run."  What happens when you try to run it? Does it not
run at all? Does it start up and then die? What kind of messages is perl
giving you? (You are running with -w and strict, aren't you?)

> One reason might be the length of the implemented
> strings or arrays. Are there any limitation in length or elements?

From the perl manpage:

[...] Perl does not arbitrarily limit the size of your data [...]

> It would be very kind if anybody can help me solving this problem.

Okay, but you'll have to give us more information. 

-mjc


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

Date: 14 Aug 2001 15:13:31 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Line counting in a file
Message-Id: <997800077.7789@itz.pp.sci.fi>

In article <m3lmkn9ujc.fsf@mumonkan.sunstarsys.com>, Joe Schaefer wrote:
>
>Close- short of some effort to repair the documentation for $.,
>I'd prefer to see it taken out of the language like $# was.  The flaws
>in perlvar's account of $. are IMO very serious. But fixing pervar isn't 
>that simple-  I find it impossible to avoid discussing implementation 
>details without some gross oversimplification.
>
>Here's the best I came up with:

Okay, now we're getting somewhere.  Let me try and shorten that a bit:


  $.    Current line number for the last filehandle accessed. 

        Each filehandle in Perl counts the number of lines that have
        been read from it.  (Depending on the value of "$/", Perl's
        idea of what constitutes a line may not match yours.)  When
        a line is read from a filehandle (via readline() or "<>"),
        or tell() or seek() is called on it, "$."  becomes an alias
        to the line counter for that filehandle.

	You can adjust the counter by assigning to "$.", but this
	will not actually move the seek pointer.  _Localizing_"$."_
	_will_not_localize_the_filehandle's_line_count_.  Instead,
	it will localize perl's notion of which filehandle "$." is
	currently aliased to.

        "$." is reset when the filehandle is closed, except when an
        open filehandle is reopened without an intervening close().
        For more details, see the section on "I/O Operators" in the
        perlop manpage-- in particular, it explains how "$." works
        for the special null filehandle "<>".  Additional examples
        are listed in the eof entry of the perlfunc manpage.

        (Mnemonic: many programs use "." to mean the current line
        number.)


It't not actually all that much shorter that your version, but it says
more or less the same thing, only without perlguts jargon.  I'd consider
this good enough -- if you agree, maybe it's time to submit a patch?


>That's my understanding of how $. works; please correct any errors 
>or omissions.

My testing agrees with it, except for the localization part.  Perhaps it
would be better to document it like this and fix the code to match the
documentation? 

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: 14 Aug 2001 11:52:29 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Line counting in a file
Message-Id: <m3d75yabb6.fsf@mumonkan.sunstarsys.com>

Ilmari Karonen <iltzu@sci.invalid> writes:

> Okay, now we're getting somewhere.  Let me try and shorten that a bit:

[...]

Vastly improved- please submit it.  The only thing I would add is some
mention of $. in the perlfunc docs for readline; perhaps this would
do-

  % perldoc -f readline
  ...
          Note that the notion of "line" used here is however you may
          have defined it with "$/" or "$INPUT_RECORD_SEPARATOR").  Each
          call to readline increments "$." or $INPUT_LINE_NUMBER.  See 
          the sections on "$." and "$/" in the perlvar manpage.
  ...

> My testing agrees with it, except for the localization part.  Perhaps it
> would be better to document it like this and fix the code to match the
> documentation? 

I think so.

-- 
Joe Schaefer       "The man who sets out to carry a cat by its tail learns
                something that will always be useful and which never will grow
                                      dim or doubtful."
                                               --Mark Twain



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

Date: 14 Aug 2001 08:36:48 -0700
From: rajesh_katnuri@hotmail.com (Rajesh Katnuri)
Subject: Module installation problem
Message-Id: <f0fa7633.0108140736.3ba57616@posting.google.com>

Hi,

I am trying to load the Term::Readkey module and am getting the following error:

Can't locate loadable object for module Term::ReadKey in @INC (@INC contains ...

What am I doing wrong ?  Appreciate any help.

Thank you


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

Date: Tue, 14 Aug 2001 17:57:57 +0300
From: Tassos Chatzithomaoglou <achatz@forthnet.gr>
Subject: multiple striping of leading/trailing chars
Message-Id: <3B793C75.8CC37ACF@forthnet.gr>

I'm using the following 6 lines in order to strip off the leading/trailing * or spaces
of a particular string:

$interface_descr =~ s/^\s+//;                           # erase leading spaces
$interface_descr =~ s/\s+$//;                           # erase trailing spaces
$interface_descr =~ s/^\*+//;                           # erase leading *
$interface_descr =~ s/\*+$//;                           # erase trailing *
$interface_descr =~ s/^\s+//;                           # erase leading spaces
$interface_descr =~ s/\s+$//;                           # erase trailing spaces

before : "  ******  testing ***       "
after  : "testing"

Is there a way i can do it faster?

-- 
***************************
Chatzithomaoglou Anastasios
 Network Operations Center
       FORTHnet S.A.
   <achatz@forthnet.gr>
***************************


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

Date: 14 Aug 2001 15:46:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: multiple striping of leading/trailing chars
Message-Id: <9lbh51$ju1$1@mamenchi.zrz.TU-Berlin.DE>

According to Tassos Chatzithomaoglou  <achatz@forthnet.gr>:

[non-ASCII deleted from quoted text]

> I'm using the following 6 lines in order to strip off the
> leading/trailing * or spaces
> of a particular string:
> 
> $interface_descr =~ s/^\s+//; # erase leading spaces
> $interface_descr =~ s/\s+$//; # erase trailing spaces
> $interface_descr =~ s/^\*+//; # erase leading *
> $interface_descr =~ s/\*+$//; # erase trailing *
> $interface_descr =~ s/^\s+//; # erase leading spaces
> $interface_descr =~ s/\s+$//; # erase trailing spaces
> 
> before : "  ******  testing ***       "
> after  : "testing"
> 
> Is there a way i can do it faster?

 ...do exactly what faster?  If you're content with trimming any
mixture of blanks and asterisks, this should do:

    for ( $interface_descr ) {
        s/^[ *]+//;
        s/[ *]+$//;
    }

If you wonder about the one-element-loop, see perldoc -q 'blank space'.

If the particular pattern you are dealing with is important (blanks,
then asterisks, then more blanks and nothing else), you will need a
more sophisticated regex.

Anno


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

Date: 14 Aug 2001 10:56:41 -0700
From: jouell@zdnetmail.com (John)
Subject: NT4  fullname to username
Message-Id: <7e8915d2.0108140956.14224863@posting.google.com>

Hello,

  I searched the newsgroups, perl modules I know of, but cannot find
something that will return an NT4 username from a full name.
Apparently, you can do this in C++, etc. though I'd to do it in perl,
or maybe a resource kit util?
  I know could run "net user /domain $username" and match the username
to fullname, parsing the results through whole SAM basically, and set
up a hash or something but that seems cumbersome, and if it's easier
or done before, great.

Basically, I am to do function("full name") and have it return the
username.
Anyone? 

Thanks in advance,
-john


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

Date: Tue, 14 Aug 2001 08:19:02 -0700
From: Salvador Peralta <admin@salvador.venice.ca.us>
Subject: Pattern Matching Qeustion
Message-Id: <9lbeon$m90$1@persian.noc.ucla.edu>

Being something of a stathead, I was fooling around with a perl 
script to take a look at the performance of certain players in a 
football game.

The file to be parsed has a bunch of line records that look like this:

1-10-DAL 29 (1:48) K.Coleman left tackle to DAL 28 for 1 yard 
(J.Carter). 2-9-DAL 28 (1:01) K.Coleman up the middle to DAL 25 for 3 
yards (L.Scott). 3-6-DAL 25 (:20) K.Coleman left end to DAL 27 for -2 
yards (M.Steele).


At first I thought that I could do something like this:

    if($line =~ /(K.Coleman.+?\)\.)/g) { 
     print $&, "\n\n";
  }

This is okay, but if 2 occurances of the same play happen on the same 
line, it will only match the first instance despite the global 
instruction.

$ ./football.pl

K.Coleman up the middle to DAL 35 for 5 yards (A.Fields).

K.Coleman left tackle to DAL 28 for 1 yard (J.Carter).

 ...

If I remove the ? from the regex, the output looks something like 
this where multiple plays occur on the same line:

K.Coleman up the middle to DAL 30 for 3 yards (J.Carter). 2-17-DAL 30 
(13:11) J.Jackson pass to C.Cole to DAL 25 for 5 yards (J.Jones).

K.Coleman left tackle to DAL 28 for 1 yard (J.Carter). 2-9-DAL 28 
(1:01) K.Coleman up the middle to DAL 25 for 3 yards (L.Scott). 
3-6-DAL 25 (:20) K.Coleman left end to DAL 27 for -2 yards (M.Steele).

 ...

Can anyone suggest a RE pattern that will print out each instance of 
the pattern and match and print multiple occurances of the pattern on 
a single line?  The output should look like the first 2 examples, 
only it should get every instance rather than just the first.  I 
probably just missed it in perldoc -q regex. Sincere apologies if 
that's the case.


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

Date: Tue, 14 Aug 2001 11:17:33 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Pattern Matching Qeustion
Message-Id: <slrn9nig8d.9vd.tadmc@tadmc26.august.net>

Salvador Peralta <admin@salvador.venice.ca.us> wrote:
>Being something of a stathead, I was fooling around with a perl 
>script to take a look at the performance of certain players in a 
>football game.
>
>The file to be parsed has a bunch of line records that look like this:
>
>1-10-DAL 29 (1:48) K.Coleman left tackle to DAL 28 for 1 yard 
>(J.Carter). 2-9-DAL 28 (1:01) K.Coleman up the middle to DAL 25 for 3 
>yards (L.Scott). 3-6-DAL 25 (:20) K.Coleman left end to DAL 27 for -2 
>yards (M.Steele).


If you want to deal with the individual plays, then the first
step should be to _get_ individual plays. Assuming the "line"
above is in $_:

   foreach my $play ( /(.*?\)\.\s?)/g ) {
      print "$play\n";
   }


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


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

Date: Tue, 14 Aug 2001 10:08:40 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <slrn9nic77.9os.tadmc@tadmc26.august.net>

Yves Orton <demerphq@hotmail.com> wrote:
>tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrn9n34mg.nit.tadmc@tadmc26.august.net>...
>> Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>> >In article <slrn9n2gsj.mbp.tadmc@tadmc26.august.net>, Tad McClellan at 
>> >tadmc@augustmail.com says...
>
>> >I certainly wouldn't call regular expressions 
>> >something that is a programming fundamental.  

[snip]

>> Regular expressions correspond to regular grammars.
>
>This is easy for you and me to see, but we have a comp-sci viewpoint.
>I think a lot of people would understand the concept of formal
>grammers, but not really get regular expressions.  If only because the
>notation of one is fairly intuitive, where the other is, well, not.  I
>have often thought that teaching regular expressions without _ever_
>using that term might be a good idea.  For instance the term template
>might be used to avoid unnecessary confusion.


MJD manages to describe "Thompson's construction" and 
Non-deterministic Finite state Automata (NFA) without
using Big Words:

   http://www.plover.com/~mjd/perl/Regex/

including a sidebar _with_ Big Words:

   http://perl.plover.com/Regex/sidebar.html


:-)

Thanks Dominus.


>Also, to get picky, strictly speaking Perls regexes are _not_ regular.


Yes, and I got around to saying that later:

   Message-Id: <slrn9n4407.onj.tadmc@tadmc26.august.net>


Tad> There are mathematical "rules" that must be followed to be
Tad> classified as "regular". No memory is one of the rules. Since
Tad> Perl has added capturing parenthesis (memory), Perl's regular
Tad> expressions are not Regular Expressions anymore. They are
Tad> just called that for historical reasons.


>(Come to
>think of it, I am sure i have seen something somewhere (maybe a faq)
>that says that perl syntax in general is not propperly speaking
>regular either.)


Most programming languages are "Context Free Grammars" the
next step up in Chomsky's hierarchy from "Regular Grammars".

Arbitrarily-deep nesting indicates that it is not Regular.

eg:

   if () {
      if () {
         if () {
            ...


Can't parse that (to an arbitrary depth) with a Regular Expression.


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


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

Date: 14 Aug 2001 10:59:30 -0700
From: koldex@spamcop.net (Mikko Koljander)
Subject: print to e-mail, good solution wanted
Message-Id: <a0947799.0108140959.3a0dff02@posting.google.com>

I did my best trying to select only the most appropriate newsgroups
for this undeniably quite cross-platform post. If I did any
technical/conduct mistakes, I apologize - try to focus on the subject,
not flaming :-)

I have a following challange:

I'd need a solution, that:
1) allows users to print documents from any application running on
their Windows 2000 workstations
2) generates pdf-file from the print data
3) automatically and interactivelly (enambling user to enter
addresses) e-mails the generated pdf-file to recipient(s)

I realize that there are good (and quite complete) solutions like
LEADTOOLS ePrint Printer Driver
(http://www.leadtools.com/home2/VertMkts/LTePrint.htm), but that's
currently only available for Windows 95/98/ME.

I guess it wouldn't be a hard challange for a capable team of some
perl/awk *NIX programmers with knowledge of ghostscript and sendmail
operation to produce some nice scripts that would convert pcl/ps print
files to pdf while taking e-mail addresses from print files's header
and using both pdf-file and the captured addresses as a parameter for
sendmail.

Of course there had to be little Windows 2000/NT compatible print
driver that would allow user to enter e-mail address (or perhaps even
several of them in the DeLuxe version) that were written to print file
before it got sent to *NIX -box's lpd/smb shared printer (yes, the one
that's filters' functions were described above).

The only problem is that I have a need, but not time/skills to make it
happen. Has anyone done thing like this already? Any volunteers for
making this kind of thing under GNU Public License :-) ?


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

Date: 14 Aug 2001 16:22:05 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Redirect Script with Form Variables
Message-Id: <997805545.11039@itz.pp.sci.fi>

In article <nMmc7.1313$Fc7.122822@newsread2.prod.itd.earthlink.net>, Brent Dax wrote:
>"Peter" <here@there.com> wrote in message
>news:Yogc7.6767$pH1.55267@news1.mts.net...
>> I'm looking for a redirect script that will allow me to send variables
>from
>> a form which a user fills in on a web page, to another URL.  So the action
>> line of the form would have the URL of this cgi script, and when the user
>> clicks the submit button all the variables of the form are sent to the
>> redirected page.  The script itself does not need to read and use the
>> variables, just pass them along.  Anyone know where I could find such a
>> script?
>
>Such a script is trivial to code with CGI.pm.  However, it's not a normal
>request, so I don't think there's a script you can just download online.

In fact, the specification is so trivially simple that for once I
wouldn't even use CGI.pm.  A Perl one-liner will do:

  #!/usr/bin/perl
  print "Location: http://www.example.com/some/url?$ENV{QUERY_STRING}\n\n";

No, it won't scale up well to anything more useful, and it only works
for GET requests (redirecting POST requests is next to impossible
anyway).  But it satisfies the original specification.

What I'm not getting is *why* the original poster wants this.  I suspect
it's a component in some "solution" he's come up with for a completely
different original problem.  We might be able to give more help if we
knew what that original problem was.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: 14 Aug 2001 10:35:21 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: regex question...
Message-Id: <m3ae127iyu.fsf@dhcp9-161.support.tivoli.com>

On Tue, 14 Aug 2001, strawSPAM_BEGONEman@plexi.com wrote:

> perlre is very interesting reading. The < threw me because I was
> unaware of the distinction between look-ahead and look-behind. I
> guess this is really a question for the implementors (you may be one
> for all I know) , but isn't its position in the regular expression
> itself enough to imply whether a (?<=.) or a (?=.) is look-ahead or
> look-behind?

Not really.  Consider:

  $_ = "the original string\n";
  s/(.*)(?<=orig)/\U$1/;
  print;
  s/(.*)(?=ORIG)/\L$1/;
  print;
  __END__
  THE ORIGinal string
  the ORIGinal string

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 14 Aug 2001 10:34:17 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regexp help please!
Message-Id: <slrn9nidn9.9os.tadmc@tadmc26.august.net>

JB Lewis <jblewisoh@yahoo.com> wrote:

>From the Win32::EventLog module I can extract this typical {Strings}
>value for an event.
>
>domname\cwilliam COM6 06/01/2001 11:51am 06/01/2001 11:56am 5 6 21965
>3826 16800 user request
>
>Using s/^domname\\// I can easily trim off the domain name, but what I
>want is the username, the COM port, the first date, the first time,
>and then the two numbers after the second time (the elapsed minutes
>and seconds)


Sounds like you basically want several of the space-separated fields.


>Can the regexps be combined to collect each of the values with a
>single regexp (not including the s/// I mentioned above)?


Yes, Bart already showed that.

But seems to me you can easily get it done without pattern matching.


---------------------------------
#!/usr/bin/perl -w
use strict;

$_ = 'cwilliam COM6 06/01/2001 11:51am 06/01/2001 11:56am 5 6 21965 3826 16800 user request';

my($user, $port, $date, $time, undef, undef, $minutes, $seconds) = split;

print "$user, $port, on $date at $time for $minutes:$seconds\n";
---------------------------------


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


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

Date: Tue, 14 Aug 2001 10:07:38 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Re: Socket Question
Message-Id: <3b793fb3$0$148@wodc7nh6.news.uu.net>

Thanks for the response. I will try some of the suggestions, and pass along
what I find out.
Sincerely appreciate your response.

Scott


"Ben Kennedy" <bkennedy99@Home.com> wrote in message
news:eI9e7.102814$EP6.26264476@news1.rdc2.pa.home.com...
>
> "spurcell" <skpurcell@hotmail.com> wrote in message
> news:3b78412b$0$141@wodc7nh6.news.uu.net...
> > I have a piece of server software that talks sockets. I cannot use
> > IO::Socket because of a mod_perl/apache bug. So I need to use the most
> > simplest form I can in order to send the server a question, and get back
a
> > response.
>
> Sure about that bug?  Perhaps its a IO::Socket scoping issue, you may be
> able to get a fix if you post that code
>
> > while (read HANDLE, $buf, 16384) {
> >     print "$buf";
> > }
>
> Perhaps read is blocking on the large buffer size?  If you are using the
> same protocol as the send, try reading just the message size (packed into
4
> byte long, or two byte short if you can), then unpack that value and you
> exactly what to read.  The only reason I say pack them is to fix the
length
> so you know what to read, you could also just pad the numbers with 0's.
> Also, you may want to try sysread - I'm not exactly sure of the technical
> differences, but read() uses the fread system call, which seems to be
> designed for file handle pointers while sysread() uses read internally
which
> works on file descriptors, which may be what you want since you are
working
> with sockets.  Good luck!
>
> --Ben Kennedy
>
>




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

Date: 14 Aug 2001 17:50:53 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: validate IP address
Message-Id: <9lbodt$9ns$1@news.orst.edu>

In article <oy_d7.14788$zg6.1395653@news20.bellglobal.com>,
flash <bop@mypad.com> wrote:
>but 324156926 is not an ip address, it is one that has been changed into a
>new form.

Yes, it is an IP address. It is equivalent to 19.82.61.254, which
belongs to Ford Motor Company.



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

Date: Tue, 14 Aug 2001 17:00:21 -0000
From: Craig Berry <cberry@cinenet.net>
Subject: Re: VIER/NEUN problem
Message-Id: <Xns90FD65C68FDA7cberrycinenetnet1@207.126.101.92>

trammell@bayazid.hypersloth.invalid (John J. Trammell) wrote in
news:slrn9ngopn.s88.trammell@haqq.hypersloth.net: 

> An answer with neun=5625 is not unique; there are three candidates:
> 
>  neun=5625 vier=1369
>  neun=5625 vier=1764
>  neun=5625 vier=4761

Ouch...now I see what you mean by 'oversimplifying'.  A revised 
version of my approach which I believe actually works this time (it 
gets VIER=6241, NEUN=9409):


#!/usr/bin/perl -w
# vier - solve VIER/NEUN puzzle
# Craig Berry (20010814)

use strict;

my @squares = map { sprintf '%04d', $_ ** 2 } 1 .. 99;
my $expr    = qr/
                 ^

                 (.)                     # V
                 ((?!\1)             .)  # I
                 ((?!\1|\2)          .)  # E
                 ((?!\1|\2|\3)       .)  # R

                 ((?!\1|\2|\3|\4)    .)  # N
                 \3                      # E
                 ((?!\1|\2|\3|\4|\5) .)  # U
                 \5                      # N

                 $
                /x;
my %vierMap;
my %neunMap;

foreach my $vier (@squares) {
  foreach my $neun (@squares) {
    if ("$vier$neun" =~ /$expr/o) {
      push @{$vierMap{$vier}}, $neun;
      push @{$neunMap{$neun}}, $vier;
    }
  }
}

while (my ($vier, $neunsr) = each %vierMap) {
  if (@$neunsr == 1 &&
      @{$neunMap{$neunsr->[0]}} == 1) {
    print "VIER = $vier\nNEUN = $neunsr->[0]\n";
    exit;
  }
}

warn "Hey, we should never get here!\n";


-- 
Craig Berry <http://www.cinenet.net/~cberry/>
"That which is now known, was once only imagined." - William Blake



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

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.  

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


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