[10007] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3600 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 31 20:06:17 1998

Date: Mon, 31 Aug 98 17:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 31 Aug 1998     Volume: 8 Number: 3600

Today's topics:
    Re: Algorithm help...math and perl... <jdw@dev.tivoli.com>
    Re: Better Regular Expressions (was: Re: Imagine... a n (Abigail)
    Re: Better Regular Expressions (was: Re: Imagine... a n <rootbeer@teleport.com>
        Carrage Returns in a Array Removal (Robert Saunders)
    Re: DeCrypt ? (Abigail)
    Re: DeCrypt ? <jdw@dev.tivoli.com>
    Re: DESTROY problems <rootbeer@teleport.com>
    Re: GD.pm <eashton@bbnplanet.com>
    Re: Hats off to Tom Phoenix <eashton@bbnplanet.com>
        HELP!!! pls <meenu@ms.washington.edu>
    Re: HELP!!! pls <rootbeer@teleport.com>
        How to splice in XSUB <thomas@x-tekcorp.com>
    Re: Installation Problem on redhat linux <eashton@bbnplanet.com>
        No switch statement in Perl?? spiegler@cs.uri.edu
    Re: No switch statement in Perl?? <rootbeer@teleport.com>
    Re: Perl and apache <siberian@siberian.org>
    Re: Perl Cookbook, does anyone have it? <tchrist@mox.perl.com>
        Perl Module for URL hiding <siberian@siberian.org>
    Re: Perl Module for URL hiding <rootbeer@teleport.com>
    Re: Perl Module for URL hiding <sneaker@sneex.fccj.org>
    Re: perl program for inews <rootbeer@teleport.com>
    Re: ReadParse/newline character ?? <rootbeer@teleport.com>
    Re: ReadParse/newline character ?? (Sam Holden)
        secure STDOUT and STDERR with user params <nonspammers.start.after.this.period.hot_redox@hotmail.com>
    Re: secure STDOUT and STDERR with user params <rootbeer@teleport.com>
    Re: Setting the ENVironment in perl (HP-UX 10.20)? (Mark-Jason Dominus)
    Re: unlinking file if <= 1 hour <rootbeer@teleport.com>
        Using a literal #sign? <104045.3064@CompuServe.COM>
    Re: Using a literal #sign? <rootbeer@teleport.com>
    Re: what's wrong with this statement? (C. Abney)
        Win32 Local Path Info <randerso@ix.netcom.com>
    Re: Y2K Date Support (I R A Aggie)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 31 Aug 1998 16:12:27 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Algorithm help...math and perl...
Message-Id: <obn28k97pg.fsf@alder.dev.tivoli.com>


"Tomsic, Paul" <ptomsic@pitt.edu> writes:
> I'm trying to make a program that will take a directory of files (on NT)
> and assemble them in order, so I'm thinking about appending a letter on to
> the end of each file, such that
> file1_a, file2_b, file3_c,...,file27_aa, file28_bb, etc.
> 
> That way the directory would be in order.  NT orders such that the files
> would be
> 1,10,100,2,20,200,3,30,300 which is no good.

I don't really see a difference here, as the ordering will be:

a,aa,b,bb,...,z,zz where z should be before aa (26 < 27), but instead
will be later...

so you'll probably have to start with aaa, but that could just as
easily be 000, 001, 002, ...



Also, your algorithm is already built into the autoincrement operator,
see perlop and the section on Auto-increment.

notice:

$letter = "z";
$letter++;
print "$letter\n";
__END__
aa

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: 31 Aug 1998 23:18:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Better Regular Expressions (was: Re: Imagine... a non-greedy   world!)
Message-Id: <6sfavh$lhp$1@client3.news.psi.net>

Tom Phoenix (rootbeer@teleport.com) wrote on MDCCCXXVI September MCMXCIII
in <URL: news:Pine.GSO.4.02A.9808311537400.24074-100000@user2.teleport.com>:
++ On Sun, 30 Aug 1998, John Porter wrote:
++ 
++ > In fact, it appears that the "something better" is going
++ > to be XML.  And parsing XML is essentially equivalent to
++ > parsing HTML.  
++ 
++ Naw. Parsing XML is _much_ simpler than parsing HTML, since you don't have
++ to worry about how to parse bogus code. Cheers!


Parsing XML vs parsing HTML.... that's like parsing BNF vs parsing C.

Perhaps you mean "parsing documents written in a language who have an
XML declaration" vs "parsing documents written in HTML". Yes, the former 
is easier than the latter, even without taking bogus code into account.
That was one of the design principles of XML. XML was written such that
document parsers do not need knowledge of the DTD. HTML parsers do.
XML doesn't have the equivalent of the SGML SHORTTAG feature either -
which is set to YES for HTML unfortunally.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-


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

Date: Mon, 31 Aug 1998 22:43:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Better Regular Expressions (was: Re: Imagine... a non-greedy   world!)
Message-Id: <Pine.GSO.4.02A.9808311537400.24074-100000@user2.teleport.com>

On Sun, 30 Aug 1998, John Porter wrote:

> In fact, it appears that the "something better" is going
> to be XML.  And parsing XML is essentially equivalent to
> parsing HTML.  

Naw. Parsing XML is _much_ simpler than parsing HTML, since you don't have
to worry about how to parse bogus code. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 23:36:58 GMT
From: robert@iminet.com (Robert Saunders)
Subject: Carrage Returns in a Array Removal
Message-Id: <DB59A203326BF209.B8672E4F938BC4D2.54A1346CAD315929@library-proxy.airnews.net>



I have a program that takes the data in a form and writes to a flat
file.. Each line of the flat file is a different record.. or
question.. I didnt have any problems do this with the <input
type=text> inputs.. but I have a couple of textarea fields with
several rows of data.. I would still like it to save that data to one
line without a carrage return so I can read it in as just another
record.. 

My question.. is there a way to take out carrage returns with a split
function or something before I write the file.. 

My Second question.. am I going about this all the wrong way.. 

Robert Saunders
robert@iminet.com

Thanks in Advance.


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

Date: 31 Aug 1998 23:26:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: DeCrypt ?
Message-Id: <6sfbfu$lhp$2@client3.news.psi.net>

Yoke Lee (yokelee@nt.com) wrote on MDCCCXXV September MCMXCIII in
<URL: news:35E96FCC.1639@nt.com>:
++ Hi folks,
++ 
++ Is there a way to decrypt a password? The perl docs did not mention
++ anything about decryption, just encryption (using the crypt function).


sub decrypt ($) {
    my $encrypted = shift;
    for my $i1 ("\x00" .. "\xFF", "") {
      for my $i2 ("\x00" .. "\xFF", "") {
        for my $i3 ("\x00" .. "\xFF", "") {
          for my $i4 ("\x00" .. "\xFF", "") {
            for my $i5 ("\x00" .. "\xFF", "") {
              for my $i6 ("\x00" .. "\xFF", "") {
                for my $i7 ("\x00" .. "\xFF", "") {
                  for my $i8 ("\x00" .. "\xFF", "") {
                    my $try = "$i1$i2$i3$i4$i5$i6$i7$i8";
                    return $try if $encrypted eq crypt $try, $encrypted;
                  }
                }
              }
            }
          }
        }
      }
    }
    return;
}



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: 31 Aug 1998 15:57:37 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: DeCrypt ?
Message-Id: <obogt098e6.fsf@alder.dev.tivoli.com>


Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:
> > Is there a way to decrypt a password? The perl docs did not mention
> > anything about decryption, just encryption (using the crypt function).
> 
> yes. a program called crack. not recommended if not root on your own

technically, crack does B<not> decrypt passwords, it simply runs crack
on lots of strings that might be passwords...

Yoke, if you want encryption and decryption, take a look at the
various Crypt modules on cpan...

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: Mon, 31 Aug 1998 22:50:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: DESTROY problems
Message-Id: <Pine.GSO.4.02A.9808311548550.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Hr. Jochen Stenzel wrote:

> By the way, I never knew that exit() sets $?. I found no hint in
> "Programming Perl" neither in the overview of special variables nor in
> the description of exit() nor in the notes about DESTROY(). Where else
> should I have made the search?

This one is mentioned in perlvar, at least. But it is a somewhat
underdocumented feature, albeit one that few ever need. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 22:25:45 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: GD.pm
Message-Id: <35EB2096.CB0416BD@bbnplanet.com>

> zactly But you gotta have a compiler. dont ya.

one would hope that if one has perl on ones system that one also has gcc
or somesuch to go with it. why ask a rhetorical question.

e.


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

Date: Mon, 31 Aug 1998 22:16:44 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Hats off to Tom Phoenix
Message-Id: <35EB1E79.7F4CC6B5@bbnplanet.com>

> And what is wrong with misanthropy ?

there is too much of it. philanthropy takes a lot less effort and youll
live longer due to less stress in your life. give generously to your
local library and give your wife and suprise bouquet of flowers. much
more fun than useless usenet flameage.
who knew?

e.


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

Date: Mon, 31 Aug 1998 16:32:49 -0700
From: Meenu <meenu@ms.washington.edu>
Subject: HELP!!! pls
Message-Id: <Pine.OSF.3.96.980831163128.28086B-100000@hilbert1.ms.washington.edu>


hey guys I wrote a script to grab the data from some search engine.. now
here comes the silly question, I'm not being able to open a file & PASTE
that data in there. Can anyone tell me how to do it

I was tryin' to do something as
  open (file, ">$data");
  print file $data;
  close (file)


 ..I know its wrong.. I just switched from good old C to perl.. so a bit
confused.. your help will be appreciated ;o)





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

Date: Mon, 31 Aug 1998 23:52:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP!!! pls
Message-Id: <Pine.GSO.4.02A.9808311650420.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Meenu wrote:

> Subject: HELP!!! pls

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

>   open (file, ">$data");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Also, it's generally better to make filehandles all upper case.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 18:32:31 -0500
From: Thomas Rock <thomas@x-tekcorp.com>
Subject: How to splice in XSUB
Message-Id: <35EB328F.1126@x-tekcorp.com>

Hi,

I'm developing a special-purpose matrix manipulation
package implemented in part with XSUB's.I manipulation
I need to perform is removing a row or column from the 
matrix. This is trivial in perl using splice, but how
can I do this with an XSUB. The only relevant functions
I can find in the docs are av_pop, av_push and av_shift.

I could rig something up using a series of shifts, pushes,
and pops, but there must be an easier way - musn't there?

Thanks

-- 
Thomas Rock

X-Tek Corporation
www.x-tekcorp.com


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

Date: Mon, 31 Aug 1998 22:22:13 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Installation Problem on redhat linux
Message-Id: <35EB1FC2.8F5FC719@bbnplanet.com>

> >I am trying to compile perl version 5.004_04.  The configure script runs fine
> >but when I type make I get the following error:
> >
> >[perl5.004_04]$ make
> >makefile:441: *** missing separator.  Stop.
> >
i had this problem with a sparc linux box...5.0 i think. recompile gmake
and you shouldn't have a problem...i like rpm except when the packages
are broken :)

