[24310] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6501 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 2 00:05:40 2004

Date: Sat, 1 May 2004 21:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 1 May 2004     Volume: 10 Number: 6501

Today's topics:
    Re: Books online???? <***************>
    Re: free source search engine (simple) ## comments? <webmaster @ infusedlight . net>
    Re: free source search engine (simple) ## comments? <webmaster @ infusedlight . net>
    Re: generating time series graphs with perl <mgjv@tradingpost.com.au>
    Re: Longest match wins - how to do it Perl way? <invalid-email@rochester.rr.com>
    Re: MSSQL 2000 Connect Success <***************>
        n00b needs help pls. <user@unknown.invalid>
    Re: n00b needs help pls. <me@neverumind.com>
    Re: n00b needs help pls. <me@neverumind.com>
    Re: n00b needs help pls. <user@unknown.invalid>
    Re: n00b needs help pls. <invalid-email@rochester.rr.com>
    Re: OSs with Perl installed <abigail@abigail.nl>
    Re: OSs with Perl installed <matthew.garrish@sympatico.ca>
    Re: problem with redirect in CGI <dannywork5@hotmail.com>
    Re: reducing a regex <g-preston1@ti.com>
    Re: reducing a regex <uri@stemsystems.com>
    Re: regex question ... <abigail@abigail.nl>
        single-byte values (Don Stock)
    Re: Wanted: Perl Developer <nospam@bigpond.com>
    Re: Wanted: Perl Developer <postmaster@castleamber.com>
    Re: Why doesn't this work? <jurgenex@hotmail.com>
    Re: Why doesn't this work? <invalid-email@rochester.rr.com>
    Re: Why doesn't this work? <Joe.Smith@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 01 May 2004 20:59:47 -0500
From: Henry Williams <***************>
Subject: Re: Books online????
Message-Id: <ffl890hil2idg01dbe5estrs4r4ibd641h@4ax.com>

On Fri, 30 Apr 2004 22:02:19 -0400, Robert <catcher@linuxmail.org>
wrote:

>They are out there and you should report them to O'Reilly.

I was hoping you were going to! I already have a fulltime job.



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

Date: Sat, 1 May 2004 09:48:34 -0800
From: "Robin" <webmaster @ infusedlight . net>
Subject: Re: free source search engine (simple) ## comments?
Message-Id: <c71ii0$aah$1@reader2.nmix.net>


"gnari" <gnari@simnet.is> wrote in message
news:c6vpo2$eh1$1@news.simnet.is...
> "Robin" <webmaster @ infusedlight . net> wrote in message
> news:c6v3qu$nls$1@reader2.nmix.net...
> >
> > "gnari" <gnari@simnet.is> wrote in message
> > news:c6utlj$ao4$1@news.simnet.is...
> > > "Robin" <webmaster @ infusedlight . net> wrote in message
> > > news:c6usr4$lje$1@reader2.nmix.net...
> > > >
> > > > how can this one be used to hack my site? I'm curious...
> > >
> > > it is a consequence of your habit of keeping securty related files
> > > in your web directory. in the same directory where your
> > > 'search engine' is reading. do you see the implications of that ?
> > >
> >
> > what's your definition of a security related file? My stuff is mainly
just
> > my personal site and zip files for various scripts and doc files...
>
> well a password file for your blogger would qualify, as long as you do not
> want other people to make unauthorized entries.
>
> do you want a demonstration ?

true, they'd still have to guess the password though :-)
-Robin





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

Date: Sat, 1 May 2004 17:27:43 -0800
From: "Robin" <webmaster @ infusedlight . net>
Subject: Re: free source search engine (simple) ## comments?
Message-Id: <c71j75$aim$1@reader2.nmix.net>

> Unless you *do* want to use your newsreader also as a mail client,
> which is not unreasonable, but may also not be fundamental for you,
> being it unable to "work with your mail server" (*which* mail server,
> BTW?) shouldn't make it impossible to use it for reading and writing
> usenet articles...
>
> Also, sorry for the intended sarcasm, but isn't it strange that a
> self-declared (not Perl but) "win32 expert" can't properly setup at
> least one out of *five* different newsreaders?!?

