[22410] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4631 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 26 21:06:01 2003

Date: Wed, 26 Feb 2003 18:05:06 -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           Wed, 26 Feb 2003     Volume: 10 Number: 4631

Today's topics:
    Re: Delete a single leading space from a line <spam@thecouch.homeip.net>
    Re: editting photos on the fly <kkeller-mmmspam@wombat.san-francisco.ca.us>
    Re: Feedback request: photobrowser <krahnj@acm.org>
    Re: geting premature end of script header error <urzaserra@home.com>
    Re: geting premature end of script header error <urzaserra@home.com>
    Re: geting premature end of script header error <ajglist@izzy.net>
        getting prmature end of script headers <urzaserra@home.com>
    Re: getting prmature end of script headers (Tad McClellan)
    Re: getting prmature end of script headers (Jay Tilton)
        HELP- How can  i use proxy service for port 80 as clien (Sade Bhat Kalasabail)
    Re: HELP- How can  i use proxy service for port 80 as c <tony_curtis32@yahoo.com>
    Re: Multi-select boxes - how do I grab all the inputs? <wsegrave@mindspring.com>
    Re: Passing 2D arrays? <trh411@earthlink.net>
        Perl on Win32 - useful ideas? (Mark Holloway)
    Re: Perl on Win32 - useful ideas? <jkeen@concentric.net>
    Re: remove unwanted characters <ajglist@izzy.net>
    Re: scan text to find hyperlinks ? <jkeen@concentric.net>
    Re: scan text to find hyperlinks ? <ericosman-nospam@rcn.com>
    Re: scan text to find hyperlinks ? (Sam Holden)
    Re: Silencing Default Error Output of getopts <krahnj@acm.org>
        sort, uniq -c (david)
    Re: splitting <mgjv@tradingpost.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Feb 2003 18:51:56 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Delete a single leading space from a line
Message-Id: <Bqc7a.66142$or1.742921@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

crivers wrote:
> If I have a string that contains more than one leading space,
> how can I delete only the first space and keep the remaining spaces?
> The regular expression below deletes all leading spaces:
> 
> $str =~ s/^\s//;

No it doesn't.

$str = '     Hello';
$str =~ s/^\s//;
print "[$str]\n";

Produces:
[    Hello]


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+XVMheS99pGMif6wRAuV8AKCyLQZ4a+AxrVofPVXafb7L/3vKHQCeNu6u
GAqjGo/eoRuTZr+snZJ1Xm4=
=HZ6E
-----END PGP SIGNATURE-----



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

Date: Wed, 26 Feb 2003 15:07:52 -0800
From: Keith Keller <kkeller-mmmspam@wombat.san-francisco.ca.us>
Subject: Re: editting photos on the fly
Message-Id: <8chj3b.ck3.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In article <slrnb5osok.5hg.abigail@alexandra.abigail.nl>, Abigail wrote:
> 
> What's the punishment for seeing a picture of a topless person while
> you're younger than 21 in the USA?

I believe the current punishment is two hours of mandatory browsing
of http://www.whitehouse.gov/kids.  I think the ACLU is appealing
on the basis that the punishment is cruel and unusual.

- --keith

- -- 
kkeller-mmmspam@wombat.san-francisco.ca.us
(try just my userid to email me)
public key:  http://wombat.san-francisco.ca.us/kkeller/kkeller.asc
alt.os.linux.slackware FAQ:  http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj5dSMYACgkQhVcNCxZ5ID+oLACgmHgDxg+1U5oaOCHXTrrlznn5
OFgAoI1kxjFWFWMN+ePalyH8zTyc5kZF
=k+8Z
-----END PGP SIGNATURE-----


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

Date: Wed, 26 Feb 2003 23:52:48 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Feedback request: photobrowser
Message-Id: <3E5D5336.72524D81@acm.org>