> 
> Hi,
>    As well as checking for perhaps using a DOS-type makefile,
> I've also seen this error after I've edited by hand a Makfile
> and the editor silently wrapped some long lines, which confused
> make. Maybe check the makefile for such occurrences?

one word. vi

e.


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

Date: Mon, 31 Aug 1998 23:18:46 GMT
From: spiegler@cs.uri.edu
Subject: No switch statement in Perl??
Message-Id: <6sfb0m$m8e$1@nnrp1.dejanews.com>

Hi,

I cannot find a switch statement in Perl. Is there one? If not, do you know
why it was not put into the language?

Also, does Perl provide any mechanism other than if-elsif-else to deal with
this?

Thanks, Scott

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Mon, 31 Aug 1998 23:50:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: No switch statement in Perl??
Message-Id: <Pine.GSO.4.02A.9808311649520.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998 spiegler@cs.uri.edu wrote:

> Subject: No switch statement in Perl??

This is discussed in the FAQ. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 14:37:32 -0700
From: John Armstrong <siberian@siberian.org>
To: Bali <lbali@dvc.edu>
Subject: Re: Perl and apache
Message-Id: <35EB1821.351C8D46@siberian.org>

Check the Apache Documentation :

http://www.apache.org/

In short you want to use a directive like this :