None of them offerered smtp authentication, I'll keep looking. -Robin





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

Date: Sun, 2 May 2004 13:00:04 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: generating time series graphs with perl
Message-Id: <slrnc98p1k.akq.mgjv@martien.heliotrope.home>

On 30 Apr 2004 12:06:20 GMT,
	Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> 
> 
> Martien Verbruggen  <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>> On Thu, 29 Apr 2004 18:28:43 -0500,
>> 	Po Boy <a5ufv8u02@sneakemail.com> wrote:
>> > 
>> > On Thu, 29 Apr 2004 23:16:30 +0000, Martien Verbruggen wrote:
>> >> 
>> >> That sort of graph isn't possible with GD::Graph. I don't know off
>> >> hand of another package for Perl that does support that sort of thing.
>> > 
>> > Yuk! well, thanks for your help. Maybe I'll see if I can get gnuplot or
>> > octave or something to do it.
>> 
>> Note that the chart you use can also be seen as a two-dimensional
>> straight projection of a three-dimensional chart with the time on the
>> Z axis (which points straight away from the view plane).
> 
> I'd describe that as a parametric plot of an arbitrary curve.  The
> Z values play the role of the curve parameter.
> 
>> If you get gnuplot to plot a three-dimensional chart, switch off
>> display of the time axis and labels, and rotate it appropriately, you
>> might just have what you're looking for.
>> 
>> Any other package that does three-d charts and that lets you do a
>> straight projection and switch off axes probably will do as well.
> 
> Any package that allows you to draw lines from one point to another
> could basically do it.  Assuming we have move_to( $x, $y) and
> draw_to( $x, $y) (a la postscript), and the data is given in two
[...]

But then you'd still have to do the work of scaling the thing, and
drawing the axes yourself :)

Basically, what you say above is true of almost any line chart. 

Martien
-- 
                        | 
Martien Verbruggen      | My friend has a baby. I'm writing down all
                        | the noises the baby makes so later I can ask
                        | him what he meant - Steven Wright



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

Date: Sun, 02 May 2004 02:23:08 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Longest match wins - how to do it Perl way?
Message-Id: <40945A75.8050307@rochester.rr.com>

A. Farber wrote:

> Hi, I have a simple problem, which I have solved, but 
> my solution feels ugly to me. Any improvements please?
> 
> A web form contains a list of project names. And for 
> some projects there are mailing lists, which I need 
> to display if the matching project has been selected.
> 
> Some project names begin with the same string, like
> "p1881_aq_" and "p1881". In those cases only the longest 
> match should be taken. Here is how I tried to solve it:
> 
> # put the longest keys first, to make them win
> 
> my @KEYS = qw( p1881_aq_ p1881_ p1972_ p1981_ p2311_ );
> 
> my %MAIL = (p1881_aq_ => {name => 'Project Aqua',
>                           mail => 'aqua@Nokia.com'},
>             p1881_    => {name => 'Project Alpha',
>                           mail => 'alpha@Nokia.com'},
>             p1972_    => {name => 'Project Beta',
>                           mail => 'beta@Nokia.com'},
>             p1981_    => {name => 'Project Gamma',
>                           mail => 'gamma@Nokia.com'},
>             p2311_    => {name => 'Project Theta',
>                           mail => 'theta@Nokia.com'},
> );
> 
> .....
>     for my $p (@selected_projects) { 
>         for my $k (@KEYS) { 
>             if (0 == index $p, $k) {
>                 printf q{<A HREF="MAILTO:%s">%s</A>}, 
>                     $MAIL{$k}->{mail}, $MAIL{$k}->{name};
>                 last;
>             }
>         }
>     }
> 

Your solution looks pretty good to me.  A couple of debatable things 
that might make it more "Perlish":  One could make the search for keys 
into a regexp, and one could interpolate the variables into the print 
string rather than using printf:

  $KEYS=qr/^(p1881_aq_|p1881_|p1972_|p1981_|p2311_);
  ...
  for my $p (@selected_projects){
    if($p=~$KEYS){
      print "<A HREF=\"MAILTO:$MAIL{$1}->{mail}\">$MAIL{$1}->{name}</A>";
    }
}

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Sat, 01 May 2004 21:06:45 -0500
From: Henry Williams <***************>
Subject: Re: MSSQL 2000 Connect Success
Message-Id: <vgl890tuhdp9fem2rb92qs6mb3r69cfno9@4ax.com>