"Tassilo v. Parseval" wrote:
> 
> Also sprach A. Sinan Unur:
> >
> > my $photos_per_row
> >  = scalar grep { /^URL\d+$/i } $template->query (loop => 'PHOTO_LIST');
> 
> You can even drop the scalar() here, although it does no harm.
> 
> > my @loop_data;
> > do {
> >       my $counter = 0;
> >       my $iter_data = {};
> >       foreach my $file (@files) {
> 
> I would change the foreach to a while-loop:
> 
>     opendir PHOTO_DIR, $photo_path) || bail_out($photo_path);
>     while (<PHOTODIR>) {

This won't work because the directory handle name is spelled incorrectly
and, more importantly, <> doesn't work on directory handles, just file
handles.

      while ( definded( $_ = readdir PHOTO_DIR ) ) {


>         # directory entry now in $_
>         next if /^\.+/ || ! /^.jpe?g$/i;



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 26 Feb 2003 23:11:00 GMT
From: "matt" <urzaserra@home.com>
Subject: Re: geting premature end of script header error
Message-Id: <8Qb7a.1211$Pa.110434@news2.west.cox.net>


"matt" <urzaserra@home.com> wrote in message
news:usb7a.1094$Pa.104775@news2.west.cox.net...
> I just got this perl cgi program that is a web based database searcher and
> editor but i am getting the premature end of script header errors.
>
> http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.cgi
>
> I am very new to perl and cant see why this is happening.
>
>

Soryy this link is the url to the script which is running it.  The corrected
link is

http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.txt





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

Date: Wed, 26 Feb 2003 23:30:24 GMT
From: "matt" <urzaserra@home.com>
Subject: Re: geting premature end of script header error
Message-Id: <k6c7a.1331$Pa.116021@news2.west.cox.net>


"matt" <urzaserra@home.com> wrote in message
news:8Qb7a.1211$Pa.110434@news2.west.cox.net...
>
> "matt" <urzaserra@home.com> wrote in message
> news:usb7a.1094$Pa.104775@news2.west.cox.net...
> > I just got this perl cgi program that is a web based database searcher
and
> > editor but i am getting the premature end of script header errors.
> >
> > http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.cgi
> >
> > I am very new to perl and cant see why this is happening.
> >
> >
>
> Soryy this link is the url to the script which is running it.  The
corrected
> link is
>
> http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.txt
>
>
>


Ignore this thread i will repost with the full code





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

Date: Wed, 26 Feb 2003 23:47:06 GMT
From: Alan Gutierrez <ajglist@izzy.net>
Subject: Re: geting premature end of script header error
Message-Id: <slrnb5qlk7.gai.ajglist@izzy.net>

In article <k6c7a.1331$Pa.116021@news2.west.cox.net>, matt wrote:
> 
> "matt" <urzaserra@home.com> wrote in message
> news:8Qb7a.1211$Pa.110434@news2.west.cox.net...
>>
>> "matt" <urzaserra@home.com> wrote in message
>> news:usb7a.1094$Pa.104775@news2.west.cox.net...
>> > I just got this perl cgi program that is a web based database
>> > searcher and editor but i am getting the premature end of
>> > script header errors.
>> >
>> > http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.cgi

>> http://www.onlinewebpromotion.com/cgi-bin/dbrowser/search.txt

> Ignore this thread i will repost with the full code

How about we ignore that too? Is that okay? Is it okay if we ignore
the full code without a specific question.

Anxiously awaiting futher instruction.

-- 
Alan Gutierrez - ajglist@izzy.net
http://khtml-win32.sourceforge.net/ - KHTML on Windows


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

Date: Wed, 26 Feb 2003 23:35:02 GMT
From: "matt" <urzaserra@home.com>
Subject: getting prmature end of script headers
Message-Id: <Gac7a.1359$Pa.117742@news2.west.cox.net>

I just got this perl cgi program that is a web based database searcher and
editor but i am getting the premature end of script header errors.

#!/usr/local/bin/perl

package DBBROWSER;
use DBBROWSER;
use strict;
use vars qw ($db $order_by_input);

#######################################################################

  # Parse Form Contents
  &parse_form;

  # Connect to the Database
  &connectdb;

  &get_active_tables;

  if (defined($FORM{dbb_db})) {
    $db = $FORM{dbb_db};
  }
  else {
    $db = $default_table;
  }


  my $action;
  if ($FORM{dbb_order_by}) {
    my ($search_query, $ntuples) = &search;
    &return_results($search_query, $ntuples);
  } elsif ($FORM{dbb_action}) {
    $action = $FORM{dbb_action};
    if ($action eq 'form') {
      &return_form;
    }
    elsif ($action eq 'search') {
      my ($search_query, $ntuples) = &search;
      if (($ntuples == 1) && ($edit_enabled)) {
        my @tuple = $search_query->fetchrow;
        my $oid = shift(@tuple);
        print "Location:
edit.cgi?dbb_action=edit&dbb_db=$db&dbb_oid=$oid\n\n";
      } else {
        &return_results($search_query, $ntuples);
      }
    }
    else {
      &usrerror('action');
    }
  }
  else {
    $action = "form";
    &return_form;
  }

  &disconnectdb();
  exit;

# This subroutine searches for tuples in a table based on the search terms
entered
# by the user.
sub search {

  my ($query, $nfields) = &get_cols($db);

  my ($sql_statement);

  if ($MYSQL) {
    my $primary_key_field = &mysql_get_pri_key($db);
    $sql_statement = "select $db.$primary_key_field, ";
  } else {
    $sql_statement = "select $db.$DBROWIDNAME, ";
  }
  my $first;
  if ($FORM{dbb_which}) {
    my @dbb_which = &form_list_to_array($FORM{dbb_which});
    my $dbb_which_list = join(',',@dbb_which);
    $order_by_input .= '<INPUT TYPE=hidden NAME=dbb_which
VALUE="'.$dbb_which_list.'">';
    my $field;
    $first = 1;
    foreach $field (@dbb_which) {
        if ($first == 1) { $first = 0; }
        else { $sql_statement .= ", "; }
      $sql_statement .= "$field";
    }
  }
  else {
    $sql_statement .= "$db.*";
  }

  $sql_statement .= " from $db";
  $first = 1;
  my $i;
  for ($i = 0; $i < $nfields; $i++) {
    my $fname = $query->{NAME}->[$i];
    if ($FORM{$fname}) {
       if ($first == 1) {
           $first = 0;
           $sql_statement .= " where (";
       }
       else {
         if (defined($FORM{dbb_bool})) {
            $sql_statement .= "$FORM{dbb_bool} ";
            $order_by_input .= '<INPUT TYPE=hidden NAME=dbb_bool
VALUE="'.$FORM{dbb_bool}.'">';
         } else {
            $sql_statement .= "and ";
         }
       }
       my $ftype = $query->{TYPE}->[$i];
       $order_by_input .= '<INPUT TYPE=hidden NAME="'.$fname.'"
VALUE="'.$FORM{$fname}.'">';
       $FORM{$fname} =~ s/'/''/g;
       if (&array_in($ftype, @ftypes_bool)) {
           $sql_statement .= "$fname = '$FORM{$fname}'";
       }
       elsif (&array_in($ftype, @ftypes_numeric)) {
           $sql_statement .= "$fname = $FORM{$fname}";
       }
       elsif (&array_in($ftype, @ftypes_text)) {
           $sql_statement .= "$fname $DBLIKENAME '%$FORM{$fname}%'";
       }
       else {
           $sql_statement .= "$fname $DBLIKENAME '%$FORM{$fname}%'";
       }
    }
  }
  if ( $first != 1 ) {
     $sql_statement .= ")";
  }

  # Have to do this without rows() function due to Oracle's incompatability
  my $count_sql;
  ($count_sql = $sql_statement) =~ s/^select .* (from .*)/select count(\*)
$1/i;

  if ($FORM{dbb_order_by}) {
    $sql_statement .= ' order by '.$FORM{dbb_order_by};
    if ($FORM{dbb_order_by_check} eq $FORM{dbb_order_by}) {
      $sql_statement .= ' DESC';
    } else {
      $sql_statement .= ' ASC';
      $order_by_input .= '<INPUT TYPE=hidden NAME=dbb_order_by_check
VALUE='.$FORM{dbb_order_by}.'>';
    }
  }

  $query = &execsql($sql_statement);
  $count_query = &execsql($count_sql);
  my ($ntuples) = $count_query->fetchrow();

  if ($ntuples < 1) {
    &usrerror('none');
  }

#  $query->finish;

  return ($query, $ntuples);
}

# This subroutine returns the results of a search
sub return_results {

  my ($query, $ntuples) = @_;

  my ($title, $header, $instruct, $html);

  $title = qq {Search Results on "$db"};

  $header .= $title;

  $FORM{dbb_bool} = 'and' if (! $FORM{dbb_bool});

  $html .= qq {<CENTER><P> };

  $html .= "Hits: <STRONG>$ntuples</STRONG> Boolean:
<STRONG>$FORM{dbb_bool}</STRONG> ";

  if ($FORM{dbb_order_by}) {
    $html .= "Order by: <strong>$FORM{dbb_order_by}</strong>";
    if ($FORM{dbb_order_by_check} eq $FORM{dbb_order_by}) {
      $html .= " (descending)";
    } else {
      $html .= " (ascending)";
    }
  }

  $html .= qq {
    <BR><font size=-1>(<I>click on the column name to sort by that field,
    again to reverse sort</I>)</font><BR>
    <FORM ACTION="search.cgi" METHOD=POST>
  };

  my @info = &data_into_form($query, $db);

  $html .= qq { @info
    <P>$order_by_input
    <INPUT TYPE=hidden NAME=dbb_db VALUE="$db">
    </FORM><P>
  };

  &print_tmpl_page(title=> $title, content=>$html, header=>$header);

}

# This subroutine returns the form used for searching.
sub return_form {

  my ($query, $nfields) = &get_cols($db);

  my ($title, $header, $instruct, $html);

  $title = qq {Search on "$db"};

  $header .= qq { <FORM ACTION="$ENV{'SCRIPT_NAME'}" METHOD=POST>
    Search on
    <SELECT NAME=dbb_db>
    <OPTION VALUE="$db" SELECTED>$db (current)
    <OPTION VALUE="">------------
  };

  foreach $table (@active_tables) {
   $header .= "<OPTION>$table</OPTION>\n";
  }

  $header .= qq { </SELECT><INPUT TYPE=submit VALUE=">"><P>
    <INPUT TYPE=hidden NAME=dbb_action VALUE=form>
    </FORM></CENTER><P>
  };

  $instruct .= qq {

    <BLOCKQUOTE><UL>
    <LI>Enter any information you know about your target below,
    or leave all fields blank for a complete list.
    <LI>Check boxes at the left to return fewer fields in the search
results.
    </BLOCKQUOTE>
  };

  $html .= qq {
    <CENTER>
    <FORM ACTION="$ENV{'SCRIPT_NAME'}" METHOD=POST>
    <INPUT TYPE=submit VALUE=Search><INPUT TYPE=reset VALUE=Reset><BR>

    <TABLE WIDTH=$tablewidth>
  };

  for ($i = 0; $i < $nfields; $i++) {
    $fname = $query->{NAME}->[$i];
    $ftype = $query->{TYPE}->[$i];
    $fprec = $query->{PRECISION}->[$i];

    if ($proper_names) {
      $printable_fname = &fancy_field_name($fname);
    } else {
      $printable_fname = $fname;
    }

    $html .= qq { <TR><TD BGCOLOR=$checkboxcolor><INPUT TYPE=checkbox
NAME=dbb_which VALUE="$fname"></TD>
      <TD ALIGN=right BGCOLOR=$fieldboxcolor><B>$printable_fname:</B></TD>
    };

    $html .= '<TD BGCOLOR="'.$databoxcolor.'">'.&create_field($fname,
$ftype, $fprec).'</TD></TR>';
  }

  $html .= qq { </TABLE>
    <INPUT TYPE=hidden NAME=dbb_action VALUE=search>
    <INPUT TYPE=hidden NAME=dbb_db VALUE="$db">
    <INPUT TYPE=radio NAME=dbb_bool VALUE=and CHECKED>Match all fields
    <INPUT TYPE=radio NAME=dbb_bool VALUE=or>Match any field<BR>
    <INPUT TYPE=submit VALUE=Search><INPUT TYPE=reset VALUE=Reset><BR>
    $order_by_input</FORM>
  };

  &print_tmpl_page(title=> $title, header=>$header,
    instruct=>$instruct, content=>$html, table=>$db);

}

# This handles errors made by the user.
sub usrerror {

  my ($error,@error_fields) = @_;

  my $html;

  my $title = 'Search Results: Error';

  if ($error eq 'action') {
    $html .= "<CENTER>You have requested an invalid action for this
script.</CENTER>\n";
  }
  elsif ($error eq 'none') {
    $html .= "<CENTER>Your search returned no results.  Please try
again.</CENTER>\n";
    $html .= "SQL: $sql_statement<P>\n";
  }

  &print_tmpl_page(title=>$title, header=>$title, content=>$html,
table=>$db);
  exit;

}





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

Date: Wed, 26 Feb 2003 19:10:37 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: getting prmature end of script headers
Message-Id: <slrnb5qpcd.6cq.tadmc@magna.augustmail.com>

matt <urzaserra@home.com> wrote:

> I just got this perl cgi program that is a 


POS


> web based database searcher and
> editor but i am getting the premature end of script header errors.


Contact the author, or hire a programmer, or learn Perl.

Or, the best alternative, delete it and look for a good one.


> use DBBROWSER;


We cannot debug code that we cannot see...



>   &parse_form;


The error might be there.


>   # Connect to the Database
>   &connectdb;


The error might be there.


>   &get_active_tables;


The error might be there.

You get the idea...


[snip ~300 lines of code]


Expecting people to debug 300 lines of incomplete code is ludicrous.

Throw that piece of crap software in the toilet where it belongs.

Flush twice.


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


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

Date: Thu, 27 Feb 2003 01:45:33 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: getting prmature end of script headers
Message-Id: <3e5d6d06.8406138@news.erols.com>

tadmc@augustmail.com (Tad McClellan) wrote:

: You get the idea...

I doubt he does.  There were signs of terminal cluelessness last time
he did this.

Speaking of which, the shebang is different this time.  Hrm...



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

Date: 26 Feb 2003 16:51:48 -0800
From: sade_bhat@yahoo.com (Sade Bhat Kalasabail)
Subject: HELP- How can  i use proxy service for port 80 as client using PERL
Message-Id: <3a621d3c.0302261651.44e185a3@posting.google.com>

'I have a client, that needs to contact a remote server on port
 80. Due to our firewall setup I am not allowed to do this
 directly, but I can utilise a proxy service for port 80. How do I
 do this, using perl?' 


Can SOME ONE HELP ME PLEASE


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

Date: Wed, 26 Feb 2003 18:53:17 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: HELP- How can  i use proxy service for port 80 as client using PERL
Message-Id: <87r89ufssi.fsf@limey.hpcc.uh.edu>

>> On 26 Feb 2003 16:51:48 -0800,
>> sade_bhat@yahoo.com (Sade Bhat Kalasabail) said:

> 'I have a client, that needs to contact a remote server
> on port 80. Due to our firewall setup I am not allowed
> to do this directly, but I can utilise a proxy service
> for port 80. How do I do this, using perl?'
> Can SOME ONE HELP ME PLEASE
      (argh, don't shout!)

perldoc lwpcook

hth
t


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

Date: Wed, 26 Feb 2003 17:36:26 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Multi-select boxes - how do I grab all the inputs?
Message-Id: <b3jj9m$urs$1@slb9.atl.mindspring.net>

"B.P." <brian2310@hotmail.com> wrote in message
news:e47bf7fd.0302261158.43d559f5@posting.google.com...
> Help!
>
> I'm using a multi-select box and then sending it to variable, using
> post, but it only picks up the *first* selection.  How can I send it
> to an array or something else and get *all* of the inputs selected?
> I'm using the regular old "$MyVar = $query->param('TheVar')" to get
> the varables from a submitted form.

CGI.pm captures all of the values for you, e.g.,

my $words = join(", ", param('words'));

creates a comma-sep list of all of the values, while

my $words = param('words');

only gives you the first value.

See "A Simple Example" in the CGI.pm documentation for details.

BTW, I hope you're using CGI.pm's shortcuts to generate the (HTML) code for
the checkbox_group.

Cheers.

Bill Segraves






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

Date: Thu, 27 Feb 2003 00:48:37 GMT
From: "Tom Hoffmann" <trh411@earthlink.net>
Subject: Re: Passing 2D arrays?
Message-Id: <pan.2003.02.27.00.48.23.222869@earthlink.net>

On Wed, 26 Feb 2003 04:40:36 +0000, Uri Guttman wrote:

>>>>>> "TH" == Tom Hoffmann <trh411@earthlink.net> writes:
> 
>   TH> On Tue, 25 Feb 2003 15:50:30 +0000, Joe Creaney wrote:
>   >> I am writing a simple role playing game in PERL.  I would like to
>   >> know if I can pass 2 demential array to functions using references.
>   >>  If it is possible how do I do it?
> 
>   TH> Sure, just pass a reference to the array to the subroutine, and in
>   the TH> subroutine use:
> 
>   TH> $array_ref->[i][j] to refernce the elements

Opps, of course, that should have been $array_ref->[$i][$j]


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

Date: 26 Feb 2003 15:17:32 -0800
From: groups@markholloway.com (Mark Holloway)
Subject: Perl on Win32 - useful ideas?
Message-Id: <7d391cb3.0302261517.358996b0@posting.google.com>

I'm a network engineer and mostly work with routers, switches, vpn,
firewall, and so on.  I do very little Windows/Unix work.  I thought
about running an application that will download my Cisco
configurations automatically, but maybe it would be better to write
Perl scripts because my equipment is a mix of Foundry (LAN), Cisco
(WAN, Firewall), Nortel (VPN).  I don't think there is one single app
that can do this.  Besides, it would be challenging for me to do this
on my own.  It would have to be on Win32 though.  Does this sound
reasonable?

Regards,
Mark


BTW, I'm not a Perl expert.  I'd have to learn. *sigh*  but would be
very rewarding I think! :)


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

Date: 26 Feb 2003 23:24:41 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Perl on Win32 - useful ideas?
Message-Id: <b3jibp$dh5@dispatch.concentric.net>


"Mark Holloway" <groups@markholloway.com> wrote in message
news:7d391cb3.0302261517.358996b0@posting.google.com...
> I'm a network engineer and mostly work with routers, switches, vpn,
> firewall, and so on.  I do very little Windows/Unix work.  I thought
> about running an application that will download my Cisco
> configurations automatically, but maybe it would be better to write
> Perl scripts because my equipment is a mix of Foundry (LAN), Cisco
> (WAN, Firewall), Nortel (VPN).  I don't think there is one single app
> that can do this.  Besides, it would be challenging for me to do this
> on my own.  It would have to be on Win32 though.  Does this sound
> reasonable?
>
Yes.  You could use the ActiveState version of Perl for Windows.
ActiveState also hosts many mailing lists, some of which are specific to
Perl on Win32.
http://www.activestate.com/Products/ActivePerl/

> Regards,
> Mark
>
>
> BTW, I'm not a Perl expert.  I'd have to learn.

Yes.

> *sigh*  but would be
> very rewarding I think! :)

Yes.




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

Date: Wed, 26 Feb 2003 23:23:23 GMT
From: Alan Gutierrez <ajglist@izzy.net>
Subject: Re: remove unwanted characters
Message-Id: <slrnb5qk7o.ga5.ajglist@izzy.net>

In article <x77kbmhllh.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>> "AG" == Alan Gutierrez <ajglist@izzy.net> writes:
> 
>  AG> In article <3E5D149F.99A9B677@tamu.edu>, Bing Du Test wrote:
>  >> We need to use Perl to process files transferred from Windows machines
>  >> to UNIX.  Sometimes, ^M is appended at the end of each line when a PC
>  >> file arrives on Unix.
> 
>  >> Just wondering if there is anyway to remove all the ^M's?
> 
>  AG> Remove carrage returns:
> 
>  AG> s/\r//;
> 
> that removes only one \r.
> 
>  AG> If the files are dos files you could set the input line separator:
> 
>  AG> $/ = '\r\n';
> 
> that won't work as you used single quotes.

Humiliating. Utterly humiliating.

-- 
Alan Gutierrez - ajglist@izzy.net
http://khtml-win32.sourceforge.net/ - KHTML on Windows


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

Date: 26 Feb 2003 23:30:09 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: scan text to find hyperlinks ?
Message-Id: <b3jim1$f71@dispatch.concentric.net>


"Eric Osman" <ericosman-nospam@rcn.com> wrote in message
news:3E5D4299.6070305@rcn.com...
>
> You've probably noticed how if text contains something looking like
> a hyperlink, alot of applications will display a HOT SPOT on the
> link, even though the text doesn't explicitly contain an html ANCHOR
> tag around the hyperlink.
>
>
>
> Well, suppose I want my perl script to scan some text lines, FINDING
> such hyperlink-looking things, so that I can make them a hot spot
> (presumably by putting an html ANCHOR tag around them) .
>
> In other words, I want my perl script to identify things that look
> like hyperlinks in text.
>
> For finding the hyperlink-looking things in the text, which of these
> would you suggest:
>
> o Write it myself using some sort of regular expression
> concoction.
>
> o Use the such-and-such well-known existing perl package to
> do it (which one ????)
>
First, check out Perl modules such as HTML::Filter, HTML::Parser, etc.
These may have come with your Perl distribution, in which case you can get
their documentation by typing 'perldoc HTML::Filter'.  Or go to
search.cpan.org




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

Date: Wed, 26 Feb 2003 18:46:04 -0500
From: Eric Osman <ericosman-nospam@rcn.com>
Subject: Re: scan text to find hyperlinks ?
Message-Id: <3E5D51BC.6030903@rcn.com>



But what I want to do is scan non-html text and identify parts of
the text that LOOK LIKE url's .

(Once I find them, I'll probably put anchor tags around them).

I looked at HTML::Parser that you suggested, but that package seems
to parse html code, and my input is not html code.

Thanks.

/Eric

>>For finding the hyperlink-looking things in the text, which of these
>>would you suggest:
>>
>>o Write it myself using some sort of regular expression
>>concoction.
>>
>>o Use the such-and-such well-known existing perl package to
>>do it (which one ????)
>>
> 
> First, check out Perl modules such as HTML::Filter, HTML::Parser, etc.



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

Date: 27 Feb 2003 00:03:10 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: scan text to find hyperlinks ?
Message-Id: <slrnb5qldu.ghp.sholden@flexal.cs.usyd.edu.au>

On Wed, 26 Feb 2003 18:46:04 -0500, Eric Osman <ericosman-nospam@rcn.com> wrote:
> 
> 
> But what I want to do is scan non-html text and identify parts of
> the text that LOOK LIKE url's .
> 
> (Once I find them, I'll probably put anchor tags around them).
> 
> I looked at HTML::Parser that you suggested, but that package seems
> to parse html code, and my input is not html code.

The Regexp::Common module provides an appropriate pattern:

use Regexp::Common qw /URI/;

provides $RE{URI}{HTTP} which matches http URIs.

You could use something like (completely untested) :

s#$RE{URI}{HTTP}{-keep}#<a href="$1">$1</a>#g;

Though you will have to escape &s in the query string component of
the URL (to &amp;) if you want it to be vaguely correct.

Also please don't top post.

[snip quoted text]

-- 
Sam Holden



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

Date: Thu, 27 Feb 2003 00:02:02 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Silencing Default Error Output of getopts
Message-Id: <3E5D5561.A47A2390@acm.org>

Spero wrote:
> 
> "Alan Barclay" <gorilla@elaine.furryape.com> wrote in message
> >
> > $SIG{'__WARN__'} = sub {
> >         print "My error\n";
> > };
> >
> > use Getopt::Std;
> >
> > getopts('hf:');
> 
> That's perfect, thank-you Alan. Why does it require the extra semi colon? It
> seems unusual.

You could write it without the "extra" semicolon.

$SIG{'__WARN__'} = sub {
        print "My error\n"
};


John
-- 
use Perl;
program
fulfillment


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

Date: 26 Feb 2003 17:58:28 -0800
From: dwlepage@yahoo.com (david)
Subject: sort, uniq -c
Message-Id: <b09a22ae.0302261758.2a869007@posting.google.com>

I have a list of data in the format of:

group <tab> dept <tab> group2 <tab> dept2

(The tabs donate a tab in the datafile).
What I want to do is something like sort and uniq -c, I want to sort
the data and only print the unique lines. For each unique line, I want
to know the number of other lines like it. I have accomplished the
same thing with AWK and sort,uniq, but would like to be able to do
this in perl. What would be the best way to do this?

Thanks,


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

Date: Wed, 26 Feb 2003 23:18:48 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: splitting
Message-Id: <slrnb5qiqo.ufd.mgjv@verbruggen.comdyn.com.au>

On Wed, 26 Feb 2003 23:59:13 +0100,
	Johannes Fürnkranz <johannes.fuernkranz@t-online.de> wrote:
> Martien Verbruggen wrote:
>> On Wed, 26 Feb 2003 23:41:17 +0100,
>> 	Johannes Fürnkranz <johannes.fuernkranz@t-online.de> wrote:
>> 
>>>I want to split a line on commas, but only if they are not preceded by a 
>>>backslash.
>> 
>> 
>> my @fields = split /(?<!\\),/, $line;
>> 
>> See the perlre documentation for the zero-width negative look-behind
>> assertion.
> 
> Apologies, I should have checked. I was absolutely certain that there is 
> only look-ahead...

I didn't mean that as a reproach, but simply as a pointer to more
information. This extended pattern, and many of the others are obscure
enough for most people to not have them in their standard toolkit.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | Can't say that it is, 'cause it ain't.
                        | 


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

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


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