AddHandler cgi-script .cgi

This treats all files ending in .cgi as cgi-scripts and determines their
type by the #!/.... line at the top ( sh, perl etc etc ).

Enjoy.
John Armstrong

Bali wrote:

> How do I get my new Unix Apache web server install to recognize perl
> extensions? Do I type something in mime.types? What?
>



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

Date: 31 Aug 1998 21:49:20 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Cookbook, does anyone have it?
Message-Id: <6sf5p0$201$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    ptimmins@netserv.unmc.edu (Patrick Timmins) writes:
:I ordered mine from Amazon last Friday (8/28/98), it shipped Saturday,
:I should be getting it today or tomorrow. I'm *very* happy about this.

I'm happy that you're happy. :-)

:Sometime early last week, it was in the double-digits on the best
:seller list (50-something or 60-something, if I recall). It's selling
:like hot-potatoes, or sliced bread, or whatever that thing is that sells
:really well.

Actaully, it's even better than that.  It was #21 on Friday over
all titles in print, not just computer titles, and is #39 today 
as of this posting.

Here's a little program that could have been in the cookbook
if I'd only written it by then. :-)

--tom

#!/usr/bin/perl -w
# amarank -- rank amazon books
# tchrist@perl.com 
# version 1.1, Mon Aug 31 06:48:06 MDT 1998