On Sat, 01 May 2004 02:06:23 GMT, Bob Walton
<invalid-email@rochester.rr.com> wrote:


>
>Well, you would be far better off if you:
>
>
>     use DBI;
>
>rather than Win32::ODBC.  With DBI, when you graduate to a better 
>database and/or OS, you won't have to modify any of your code except for 
>the connection string.


Well Bob I was under the possibly mistaken impression that DBI did not
"do" windows. That is, MS SQL DB's

Hence the existence of something like Win32::ODBC

I might have missed something!
 Thanks for your reply.

PS. I am posting using Linux, with VMware running a win2k session as
my dev "box" ... very nice. It's really neat, I have isolated
independant dev systems all on one mighty Linux box. 98SE, Solaris,
Win2k, WinXP --  etc... VMware is really a very neat deal.


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

Date: Sat, 01 May 2004 22:14:36 GMT
From: Koncept <user@unknown.invalid>
Subject: n00b needs help pls.
Message-Id: <010520041814448408%user@unknown.invalid>


Sorry for asking, but I give up on this situation. I am a total n00b at
Perl and have only used it seriously for about 1 week now. I would
really appreciate somebody's help here because I am really feeling
stuck.

** THIS IS NOT A SPAM LIST FIRST AND FOREMOST **
I have a list of email accounts. Many of the email accounts have are
from the same domain.

I want to seperate this huge list into seperate lists, where each list
only contains one address from each domain.

Example:

If my addresses in the source file are as follows:

bill at one.com
jane at one.com
frank at two.com
ted at one.com
jess at three.com

My first run should return:
--------------------
bill at one.com
frank at two.com
jess at three.com

2nd run:
------
jane at one.com

3rd run:
------
ted at one.com

I came up with this to grep unique domains once, but the problem is
that the script only runs once.

#!/usr/bin/perl -w

sub div() { "+","-" x 50, "+\n"; }

die "Usage: $0 emailList" if (@ARGV!=1);

open( EML, $ARGV[0] ) || die "Can't open file : $!\n";

while(<EML>){
  chomp;
  push(@addys, $_) if $_ =~
/^[a-zA-Z0-9_\.\-]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
}

close( EML );

foreach $email( @addys ) { 
  @parts = split( "@", $email ); 
  $domain = $parts[1];
  unless( $seen{$domain} ) {
    push( @users, $email );
    $seen{$domain} = 1;
  }
}

if(@users>0){
  print &div, "The following are uniq users per domain:\n", &div;
  print join( "\n", sort( @users ) ), "\n", &div;
} else {
  print "Sorry. I could not find any email addresses.\n";
}

-- 
Koncept << 
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." 
-Nietzsche

-- 
Koncept << 
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." 
-Nietzsche


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

Date: Sat, 01 May 2004 23:21:41 +0100
From: Titus A Ducksass <me@neverumind.com>
Subject: Re: n00b needs help pls.
Message-Id: <qf889097bqrrqaj29kknugpb5e4350978u@4ax.com>

On Sat, 01 May 2004 22:14:36 GMT, Koncept <user@unknown.invalid>
wrote:

>If my addresses in the source file are as follows:
>
>bill at one.com
>jane at one.com
>frank at two.com
>ted at one.com
>jess at three.com
>
>My first run should return:
>--------------------
>bill at one.com
>frank at two.com
>jess at three.com
Cant you do this from excel???????
It is a simple programme in any language let alone perl.
Break it down to its simple Lowest common denominator - EXCEL.....
iif str ====== xxx then poster is from same
addressssssssssss........................


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

Date: Sat, 01 May 2004 23:25:48 +0100
From: Titus A Ducksass <me@neverumind.com>
Subject: Re: n00b needs help pls.
Message-Id: <ar8890tltl8e0ohf6ro9da97cnkskgakb0@4ax.com>

On Sat, 01 May 2004 23:21:41 +0100, Titus A Ducksass
<me@neverumind.com> wrote:

>On Sat, 01 May 2004 22:14:36 GMT, Koncept <user@unknown.invalid>
>wrote:
>
>>If my addresses in the source file are as follows:
>>
>>bill at one.com
>>jane at one.com
>>frank at two.com
>>ted at one.com
>>jess at three.com
>>
>>My first run should return:
>>--------------------
>>bill at one.com
>>frank at two.com
>>jess at three.com
>Cant you do this from excel???????
>It is a simple programme in any language let alone perl.
>Break it down to its simple Lowest common denominator - EXCEL.....
>iif str ====== xxx then poster is from same
>addressssssssssss........................
As a follow up surely you mean x@abc.co.uk, y@abc.co.uk z@abc.co.uk
rather than a@x.co.uk and b @y.co.uk etc...


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

Date: Sat, 01 May 2004 23:11:20 GMT
From: Koncept <user@unknown.invalid>
Subject: Re: n00b needs help pls.
Message-Id: <010520041911282667%user@unknown.invalid>

In article <ar8890tltl8e0ohf6ro9da97cnkskgakb0@4ax.com>, Titus A
Ducksass <me@neverumind.com> wrote:

> As a follow up surely you mean x@abc.co.uk, y@abc.co.uk z@abc.co.uk
> rather than a@x.co.uk and b @y.co.uk etc...

1) re: emails => Yes. I just didn't want to make active links.
2) re: excel => No. Don't intend to use microsoft products. I would
really like to know how to do this in Perl. This is why I posted here.
Thanks for your advice though.

-- 
Koncept << 
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." 
-Nietzsche


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

Date: Sat, 01 May 2004 23:25:58 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: n00b needs help pls.
Message-Id: <409430F8.4070501@rochester.rr.com>

Koncept wrote:

 ...
> I want to seperate this huge list into seperate lists, where each list
> only contains one address from each domain.
> 
> Example:
> 
> If my addresses in the source file are as follows:
> 
> bill at one.com
> jane at one.com
> frank at two.com
> ted at one.com
> jess at three.com
> 
> My first run should return:
> --------------------
> bill at one.com
> frank at two.com
> jess at three.com
> 
> 2nd run:
> ------
> jane at one.com
> 
> 3rd run:
> ------
> ted at one.com
> 
> I came up with this to grep unique domains once, but the problem is
> that the script only runs once.
> 


I added some commentary:


> #!/usr/bin/perl -w
> 


use strict; #let Perl help you all it can
use warnings; #preferable to -w switch


> sub div() { "+","-" x 50, "+\n"; }

> 
> die "Usage: $0 emailList" if (@ARGV!=1);
> 
> open( EML, $ARGV[0] ) || die "Can't open file : $!\n";

----------------------------------------------------^^
That suppresses the line number of the error.  Usually you don't want that.

my @addys; #with strict, you need to declare variables prior to use.

my %seen;

my @users;


> 
> while(<EML>){
>   chomp;
>   push(@addys, $_) if $_ =~
> /^[a-zA-Z0-9_\.\-]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;

---------------^-^---^-----------^---------------^-^
It is not necessary to escape the indicated characters.  It makes your 
program harder to read and understand when unnecessary quoting is used.


> }
> 
> close( EML );
> 
> foreach $email( @addys ) { 

my--------^


>   @parts = split( "@", $email ); 

--------------------^-^
split takes a pattern.  It is better written as:

     my @parts = split( /@/, $email );


>   $domain = $parts[1];

my--^


>   unless( $seen{$domain} ) {
>     push( @users, $email );
>     $seen{$domain} = 1;
>   }
> }
> 
> if(@users>0){
>   print &div, "The following are uniq users per domain:\n", &div;
>   print join( "\n", sort( @users ) ), "\n", &div;
> } else {
>   print "Sorry. I could not find any email addresses.\n";
> }
> 
> 