use strict;

use Getopt::Std;
use Text::Wrap qw($columns &wrap);
use HTML::FormatText;
use HTML::Parse;
use HTML::TreeBuilder;
use HTTP::Request;
use HTTP::Request::Common qw(GET POST);
use HTTP::Response;
use LWP::UserAgent;
use URI::URL;

$columns = 75;

sub UNKNOWN { 999999999 }

sub usage {
    print STDERR "$0: @_\n" if @_;
    die <<EO_USAGE
usage: $0 [-s] [-t] [-a] [-v] [-r] [-w columns] [-n count] title
   -s	    search on subject
   -t	    search on title [DEFAULT]
   -a	    search on author
   -r	    raw output only, don't rand first (faster output)
   -n num   show only the first n books
   -w cols  wrap at this many columns (DEFAULT: $columns)
   -v 	    debugging
EO_USAGE
}

$| = 1;

my(
    $browser,		# the virtual browser we'll use as user agent
    $curreq,		# the current HTTP request object
    $response,          # the current HTTP response object

    $content,		# raw HTML of 
    $which_search,       # subject, author, or title
    $form,
    $formatter,
    $his_base,
    $hitlist,
    $bookcount,
    $next_screen,
    $search_string,
    $url,

    %opts,

    %Desc,
    %ISBN_Rank,
    %ISBN_Title,
    %Seen_ISBN,
);


sub fdie   { die sprintf @_ }
sub dprint { print STDERR @_ if $opts{'v'} } 

@opts{qw!s t a!} = (0,0,0);
getopts("rstavn:w:", \%opts) || usage("argument error");

if ($opts{"w"}) {
    $columns = $opts{"w"};
} 


if ( $opts{"s"} + $opts{"t"} + $opts{"a"} > 1 ) {
    usage("only one of opts s, t, and s allowed.");
} 

$which_search = $opts{"t"} ?  'title'
	      : $opts{"s"} ?  'subject'
	      : $opts{"a"} ?  'author'
	      :               'title';

$search_string = "@ARGV" || "perl";

$url = "http://www.amazon.com/";

$browser = LWP::UserAgent->new();
$browser->agent("amarank/1.0");    

$curreq = GET($url);
$curreq->referer("http://wizard.yellowbrick.oz");  


if (($response = $browser->request($curreq))->is_error()) {
    fdie "Failed to lookup $url: %s\n", $response->status_line;
}

$his_base = $response->base;

dprint "His base is $his_base\n";

unless ($response->content =~ /Full search: <a href\s*=\s*"([^"]*)">/) {
    die "couldn't find full search\n";
}
$url = url($1, $his_base);
dprint "New url is $url\n";

$curreq = GET($url);
$curreq->referer($his_base->as_string);

if (($response = $browser->request($curreq))->is_error()) {
    fdie "Failed to lookup $url: %s\n", $response->status_line;
}

$his_base = $response->base;
dprint "base is $his_base";

die "no title search: $content" unless $response->content() =~ 
    m#Enter\s*Author.*?Title.*?(<form[^>]*?action\s*=\s*"([^"]+)".*?)</form>#is;

$form   = $1;
$url = url($2, $his_base);

dprint "Search is at $url\n";

$curreq = POST $url, [ 
    "author" 	    => $which_search eq 'author'  && $search_string,
    "author-mode"   => "full",

    "title" 	    => $which_search eq 'title'   && $search_string,
    "title-mode"    => "word",

    "subject" 	    => $which_search eq 'subject' && $search_string,
    "subject-mode"  => "word",

    "submit" => "Search Now",
];

$curreq->referer($his_base->as_string);


if (($response = $browser->request($curreq))->is_error()) {
    fdie "Failed to lookup $url: %s\n", $response->status_line;
}

$hitlist = $response->content();
dprint "base is $his_base";

while ($hitlist =~ m{
			<b> \s* 
			<a \s+ href \s* = \s*
			    " (/exec/obidos/ASIN/(\d+))/[^"]+" \s* >
			(.*?)
			</a></b>(.*)
		    }xig ) 
{
    my($bookurl, $isbn, $title, $text) = ($1,$2,$3,$4);

    next if $Seen_ISBN{$isbn}++;  # top few are dups

    $bookcount++;
    last if $opts{'n'} && $bookcount > $opts{'n'};

    for ($title) {
	s/&amp;/&/g;
	s/&lt;/</g;
	s/&gt;/>/g;
	s/&quot;/"/g;
    } 

    $ISBN_Title{$isbn} = $title;
    print STDERR "[ISBN $isbn: $title]\n" if $opts{'v'} || !$opts{'r'};

    $url = url($bookurl, $his_base)->abs . "/t";
    $curreq = GET $url;
    $response = $browser->request($curreq);
    if ($response->is_error()) {
	printf "Failed to lookup $url: %s\n", $response->status_line;
	exit(1);
    }

    my $data = $response->content;
    $data =~ s/<\/?t[rhd].*?>//isg;   # they have bad html in here
    my $html = parse_html($data);
    my $formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 500);
    my $ascii = $formatter->format($html);
    for ($ascii) { 
	my($rank) = /Amazon\.com\s+Sales\s+Rank:\s*([\d,]+)/;
	($ISBN_Rank{$isbn} = $rank || UNKNOWN) =~ s/,//g;

	s/.*\|\s*\n//s;
	s/\[(TABLE|FORM) NOT SHOWN\]//gs;
	s/Learn more about.*?ordering//si;
	s/-----.*$//s;
	s/\r//g;
	s/^ +$//g;
	s/^Our Price.*//m;
	s/^You Save.*//m;
	s/(?=List Price)/\n/;
	s/\n{2,}/\n/g;
	unless ($opts{'r'}) {
	    $Desc{$isbn} = $_;
	} else { 
	    print map { wrap("", "    ", $_) . "\n" } split /\n/;
	    print "\n";
	}
    } 

} 