Well, it doesn't look like you really have much of a Perl problem, just 
a minor logistics problem.  I take it you want to run the program 
multiple times, and want to have a list of email addresses, just one per 
domain, come out each time.  In order to do that you will need to save 
what remains of the list of emails each time you run your program.  It 
would be convenient to save it back to the same file, providing you 
don't need that file later.  If you don't want to destroy the file, then 
have the program copy it to a temporary file, and have the program 
automatically take from the temporary file if it exists (and delete the 
temporary file if it ends up empty).  So you will need to close the 
input file, open it again for output, and build and output to that file 
a list of the email addresses that were not output by the program on the 
current pass.  Based on the program you've already written, you should 
be able to handle that.

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: 02 May 2004 00:30:06 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: OSs with Perl installed
Message-Id: <slrnc98g8e.egl.abigail@alexandra.abigail.nl>

Matt Garrish (matthew.garrish@sympatico.ca) wrote on MMMDCCCXCVI
September MCMXCIII in <URL:news:IYEkc.54050$OU.1250454@news20.bellglobal.com>:
-:  
-: >
-: > But the point isn't whether people become unhappy if you remove Perl.
-: > It won't make Microsoft sell more copies of Windows. Your example just
-: > shows that even without including Perl in their product, people still use
-: > (and buy) Windows.  Show me a company that gives the inclusion of Perl
-: > in the OS any significant weight in the decision whether it's going to be
-: > Windows, or some non-Windows on the desktop. (Or even servers). Hands up,
-: > who installed Linux at work just because Windows doesn't have Perl?
-: >
-: >
-:  
-:  I didn't mean to imply that it does. If, however, they want to be taken
-:  seriously as an OS they have to begin adding in the tools that drive people,
-:  like yourself, to have to resort to other platforms to get their work done
-:  (and that, along with the ridiculous price tag, is what is driving people to
-:  find better solutions). Perl's inclusion alone may not make a difference,
-:  but it's absence is symptomatic of what is wrong with Windows. Do you really
-:  want Movie Maker on your workstations, or Perl?

What I want isn't relevant - Microsoft isn't targetting me. But for
anyone preferring Perl, there are 1,000 people preferring Movie Maker.
The fast majority of the computer users are just users. They aren't
programming. They have as little interest in having Perl on their
systems, as they have in having a C compiler, of Visual Basic, or
Java development tools. 

-:  If I worked for Microsoft I would be very afraid of Linux...

Ah, well, people have been saying that Linux will be a threat to
Microsoft since the mid-90s. It still hasn't happened. If I were
working for Microsoft, I wouldn't be afraid of Linux at all.
Linux is not a thread. I don't see any indication that Linux will
get a significant portion of the workstation market. 



Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT


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

Date: Sat, 1 May 2004 23:17:27 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: OSs with Perl installed
Message-Id: <6LZkc.51312$k%.1310890@news20.bellglobal.com>


"Abigail" <abigail@abigail.nl> wrote in message
news:slrnc98g8e.egl.abigail@alexandra.abigail.nl...
>
> What I want isn't relevant - Microsoft isn't targetting me. But for
> anyone preferring Perl, there are 1,000 people preferring Movie Maker.
> The fast majority of the computer users are just users. They aren't
> programming. They have as little interest in having Perl on their
> systems, as they have in having a C compiler, of Visual Basic, or
> Java development tools.
>