exit if $opts{'r'};

for my $isbn ( sort { $ISBN_Rank{$a} <=>  $ISBN_Rank{$b} } keys %ISBN_Rank ) {
    $_ = $Desc{$isbn};
    s/(Amazon\.com\s+Sales\s+Rank:.*\n)//;
    print "Rank: ", ($ISBN_Rank{$isbn} == UNKNOWN)
			? "Unknown"
			: commify($ISBN_Rank{$isbn}),
	    "\n";
    print map { wrap("", "    ", $_) . "\n" } split /\n/;
    print "\n";

} 


sub commify {
    my $text = reverse $_[0];
    $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
    return scalar reverse $text;
}

__END__
-- 
"When I originally designed Perl 5's OO, I thought about a lot of this
stuff, and chose the explicit object model of Python as being the least
confusing. So far I haven't seen a good reason to change my mind on that."
(Larry Wall, February 1997, on perl5-porters)


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

Date: Mon, 31 Aug 1998 14:41:07 -0700
From: John Armstrong <siberian@siberian.org>
Subject: Perl Module for URL hiding
Message-Id: <35EB1903.9B0225CC@siberian.org>

Hi all.

I was wondering if anyone has seen a module or script ( or even function
) that 'hides' a GET query in the URL query string? I want to implement
it something along the lines of what Wells Fargo does, where the URL
query string is essentially a huge unintelligible string of madness that
I can manipulate back into shape to get my true arguments( and re-cipher
on the way out).

Any leads are appreciated. I am not looking for industrial strength
security, just something to keep users from actively trying to munge the
URL string data for funs and kicks.

Thanks mucho-
John Armstrong



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

Date: Mon, 31 Aug 1998 23:02:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Module for URL hiding
Message-Id: <Pine.GSO.4.02A.9808311601540.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, John Armstrong wrote:

> I was wondering if anyone has seen a module or script ( or even function
> ) that 'hides' a GET query in the URL query string? 

There are several modules on CPAN for manipulating URLs. But what you're
talking about seems to be simple string manipulation; you shouldn't need a
fancy module to append some text to a string. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 19:11:12 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Perl Module for URL hiding
Message-Id: <35EB2D90.6889E20B@sneex.fccj.org>

John Armstrong wrote:
> 
> Hi all.
> 
> I was wondering if anyone has seen a module or script ( or even function
> ) that 'hides' a GET query in the URL query string? I want to implement
> it something along the lines of what Wells Fargo does, where the URL
> query string is essentially a huge unintelligible string of madness that
> I can manipulate back into shape to get my true arguments( and re-cipher
> on the way out).
> 
> Any leads are appreciated. I am not looking for industrial strength
> security, just something to keep users from actively trying to munge the
> URL string data for funs and kicks.
> 
> Thanks mucho-
> John Armstrong


Pretty sure what you are wanting is called POST

Also, see CGI.pm  :]

HTH,
-Sneex- 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Murphy's Law of Research:
           Enough research will tend to support your theory.


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

Date: Mon, 31 Aug 1998 23:00:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl program for inews
Message-Id: <Pine.GSO.4.02A.9808311559040.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Will Morse wrote:

> From what I can see, I need to connect with a socket 
> to nntp (119) to my news server, 

> I found rfc 977, which cover Network News Transfer
> Protocol,

> I also have rfc 850, which cover standard for
> Interchange of Usenet Messages, 

> Anyway, If anyone has done this sort of thing 
> and/or has any suggestions or advice, I would
> appreciate it.

Sometimes you can find a module on CPAN which does what you want. That
would be a good place to start looking; it could save you over 95% of the
development time. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 22:57:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: ReadParse/newline character ??
Message-Id: <Pine.GSO.4.02A.9808311552560.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Ben Wallach wrote:

> The string has a newline character in it ("\n") that needs to be
> reflected when it is printed to the file.

I think you're saying that the string has those two characters, backslash
and n, and you're wanting to turn that into a newline character.

You can do that with a simple s/// command, assuming that you need to
handle just that one backslash escape, but not all of them. If you do need
to handle all of them correctly, it takes somewhat more complex code. Hope
this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 31 Aug 1998 23:30:20 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: ReadParse/newline character ??
Message-Id: <slrn6umcgc.54t.sholden@pgrad.cs.usyd.edu.au>

On Mon, 31 Aug 1998 10:46:53 -0700, Ben Wallach <benwallach@loop.com> wrote:
<snip>
>
>Somehow I need the readParse function to understand that "\n" means
>newline and not '\' and then 'n' ????

$line=~s/\\n/\n/g;

perldoc perlre
perldoc perlop

Sam


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

Date: 31 Aug 1998 21:55:17 GMT
From: "Saurus" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: secure STDOUT and STDERR with user params
Message-Id: <01bdd529$f17e3ec0$c1620c8a@lnxcompaq.lexis-nexis.com>

Hi,


	I'm trying to get a Perl cgi-script to read STDOUT and
STDERR without passing the user parameters through the shell.

<code fragment>
    open (INFO, "-|") || exec "$check_conf_cmd", "-$platform", "-sdir",
        "$sdir", "2>&1";
    while (<INFO>) {
            $return_this .= "$_";
    }
    close (INFO);
</code fragment>

The problem with this code is that the STDERR to STDOUT redirection
("2>&1") is not working. The only way I see to capture the full output
of the command is to use backticks after stripping metachars out of
the user parameters (which is a less secure method).

Any other suggestions?


Saurus



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

Date: Mon, 31 Aug 1998 23:07:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: secure STDOUT and STDERR with user params
Message-Id: <Pine.GSO.4.02A.9808311603050.24074-100000@user2.teleport.com>

On 31 Aug 1998, Saurus wrote:

> 	I'm trying to get a Perl cgi-script to read STDOUT and
> STDERR without passing the user parameters through the shell.

You can't read STDOUT and STDERR. They are output filehandles. I think you
mean the output and error streams coming from a child process.

>     open (INFO, "-|") || exec "$check_conf_cmd", "-$platform", "-sdir",
>         "$sdir", "2>&1";

Some of those quote marks are merely misleading. And does the command
you're exec'ing know what to do with that last parameter?

> The problem with this code is that the STDERR to STDOUT redirection
> ("2>&1") is not working.

That wasn't redirection; it was a parameter. But if you want your child
process's STDERR to go to STDOUT, maybe you should have the child process
open it that way before the exec. The entry for open() in perlfunc show
how to dup a filehandle. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 31 Aug 1998 19:35:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Setting the ENVironment in perl (HP-UX 10.20)?
Message-Id: <6sfc0s$sl4$1@monet.op.net>

In article <35e83de6.28673431@news.btinternet.com>,
Jonathan Stowe <Gellyfish@btinternet.com> wrote:
>I'm afraid you're going to have to parse the file buddy. 

Well, as you know I had the same reaction.  But actually I had an
inspiration a couple of days back:


	chomp(@VARS = qx{ . /path/to/envfile; env });
	foreach $vv (@VARS) {
	  my ($var, $val) = split(/=/, $vv, 2);
	  if (something) {	# `Something' might be `1'
	    $ENV{$var} = $val;
	  }
	}

Here you let the shell do the parsing, but you don't have to run the
shell first; it gets run invisibly by your program.

This doesn't work properly if the environment values may contain new-
lines, but if that's a concern you can work around it easily by writ-
ing a simple C program to replace `env' that just does something like:

	#include <stdio.h>
	int main(int c, char **v, char **e) {
	  for (; *e; e++) {
	    puts(e);
	    putchar('\0');	    
	  }
	  return 0;
	}

And replace `chomp' above with

	{ local $/ = "\0";
	  chomp(@VARS = qx{ . /path/to/envfile; goodenv });
	}



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