1,000 people who prefer Movie Maker for *personal use*. I don't believe for
a minute that Linux (or any OS I can think of) is any immediate threat to
Microsoft in that regard. As an OS in a work environment, however, Windows
is garbage. Aside from all the security holes that keep our tech support
group running around after viruses, the systems just don't work. Worse, the
so-called "mcse" people don't have a clue how to fix them. The sad reality
is their answer to everything is to re-install the system (and what choice
do you have half the time anyway, it's faster than trying to debug).
Microsoft's advantage was the difficulty of use of other operating systems
at the time, plus the notion they pushed that any idiot could maintain them
(i.e., dump your high priced unix specialists).

I'm as inclined to believe that Microsoft will survive in the business
market, however, as I was that Nortel was really on the rebound. I also
found it ridiculous that Linux was being pushed so hard as an imminent
toppler of Microsoft in the nineties when it was still in its infancy.
Microsoft isn't going to crumble and disappear any time soon, but like any
fad it's passed it's peak (notice, for instance, the trouble they're having
getting people to upgrade Office now that the only new selling points apply
to well less than 1% of users. I especially like their "Can we interest you
in a new license agreement that forces you to keep giving us money?" idea).
I expect what you'll see over the next ten years for them is where they
level off to.

Matt




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

Date: Sat, 01 May 2004 23:59:31 GMT
From: "Danny" <dannywork5@hotmail.com>
Subject: Re: problem with redirect in CGI
Message-Id: <DRWkc.77671$Gd3.19165659@news4.srv.hcvlny.cv.net>


<ctcgag@hotmail.com> wrote in message
news:20040501163917.318$0u@newsreader.com...
> "Danny" <dannywork5@hotmail.com> wrote:
> > WE are using the redirect command in the code below, I am trying to
test.
> > we are trying to post our products on the shopping sites, like
> > shopping.com, froogle, nextag etc etc.
>
> I don't understand the connection.  You want to post a URL to someone
> else's site, which when followed goes to one of your sites, then redirects
> to a different one of your sites?
>
>
> > But when we use this url as you see below as the product_url, it gives
an
> > error.  But if you copy and paste it into the url it will work.  ODD.
So
> > I tried to do a redirect from my cgi directory and use this cgi script
as
> > the product url for these sites.
>
> What do you mean "use this cgi script as the product url"?  I can only
> assume "this" cgi is the one you posted below, and that obviously is not
> the product cgi.
>
> > But it does not work.
> > How can I some how make it go to my website and act as if the
product_url
> > is being called  from my website
>
> That doesn't make much sense.  You build a vault, and then complain that
> other people can't get into it?
>
> > PS. the url works in some sites like froogle.
> > the error comes from our product.cgi saying "cannot create session"
> > I know the problem in there, but how can we make this work?
>
> If the problem is in product.cgi, then why don't you show us product.cgi?
>
> <snip code that apparently *does* work.>
>
> Xho
>
> -- 
> -------------------- http://NewsReader.Com/ --------------------
> Usenet Newsgroup Service                        $9.95/Month 30GB

Thanks for your response.
you know how you can submit a datafeed to froogle, shopping.com, nextag etc
and they will list all of your products?
that is what I am trying to do.  Their requrements are name, description,
price, thumbnail url and of course - product url.

My product pages are dynamic in that the product pages are genereated from a
cgi script which we do not have access to, it is a primitive shopping cart.
So I got it to work for froogle, but others cause an error when the landing
page is met.  "cannot create session" which is generated from my shopping
cart cgi.  For some reason, it does not like the redirect from these
shopping sites and I have no idea why.  (the cart tech support is
terrible!!).

Since I could not send to a static page anywhere on the site, I figured cgi
would help me and it has.
I call the cgi script on my page, it spits out a basic page with just a
header and with the <META HTTP-EQUIV=REFRESH CONTENT command to redirect to
this url that has a call to the cgi script.  This works because I assume the
page is being viewed on my webserver and the call to the url is coming from
my site.
The cgi redirect command does not work, and the command from Purl Guru
(print location from thread above) did not work. I am assuming because this
does such a quick redirect.

I am no perl expert, but I think I understand.

Do I make sense?

Thanks for your help




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

Date: Sat, 1 May 2004 20:08:09 -0500
From: "Jerry Preston" <g-preston1@ti.com>
Subject: Re: reducing a regex
Message-Id: <c71hm1$qfj$1@home.itg.ti.com>

What I what to pull out is the 12 items from the following:


/\+:\s+(\w+)\s+:\s+(\w+)\s+(\w+)\s+(\w+)\s+:\s+(\d)-(\d+)-(\d+)\s+:\s+=\s+(\
d+)\s+(\w+)\s+(\w+)\s+\[\s+(-?\d+.\d+),\s+(-?\d+.\d+)/;
# +:          word    :     word      word      word    :       x  -
xxxxxxx-xx   : =           x         word      word     [       x.xxx,
xx.xxx ]
#               $1               $2          $3         $4              $5
$6     $7                      $8        $9         $10                 $11
$12

Sorry for making this harder then it need to be.  I hope this helps.

Jerry



"Jerry Preston" <g-preston1@ti.com> wrote in message
news:c6v7qq$ons$1@home.itg.ti.com...
> Sorry!
>
> Basically I am looking a line with the following:
>
>
>
> +: word : word word word : x-xxxxxxx-xx : = x word word [ x.xxx, xx.xx ]
>
> Word can be any text with or with out numbers.
>
> X are number only.
>
> Jerry
>
> "Jerry Preston" <g-preston1@ti.com> wrote in message
> news:c6v4q9$m7j$1@home.itg.ti.com...
> > Hi!
> >
> > I am trying to figure out how to reduce or simplify the following:
> >
> >
> >
>
/\+:\s+(\w+)\s+:\s+(\w+)\s+(\w+)\s+(\w+)\s+:\s+(\d)-(\d+)-(\d+)\s+:\s+=\s+(\
> > d+)\s+(\w+)\s+(\w+)\s+\[\s+(-?\d+.\d+),\s+(-?\d+.\d+)/;
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Jerry
> >
> >
>
>




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

Date: Sun, 02 May 2004 02:02:30 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reducing a regex
Message-Id: <x7y8obzivd.fsf@mail.sysarch.com>

>>>>> "JP" == Jerry Preston <g-preston1@ti.com> writes:

  JP> What I what to pull out is the 12 items from the following:
  JP> /\+:\s+(\w+)\s+:\s+(\w+)\s+(\w+)\s+(\w+)\s+:\s+(\d)-(\d+)-(\d+)\s+:\s+=\s+(\
  JP> d+)\s+(\w+)\s+(\w+)\s+\[\s+(-?\d+.\d+),\s+(-?\d+.\d+)/;
  JP> # +:          word    :     word      word      word    :       x  -
  JP> xxxxxxx-xx   : =           x         word      word     [       x.xxx,
  JP> xx.xxx ]
  JP> #               $1               $2          $3         $4              $5
  JP> $6     $7                      $8        $9         $10                 $11
  JP> $12

  JP> Sorry for making this harder then it need to be.  I hope this helps.

that isn't much better then just the plain regex. i can tell you want
words and : and such from reading the regex. a spec tell you what the
input data is and why you need to parse it. 

and the $1 stuff is useless as we can count.

converting it to /x style would be a great first step. 

a good second step would be to use anno's and my simplification to a
single grab with /g. it looks like that is all you really need for that
string. and you just store it in an array instead of 12 $1 style
vars. in fact you never want to have so many $1 vars around as it can
get annoying.

so what is this input string? why do you need those fields? specify it
in english and not with 'word : ' stuff.

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: 02 May 2004 00:33:50 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regex question ...
Message-Id: <slrnc98gfe.egl.abigail@alexandra.abigail.nl>

JK (jhalbrook@bjc.org) wrote on MMMDCCCXCVI September MCMXCIII in
<URL:news:1097q608hqj454c@corp.supernews.com>:
<>  I'm trying to convert URLs in text strings to hyperlinks.  My script:

use Regexp::Common;

$string =~ s!$RE{URI}{HTTP}{-keep}!<a href = "$1">$1</a>!g;
print $string;


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


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

Date: 1 May 2004 19:29:30 -0700
From: dbsx@yahoo.com (Don Stock)
Subject: single-byte values
Message-Id: <8cf7ae36.0405011829.35ae482e@posting.google.com>

here's an interesting problem I had today.  I wrote a perl script to
compare two binary files byte-by-byte, ignoring certain offsets that
contain timestamps and such.  So I did this:

    # error if not 2 args or files don't exist or the args reference 
    # the same file
    ...

    open IN1,$ARGV[0] or die "can't open ",$ARGV[0],"\n"; binmode IN1;
    open IN2,$ARGV[1] or die "can't open ",$ARGV[1],"\n"; binmode IN2;
    for(;;$offset++){

        # get 1 byte from each file
        $len1 = read IN1,$a,1;
        $len2 = read IN2,$b,1;

        # error if either of the reads had an error
        ...

        last if !$len1;

        # next if ignoring this offset
        ...

        # if mismatch
        if ($a != $b) {die "*** mismatch\n"}
    }
    print "match\n";

the files always matched, even though they were different in places
that weren't being ignored.  Those in the know will see immediately
why the above didn't work.  I was stumped.  I tried all sorts of
things until I realized that my nice single-byte values were
string-types to perl, the problem of course being that perl converts a
string to a number by taking the value indicated by any initial ascii
digits.  If there aren't any initial ascii digits, the value is 0. 
Replacing "!=" with "ne" fixed it, and so did "if (ord $a != ord $b)
 ...".

I think my c instincts got in my way here.  I was thinking of the
single-byte values as characters in the c sense, and thus
interchangeable with integers.  In c one can say this:

    int x = 'a';
    printf ("%d\n",x);

        ==> output is 97

but in perl the effect is quite different:

    $x = 'a';
    printf "%d\n",$x;

        ==> output is 0 because 'a' has no leading digits

in this case it's ord to the rescue:

    $x = 'a';
    printf "%d\n",ord $x;

        ==> output is 97

the ord function returns the first byte in the string as a numeric
type.   Which gives us this result:

        num   str
        ---   ---
$x      0     'a'
ord $x  97    '97'

97 and 'a' have the same bit pattern, but that bit pattern has changed
its type.

to convert all bytes in the string $str to a list of numbers (one byte
per number), use this:

	@nums = unpack('C*',$str);

anyway, there are two morals here.  The first is that perl doesn't
have character types; perl has string types and numeric types and
that's it.  The second is that when read reads something, it's a
string type, not a numeric type (which is obvious when reading 500
bytes, but easy to forget when reading 1).

fwiw

don


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

Date: Sun, 02 May 2004 11:31:53 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Wanted: Perl Developer
Message-Id: <2045870.cprMbQf79P@GMT-hosting-and-pickle-farming>

Wrong place - http://jobs.perl.org/ is where everyone looks

gtoomey


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

Date: Sat, 01 May 2004 21:10:30 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Wanted: Perl Developer
Message-Id: <40945897$0$208$58c7af7e@news.kabelfoon.nl>

Gregory Toomey wrote:

> Wrong place - http://jobs.perl.org/ is where everyone looks

Can you (or someone else) recommend other sites that are good places to 
look for projects (freelance)? (Not the $5 for 100+ hours bidding sites)

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/


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

Date: Sun, 02 May 2004 00:31:44 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Why doesn't this work?
Message-Id: <QjXkc.14329$sK3.897@nwrddc03.gnilink.net>

David Wheat wrote:
> Sherm Pendley wrote:
>> Google is nice, but did you try looking on your own computer?
>>
>> perldoc LWP
>> perldoc LWP::Simple
>> perldoc lwpcook
>
> I have no way to access that.

And why not? As far as I am aware LWP is a standard module in all recent
Perl versions.
Is your Perl installation broken? Then you may want to re-install or kick
you admin until he fixes the broken installation.

> It seems like the LWP is not installed on my host.

What does the software that is installed or not installed on your host have
to do with the documentation that you can access on your own computer?

jue




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

Date: Sun, 02 May 2004 02:16:41 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Why doesn't this work?
Message-Id: <409458F3.8020500@rochester.rr.com>

David Grey wrote:

 ...
>>>#!/usr/bin/perl
>>>
>>>use File::Copy;
>>>
>>>$tempfile = "http://www.domain.com/temp.txt";
>>>copy($tempfile,"temp2.txt");
>>>
 ...


> 
> I don't think I would want to POST I think I would want to GET,
> and then it did not have any copy examples. Can someone give
> me a hint on this as well? I assume the  use File::Copy;  will not
> work as pointed out.


[code below is all one line, change shell quoting if not on Windoze]:

perl -MLWP::Simple -e "getprint 'http://bwalton.com/'">temp2.txt

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Sun, 02 May 2004 02:52:56 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Why doesn't this work?
Message-Id: <coZkc.11855$I%1.952968@attbi_s51>

David Wheat wrote:

> Sherm Pendley wrote:
>>Google is nice, but did you try looking on your own computer?
>>
>>perldoc LWP
>>perldoc LWP::Simple
>>perldoc lwpcook
> 
> I have no way to access that.

Sure you do.
   linux% perldoc LWP
   C:\> perldoc LWP

> It seems like the LWP is not installed on my host.

It's better to run LWP on the computer that is connected to your
keyboard, not some remote host.

http://aspn.activestate.com/ASPN/docs/ActivePerl/install.html

	-Joe


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

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


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