Date: Mon, 31 Aug 1998 22:36:14 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: unlinking file if <= 1 hour
Message-Id: <Pine.GSO.4.02A.9808311530580.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Ed Henderson wrote:

> If all the files are in a single directory, this will work:
> 
>   my $expiration_time = 1  # Time in hours;
>   # $path set to path where target file(s) exist.
>   unlink grep { (time  - (stat )[9]) > 60*60*$expiration_time } <$path/*>;

No, there's a more subtle bug in that code than the obvious one; it's
assuming that $path points to the current directory. Since the stat will
(most often) fail, nearly every file in the given directory will be
unlinked. Ouch! Ouch! Stop that!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 31 Aug 1998 18:46:13 -0400
From: Robert Duggan <104045.3064@CompuServe.COM>
Subject: Using a literal #sign?
Message-Id: <u7rwoET19GA.346@ntdwwaaw.compuserve.com>

How can I imbed a literal #sign in Perl?  I tried preceding it 
with a backslash, but it still gets treated as a comment flag.

Thanks
Robert Duggan
rduggan3@compuserve.com

-- 
Robert Duggan


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

Date: Mon, 31 Aug 1998 23:23:02 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Using a literal #sign?
Message-Id: <Pine.GSO.4.02A.9808311614190.24074-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Robert Duggan wrote:

> How can I imbed a literal #sign in Perl?  

The same way that you put any other punctuation mark in Perl: You type it
in wherever you want it. 

    $# = 17;			# that works
    $last_arg = $#ARGV;		# that works, too
    $fred =~ s/12#34/98#76/;	# just what I wanted
    print "$_\n" while <*#*>;	# okay here
    $three = `echo ###`;	# no problem

Maybe you didn't put the pound sign where Perl was expecting one. Could
you show an example of what you tried that didn't do what you wanted?
Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 31 Aug 1998 23:29:42 GMT
From: cabneySP4M@SP4M.SP4Mcyberpass.net (C. Abney)
Subject: Re: what's wrong with this statement?
Message-Id: <6sfbl6$9gl$3@news.infonex.net>

sowmaster@juicepigs.com (Bob Trieger) writes:
> <@thefree.net> wrote:
[lawn trimmings, snipped, and composted in /dev/null]

> If you don't stop backwhacking, you'll go blind.

And... hair will grow from the insides of your curly braces.

<duck where='forCover'>

-C
-- 
 ...if we truly desire world domination, we've got to get our LSD into
the corporate elite's conceptual water supply and alter the beast's
consciousness. -ESR                                           C. Abney



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

Date: Mon, 31 Aug 1998 14:52:29 -0700
From: Bob Anderson <randerso@ix.netcom.com>
Subject: Win32 Local Path Info
Message-Id: <35EB1B1D.D4A0C245@ix.netcom.com>

I'm trying to determine if there is a way to retrieve the local path to
an HTML file, i.e.

c:\inetpub\wwwroot\mypage.html

as opposed to

http://www.mydomain.com/mypage.html

The scripts and HTML files will all reside on the same machine.

Thanks

Bob A.



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

Date: Mon, 31 Aug 1998 18:46:33 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Y2K Date Support
Message-Id: <fl_aggie-3108981846330001@aggie.coaps.fsu.edu>

In article <6sekp3$f8j$1@marina.cinenet.net>, cberry@cinenet.net (Craig
Berry) wrote:

+ I R A Aggie (fl_aggie@thepentagon.com) wrote:
+ : Then you know about coordinate translatations? If so, you should have
+ : no problem with unix representing the current date as: 8 month, 30th
+ : day (depending on your time zone), the 98th year, 
+ 
+ '7 month', actually.  Recall that localtime uses January = 0.

Whoops. That's why I usually reference the 'perldoc -f localtime' entry...

James

"I wrote it down so I wouldn't _have_ to remember!" - Dr. Henry Jones, Sr.


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3600
**************************************

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