[8816] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2433 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 27 19:17:16 1998

Date: Mon, 27 Apr 98 16:00:27 -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, 27 Apr 1998     Volume: 8 Number: 2433

Today's topics:
    Re: "magical autoincrement algorithm?" <dfetter@shell4.ba.best.com>
    Re: 'each' and recursion, do they mix? (Ilya Zakharevich)
        Activeware & libnet (Yeesh!) <elssa09@callisto.si.usherb.ca>
    Re: Activeware & libnet (Yeesh!) <jkry3025@comenius.ms.mff.cuni.cz>
        An open2 issue, why not working through CGI?? (Craig Simpson)
    Re: Array / List question (Sitaram Chamarty)
        Backref With a Passed in Replacement Variable Not Worki <stowians@ford.com>
        cgi-lib.pl or CGI.pm? <yong@shell.com>
    Re: Defending Perl <jsd@gamespot.com>
    Re: Free Help for newbies and profs <rootbeer@teleport.com>
    Re: Help! Internal Server Error???? otis@POPULUS.net
    Re: Help: crypt for Win32 ?? <elssa09@callisto.si.usherb.ca>
    Re: How to add \ to an email address (brian d foy)
    Re: How to edit a file most efficiently? (Mark-Jason Dominus)
    Re: Interpolation tricks (was Re: Print Currency) (Mark-Jason Dominus)
    Re: LWP::UserAgent related question (brian d foy)
        Reverse Lookup??? <hsgsj@student.physics.umd.edu>
    Re: Reverse Lookup??? <ebohlman@netcom.com>
    Re: Reverse Lookup??? (brian d foy)
        setting off a ZIP file dload (Ben Jarrett)
        trouble compiling 5.004_4 on Solaris 2.5 - no snprintf( <fil@amnh.org>
    Re: use IPC::Open2; works on command line, but not CGI <yong@shell.com>
    Re: warnings and Getopt::Std (Andrew M. Langmead)
    Re: warnings and Getopt::Std <barnett@houston.Geco-Prakla.slb.com>
    Re: Why doesn't this work? <sholden@ug.cs.usyd.edu.au>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 27 Apr 1998 21:03:07 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: "magical autoincrement algorithm?"
Message-Id: <6i2rqb$65u$1@nntp1.ba.best.com>

Grinch <grinch@whoville.com> wrote:
> Where can I find out more about the "magical autoincrement algorithm" used
> for the range operator?

> More specifically, can anyone tell me how to obtain a mixed-case list? I
> expected ('AA'..'zz') to work, but it returns all 676 upper case
> combinations. ('aa'..'ZZ') returns all 676 lower case combinations. What I
> want is all 2704 mixed-case, two-letter combinations.

TMTOWTDI, so here's mine:

for $i (a..z,A..Z) {
    for $j (a..z,A..Z) {
#do stuff here with "$i$j";
    }
}

> I can come up with workarounds using various looping constructs, and for my
> current project I'll probably wind up doing exactly that. I just want to
> clear up my (mis?)understanding of '..', and figure out why ('AA'..'zz')
> doesn't do what I expected.

Maybe it's because Larry didn't make it do what you expected?

-- 
            David Fetter         888 O'Farrell Street Apt E1205
   shackle@ren.glaci.com          San Francisco, CA 94109-7089 USA
  http://www.best.com/~dfetter     +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)

What's wrong with 3rd party tools? Especially if they are free?  What
the hell do you think unix is anyway? It's a big honkin' party of 3rd
party free tools.
                                        Bob Cassidy (rmcassid@uci.edu)


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

Date: 27 Apr 1998 21:45:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i2ua6$atb$1@mathserv.mps.ohio-state.edu>
Keywords: inestimable sauerkraut tenor wed

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6i2njk$i5e$1@monet.op.net>:

> >Also, what do you think of making *the* iterator amenable to local()?
> >That would solve the problem you mentioned, wouldn't it?
> 
> I'm not sure I understand what you want to do here.  

I think I have an idea of what is wanted, since yesterday I had (for a
couple of minutes ;-) an idea that I know how to do it: allow
	
	local each %hash;

which resets the iterator, and sets it back at the end of the scope.

Unfortunately, this needs too much bookkeeping unless you consent to
segfaults:  

	    What does it mean "sets it back" ?

Back *where*?  There is no problem to answer this if the hash did not
change.  But if it did?

Ilya


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

Date: Mon, 27 Apr 1998 21:32:20 GMT
From: ELSS Admin <elssa09@callisto.si.usherb.ca>
Subject: Activeware & libnet (Yeesh!)
Message-Id: <35463456.20DB@callisto.si.usherb.ca>

Can libnet be installed on activeware's nt build?

Libnet (most recent):
ftp://sunsite.dcc.uchile.cl/pub/Lang/perl/CPAN/ports/win32/Standard/x86/libwin32-0.10.zip

Activeware's most recent nt build:

http://www.ActiveState.com/ftp/Perl-Win32/Release/Pw32i316.exe

Natalie


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

Date: Tue, 28 Apr 1998 00:06:41 -0700
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Activeware & libnet (Yeesh!)
Message-Id: <35458001.1E88@comenius.ms.mff.cuni.cz>

ELSS Admin wrote:
> 
> Can libnet be installed on activeware's nt build?
> 
> Libnet (most recent):
> ftp://sunsite.dcc.uchile.cl/pub/Lang/perl/CPAN/ports/win32/Standard/x86/libwin32-0.10.zip
> 
> Activeware's most recent nt build:
> 
> http://www.ActiveState.com/ftp/Perl-Win32/Release/Pw32i316.exe
> 
> Natalie

Yes, but it requires a little tweaking. ( And maybe it's not complete, I
unly use Net::FTP )

You need to copy the .pm files to c:\perl\lib\Net\ (assuming perl in
c:\perl)
and then somehow generate/get file Config.pm to be placed in the same
directory.

 ( You may get it at http://www.fmi.cz/private/Jenda/perl/Net/Config.pm
   but make sure you change the settings )

I think this did it for me.

Jenda


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

Date: Mon, 27 Apr 1998 22:03:32 GMT
From: craigs@3rdstone.net (Craig Simpson)
Subject: An open2 issue, why not working through CGI??
Message-Id: <3544fea0.252172204@209.76.252.8>


This works on the command line. But through CGI I am getting nothing
in the e-mail. Anyone understand this?


$pid = open2( \*Reader, \*Writer, '/usr/local/bin/pgpe -at -r
craigs@aka.com');
 Writer->autoflush(); # default here, actually
  open(FILE, "crypto2") || die "Error: $!\n";
    print Writer  <FILE>;
    print Writer  "\n\nSay Hi to Craig for me !!\n";
    close Writer || die "bad spool: $! $?";

open (MAIL, "|$sendmail")||die "couldn't open pipe to $sendmail";
 print MAIL "To: craigs\@aka\n";
 print MAIL "From: craigs\@aka.com\n";
 print MAIL "Subject: Secure\n\n";
  print MAIL <Reader>;
   close(Reader) || die "bad spool: $! $?";



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

Date: 27 Apr 1998 15:47:11 -0700
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Array / List question
Message-Id: <slrn6k9i63.19l.sitaram@ltusitaram.diac.com>

On Thu, 23 Apr 1998 14:20:49 GMT, Randal Schwartz <merlyn@stonehenge.com> wrote:
>I feel like I'm being stalked. :-)
>
>(Yeah, yeah, Dejanews... I know.)

You are modest.  Some of us *save* your posts too you know - just
in case the net is slow :-)


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

Date: Mon, 27 Apr 1998 17:09:39 -0700
From: Stan Towianski <stowians@ford.com>
Subject: Backref With a Passed in Replacement Variable Not Working
Message-Id: <35451E43.497C@ford.com>

Hi,

I am new to Perl, but not to programming and I have this problem.  I want 
to pass an argument to a Perl program for it to be used in a substitution
command.  This will not work when I want to use backreferencing; probably
because I need to use a $1.  I run the program with a bogus argument and
then hardcoded the variables I wanted in the program for testing.  The problem
variable is $change_to.  $match seems to work; I am guessing because it does
not contain a $.  The basic command is $line =~ s/$match/$change_to/ig

See below. I try:
$match = "mapsii_data_defs:(.*)\.dim";
print "dollar 1 =$1=\n";
# HERE I TRIED ENCLOSING WITH DOUBLE QUOTES WHICH MAKES $1 JUST GET REPLACED 
RIGHT THEN
# BASICALLY WITH A NULL STRING SO THAT DOESN'T WORK.
# I THEN TRIED SINGLE QUOTES, WHICH MAKES IT NOT GET INTERPOLATED NOW, BUT
# ALSO SEEMS TO NOT ALLOW IT TO BE INTERPOLATED LATER IN THE S/// COMMAND AS 
WELL!
$change_to = 'share_dims:$1\.dim';
I do not know of a way to make the $1 to not get interpolated now, but
still be used as the backreference in the s/// command.

Anyone know a way?
Thanks.

Please email stowians@ford.com

---------------------------------------------------------------------------
#!/FIXTHIS/bin/perl

##  program: 
##  purpose: 
##  written: Stan J. Towianski
##     date: Apr/24/1998

#  Playing with substitution here
$one = "one";
$two = "\$one";
print "dollar two =$two=\n\n";

#
# Parse thru arg.s
#
$numargs = scalar( @ARGV );
if ( $numargs < 1 )
   {
   print_instructs();
   exit 1;
   }

for( $c = 0; $c < $numargs; $c++ )
   {
   if ( $ARGV [$c] eq "-i" or $ARGV [$c] eq "-I" )
      {
      $fpath = $ARGV [$c + 1];
      $c++;
      next;
      }
   elsif ( $ARGV [$c] eq "-o" or $ARGV [$c] eq "-O" )
      {
      $fpath_new = $ARGV [$c + 1];
      $c++;
      next;
      }
   elsif ( $ARGV [$c] eq "-fo" or $ARGV [$c] eq "-FO" )
      {
      $force_output_flag = 1; 
      next;
      }
   elsif ( $ARGV [$c] eq "-f" or $ARGV [$c] eq "-F" )
      {
      $match = $ARGV [$c + 1];
      $c++;
      next;
      }
   elsif ( $ARGV [$c] eq "-t" or $ARGV [$c] eq "-T" )
      {
      $change_to = $ARGV [$c + 1];
      $c++;
      next;
      }
   }


# HERE I JUST HARD CODE THE VARIABLES I WANT TO USE
$fpath = "load_ds_dims.hl";
$fpath_new = "out";
$match = "mapsii_data_defs:(.*)\.dim";
print "dollar 1 =$1=\n";
# HERE I TRIED ENCLOSING WITH DOUBLE QUOTES WHICH MAKES $1 JUST GET REPLACED 
RIGHT THEN
# BASICALLY WITH A NULL STRING SO THAT DOESN'T WORK.
# I THEN TRIED SINGLE QUOTES, WHICH MAKES IT NOT GET INTERPOLATED NOW, BUT
# ALSO SEEMS TO NOT ALLOW IT TO BE INTERPOLATED LATER IN THE S/// COMMAND AS 
WELL!
$change_to = 'share_dims:$1\.dim';

if ( ! $match )
   {  
   print "\n*** Error - missing 'from' pattern to match. add -f pattern\n";
   exit 0;
   }

if ( ! $change_to )
   {  
   print "\n*** Error - missing 'to' string to change it to. add -t string\n";
   exit 0;
   }

if ( -f $fpath_new and ! $force_output_flag )
   {
   print "\n\n*** Warning - File '", $fpath_new, "' already exists.\n";
   print "O.K. to overwrite it ? ";
   $ans = substr( <STDIN>, 0, 1 );
   $ans =~ tr/YN/yn/;
   print "got ans =$ans=\n";
   if ( $ans eq "n" ) 
      {
      print "Will not replace.\n";
      exit 0; 
      }
   }


if ( $fpath_new )
   {
   print "\ninput file  =$fpath\n";
   print "output file =$fpath_new\n";
   print "match from  =$match\n";
   print "change to   =$change_to\n";
   if ( ! $force_output_flag )
      {
      print "\nHit Y to continue else it will exit.\n";
      $ans = substr( <STDIN>, 0, 1 );
      $ans =~ tr/YN/yn/;
      print "got ans =$ans=\n";
      if ( $ans ne "y" ) 
         {
         print "User exit.\n";
         exit 0; 
         }
      }
   }

if ( 1 == 2 ) #! $proj_id )
   {
   print_instructs();
   print "\n*** Error - must include -p [mapsii | rlro]  option.\n";
   exit 1;
   }


open( FPATH, $fpath );
if ( $fpath_new )
   {  
   open( FPATH_NEW, ">" . $fpath_new );
   select FPATH_NEW; 
   }


while( $line = <FPATH> )
   {
   print STDERR "got line =$line=";
   # IF I JUST REPLACE THE CHANGE_TO WITH WHAT IT IS IT WORKS.
   # THE $MATCH WORKS SO I WONDER IF PERL DOES NOT THE $1 IN THE $CHANGE_TO
   $line =~ s/$match/$change_to/ig;    # THIS DOES NOT WORK WITH $CHANGE_TO
## PLAYED WITH THIS ONCE   $newstring = eval( "$line =~ 
s/$match/$change_to/eig" );
##   print "newstring =$newstring=\n";
   print "line =$line=\n";
   }

close( FPATH );
if ( $fpath_new )
   {  
   close( FPATH_NEW );
   select STDOUT;
   }

if ( $fpath_new )
   {
   print "\ninput file  =$fpath\n";
   print "output file =$fpath_new\n";
   print "match from  =$match\n";
   print "change to   =$change_to\n";
   }
exit 0;

#
###############################################################
#
sub print_instructs
{
   print "\n\n";
   print "USAGE: -i infile -o outfile -f frompattern -t tostring"; 
   print "\n";
   print "  where\n";
   print "    -i   Input file to read from.\n";
   print "    -o   Output file to read from.  Defaults to <stdout>\n";
   print "    -fo  Force Output; Will not ask to overwrite existing output 
file.\n";
   print "    -f   From pattern.  The perl 'pattern' you want to match.\n";
   print "    -t   To string.  The perl string you want to replace the from 
with.\n"; 
   print "\n";
   print "  examples\n";
   print "    fcrmstr -i ss -o ss.new -f mapsii_data_defs.txt -t 
mapsii_defs.txt\n";
   print "    fcrmstr -i ss    -f mapsii_data_defs.txt -t mapsii_defs.txt\n";
   print "\n";
}


--------------------------------- EOF --------------------------------

This is the file I try to run it on:
-----------------------------------------------------------------
IF NOT DEFINED(org_alt_dlrstate) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:org_alt_dlrstate.dim"    
END IF
IF NOT DEFINED(product_type) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:product_type.dim"  
END IF
IF NOT DEFINED(business_type) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:business_type.dim"  
END IF
IF NOT DEFINED(dealer_plan3) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:dealer_plan3.dim"  
END IF
IF NOT DEFINED(new_used) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:new_used.dim" 
END IF
IF NOT DEFINED(time3) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:time3.dim"    
END IF
IF NOT DEFINED(facts_ds) THEN
    EXECUTE HOSTFILE"mapsii_data_defs:facts_ds.dim"    
END IF


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

Date: Mon, 27 Apr 1998 17:52:06 -0500
From: Yong Huang <yong@shell.com>
Subject: cgi-lib.pl or CGI.pm?
Message-Id: <35450C16.77FDFAE5@shell.com>

Is there any compelling reason to use CGI.pm instead of the "old" and
"glorified" cgi-lib.pl? I'm used to and have become very familiar with
cgi-lib.pl. Since I don't have too much experience in OO Perl, CGI.pm or
even CGI_Lite.pm seems to be more difficult than cgi-lib.pl to use. But
if somebody can tell me using CGI.pm has performance advantage, for
example, I'll definitely switch. I also would like to know the advantage
of using references (OO Perl sort of things) over traditional Perl.
Thanks for any advice.

Yong Huang
Email:yong@shell.com



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

Date: Mon, 27 Apr 1998 15:23:40 -0700
From: Jon Drukman <jsd@gamespot.com>
Subject: Re: Defending Perl
Message-Id: <3545056C.ACE44E9D@gamespot.com>

Abigail wrote:
> Uhm, uhm, I find perl one of the hardest things to install.
> I'd rather install gcc -- much simpler.

what's so hard about
 ./configure
make
make install

????

that's all i've ever needed to do to install perl.
gcc on the other hand is pretty tough.  particularly if you don't have
an older version of gcc handy already.

-- 
Jon Drukman                                            jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.


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

Date: Mon, 27 Apr 1998 22:57:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Malte Ubl <m.ubl@elmshorn.netsurf.de>
Subject: Re: Free Help for newbies and profs
Message-Id: <Pine.GSO.3.96.980427153340.18175A-100000@user2.teleport.com>

On Mon, 27 Apr 1998, Malte Ubl wrote:

> if you are one of the people who had problems with
> difficult installations of CGI-scripts, file-permissions, etc.
> 
> I have the solution for you:
> 
> easyScriptsOffice!

Although I appreciate that you're willing to give away your software, I'm
not sure that this code is the best it could be. Here are some suggestions
that may help you to improve your code in the future.

Any program which is longer than a dozen lines or so should really be
written with 'use strict'. When developing your code, you should use the
-w invocation option to enable warnings. foreach is not the best way to
traverse a hash - using each within a while loop is generally better. It's
not especially secure to set files to permissions 777, even if that seems
to work fine on your system. $void is not a perl built-in, and is not the
way to tell whether a hash element exists. Most programmers are right to
avoid using $' in most cases. In no case is $' the best way to test
whether a pattern match succeeded. I don't believe that the CGI
specification guarantees that scripts will be run with any particular
current working directory, so your scripts may fail on some machines. Your
instructions won't work with all webservers. It's rare for a large script
to use only global variables; you should probably use my() in places.

I worry that there may be security holes in your scripts. Certainly you do
little or no checking of data sent by a remote user. It may be a good idea
to re-code your scripts to use taint checking, as well as the other
options mentioned above.

You may benefit from reading the Llama book, which should show you some
better ways to write your code. Of course, the Llama doesn't cover all of
the issues mentioned above. 

Hope this helps!

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



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

Date: Mon, 27 Apr 1998 15:46:52 -0600
From: otis@POPULUS.net
Subject: Re: Help! Internal Server Error????
Message-Id: <6i2qrt$res$1@nnrp1.dejanews.com>

When your script die's it doesn't send the proper Content-type header to the
browser.
Don't die like that, report an error.
check permissions on files/directories/scripts that you are using
check your web server's error log file
ask in the CGI newsgroup next time
read the FAQ now :)

Otis

In article <6i2b3r$rdh$1@nnrp1.dejanews.com>,
  rpearce@fastlane.net wrote:
>
> I'm trying to write what should be a simple perl script to open an html
> document and extract email address and then write them to a text file for a
> mailing list script.  I've tried everything I can think of and I keep
getting
> that damned Internal Server Error.
>
> Here is the script:
>
> #!/usr/local/bin/perl
> #
> $guestbookreal = "/homepages/rpearce/alumni_directory.html";
> $addressbook = "/homepages/rpearce/address.txt";
> print "Content-type:  text/plain\n\n";
>
> open(FILE,"$addressbook") || die "Can't Open $addressbook: $!\n";
> @LINES=<FILE>;
> close(FILE);
> $SIZE=@LINES;
>
> open (OUT,">>$addressbook") || die "Can't Open $addressbook: $!\n";
>
> for ($i=0;$i<=$SIZE;$i++) {
>     $_ = $LINES[$i];
>
>     if(/mailto:([^\"]+)\"/i) {
>      $email=$1;
>      print OUT $email\n;
>     {
> {
>
> close (OUT);
>
> I've edited with notepad and write on win95.  My ISP uses cgiwrapper to run
> scripts, which I am calling correctly.  I can run other scripts that I've
> gotten from Matt's or elsewhere.  I'm sure it's some simple small thing.
Any
> ideas?  I've tried escaping and not escaping the "s in the if( line.  I'm
> getting very frustrated.
>
> Rick...
> rpearce@fastlane.net
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 27 Apr 1998 22:19:53 GMT
From: ELSS Admin <elssa09@callisto.si.usherb.ca>
To: Ben Coleman <tnguru@termnetinc.com>
Subject: Re: Help: crypt for Win32 ??
Message-Id: <35463F79.3383@callisto.si.usherb.ca>

Ben Coleman wrote:
> 
> >Where can I find UNIX-like "crypt" function for Win32 Perl ?? Does
> There's a Perl version of crypt at
> http://www.pdv-systeme.de/users/martinv/Crypt.pm.  I've used it
> successfully under Win32 without problems.

Do i just install it? Which directory?
Don't want to sound like a newbie, been a looooooog day.
I'm playing with activeware to avoid teh prob, but now can't install
libet modules!

I can't find your reference.


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

Date: Mon, 27 Apr 1998 18:26:02 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to add \ to an email address
Message-Id: <comdog-ya02408000R2704981826020001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6i2pgn$ncn$1@nnrp1.dejanews.com>, spencer@luckman.com posted:

>How do I add \ to a string that contains @ and . characters in Perl? I want to
>convert an email address like:

>somebody\@here\.company\.com


perhaps you would like to use the quotemeta function?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 27 Apr 1998 17:23:52 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to edit a file most efficiently?
Message-Id: <6i2t18$ilb$1@monet.op.net>
Keywords: dredge gladiator restrict vaunt


In article <3544E019.A1F7A6D6@shell.com>, Yong Huang  <yong@shell.com> wrote:
>But this opens two files and does a rename. I suspect this won't be very
>efficient. 

The time to open and rename one file will be totally dominated by the
time to copy the data.

Worrying about optimization at this level is just silly.  Write the
program.  If it is unacceptably slow for your real application, then
benchmark it, and then look at ways to make the slow parts faster.

Forget about saving an `open' and ` rename' unless the benchmark tells
you that that is where the bottleneck is.




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

Date: 27 Apr 1998 17:58:50 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Interpolation tricks (was Re: Print Currency)
Message-Id: <6i2v2q$irc$1@monet.op.net>
Keywords: eyewitness ghoul mucilage Remus


In article <354562D1.4D33@comenius.ms.mff.cuni.cz>,
Jan Krynicky  <jkry3025@comenius.ms.mff.cuni.cz> wrote:
>> >       print "Total tax: \$$${ $gross * 0.28 } \n";
>It would do, only if $ wouldn't be so special. 

Yes, it's probably the same thing in the lexer that makes "$$3" mean
to interpolate the PID with a 3 on the end instead of to look for a
scalar reference in $3.

>> Someone had a really delightful suggestion 
>I would use:

I should add that the `someone' was actually Jan.

>Looks nice, doesn't it? ;-)

It's great.  

>BTW: Mark-Jason didn't you think about creating a library of
>such Interpolation tricks. You could use some Guestbook code
>for establishing it.

That's a good idea.

>BTOW: I think this module should be included in the standard
>instalation.

When I discussed it in perl5-porters, some people agreed with you, but
other people thought it was silly.

Time will tell.




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

Date: Mon, 27 Apr 1998 18:21:31 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: LWP::UserAgent related question
Message-Id: <comdog-ya02408000R2704981821310001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6i2q4k$olc$1@hiekkalaatikko.cs.hut.fi>, jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni) posted:

>the following page kan snoop information about the last page visited.
>http://www.anonymizer.com/cgi-bin/snoop.pl
>
>How can I give some value to that field?

see the methods provided by HTTP::Message and friends for playing
with the headers.  you'll want to add a Referer: line.    

>Is there any script similar to that snoop.pl publickly available?

probably, but it's not too hard to write yourself.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Mon, 27 Apr 1998 16:56:19 -0400
From: Physics OWL <hsgsj@student.physics.umd.edu>
Subject: Reverse Lookup???
Message-Id: <6i2rag$uea$1@hecate.umd.edu>

Hi there!

    Does anyone have any code that'll take an IP address and turn
    it into the host name associated with it?  I've tried using
    'gethostbyname' but it only returns the IP address I feed it.
    Any pointers will be very much appreciated.

    Thanks,

    ~brian



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

Date: Mon, 27 Apr 1998 22:17:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Reverse Lookup???
Message-Id: <ebohlmanEs3F8s.8wr@netcom.com>

Physics OWL <hsgsj@student.physics.umd.edu> wrote:

:     Does anyone have any code that'll take an IP address and turn
:     it into the host name associated with it?  I've tried using
:     'gethostbyname' but it only returns the IP address I feed it.

perldoc -f gethostbyaddr.



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

Date: Mon, 27 Apr 1998 18:31:52 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Reverse Lookup???
Message-Id: <comdog-ya02408000R2704981831520001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6i2rag$uea$1@hecate.umd.edu>, Physics OWL <hsgsj@student.physics.umd.edu> posted:

>    Does anyone have any code that'll take an IP address and turn
>    it into the host name associated with it?  I've tried using
>    'gethostbyname' but it only returns the IP address I feed it.
>    Any pointers will be very much appreciated.

according to the docs, gethostbyname() takes a name and translates it
into an address, which is probably from where the "byname" part came.
perhaps you wanted gethostbyaddr()?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Mon, 27 Apr 1998 23:12:11 +0100
From: ben@xeyed.demon.co.uk (Ben Jarrett)
Subject: setting off a ZIP file dload
Message-Id: <MPG.faf1311c310397e989680@news.demon.co.uk>

Hi,

Can someone please let me know the best way via PERL to activate
a ZIP file dload in the browser.


Thanks

Ben
ben@xeyed.demon.co.uk



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

Date: 27 Apr 1998 18:08:57 -0400
From: Fil Krohnengold <fil@amnh.org>
Subject: trouble compiling 5.004_4 on Solaris 2.5 - no snprintf()?
Message-Id: <ehd8e29ati.fsf@hammond.amnh.org>



Howdy.  Subject line says most of it.  There's no mention of snprintf in 
/usr/include/stdio.h except on my 2.6 boxes - however, running "strings"
on /usr/lib/libc.a does turn up a couple of references.  Can anyone
point me in the right direction?  



hammond:/amnh/src/perl/perl5004_4> make test
[...]
lib/bigintpm......ok
lib/checktree.....ok
lib/complex.......ok

lib/db-btree......Can't load '../lib/auto/DB_File/DB_File.so' for
module DB_File : ld.so.1: ./perl: fatal: relocation error: symbol not
found: snprintf: referenc ed in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 166.
 
 at ./lib/db-btree.t line 12
BEGIN failed--compilation aborted at ./lib/db-btree.t line 12.
FAILED at test 0

lib/db-hash.......Can't load '../lib/auto/DB_File/DB_File.so' for
module DB_File : ld.so.1: ./perl: fatal: relocation error: symbol not
found: snprintf: referenc ed in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 166.
 
 at ./lib/db-hash.t line 12
BEGIN failed--compilation aborted at ./lib/db-hash.t line 12.
FAILED at test 0

lib/db-recno......Can't load '../lib/auto/DB_File/DB_File.so' for
module DB_File : ld.so.1: ./perl: fatal: relocation error: symbol not
found: snprintf: referenc ed in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 166.
 
 at ./lib/db-recno.t line 12
BEGIN failed--compilation aborted at ./lib/db-recno.t line 12.
FAILED at test 0
lib/dirhand.......ok
lib/dosglob.......ok
lib/english.......ok
[...]





thanks

-fil

___________________________________________________________________________
Fil Krohnengold    |  UNIX Systems Administrator, Network Systems
fil@amnh.org       |  The American Museum of Natural History 
212/769-5294       |  CPW @ 79thSt / NY, New York / 10024


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

Date: Mon, 27 Apr 1998 17:43:36 -0500
From: Yong Huang <yong@shell.com>
To: Craig Simpson <craigs@3rdstone.net>
Subject: Re: use IPC::Open2; works on command line, but not CGI
Message-Id: <35450A18.49E5FF89@shell.com>

I think of myself as an experienced CGI programmer. The greatest
difference between me and others is in fact I can read the server error
log file and read it correctly. If you can't access it, negotiate with
your Webmaster. If still can't, try it on your own Web server.
Installing Apachie for UNIX or OmniHTTP is quite straightforward.

Yong Huang

Craig Simpson wrote:

> use IPC::Open2; works on command line, but not CGI
> This is part of the script that I have that pgp's my e-mail before
> sending it to me via e-mail form my web site.
>
> If I use it on the command line it will work, but it sends an empty
> message through cgi. Any ideas? Am I trying to grab the data wrong?
>
> $pid = open2( \*Reader, \*Writer, "pgpe -at -r
> craigs\@.3rdstone.net");
>  Writer->autoflush(); # default here, actually
>   open(FILE, "crypto2") || die "Error: $!\n";
>     print Writer  <FILE>;
>     print Writer  "\n\nSay Hi to Craig for me !!\n";
>     close Writer || die "bad spool: $! $?";
>
> open (MAIL, "|$sendmail") || die "couldn't open pipe to $sendmail";
>  print MAIL "To: craigs\@3rdstone.net\n";
>  print MAIL "From: craigs\@3rdston.net.com\n";
>  print MAIL "Subject: PGP Secure Order\n\n";
>   print MAIL <Reader>;
>    close(Reader) || die "bad spool: $! $?";





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

Date: Mon, 27 Apr 1998 21:06:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: warnings and Getopt::Std
Message-Id: <Es3By9.MK9@world.std.com>

Bill Mooney <wmooney@voicenet.com> writes:

>Is there a "standard" way to remove these warnings?

The "vars" pragma.

    use vars qw($opt_v);
-- 
Andrew Langmead


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

Date: Mon, 27 Apr 1998 16:18:55 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: warnings and Getopt::Std
Message-Id: <3544F63F.B15B29A@houston.Geco-Prakla.slb.com>

Bill Mooney wrote:
> 
> Anyone know a good way to get rid of the warning associated with testing
> command line arguments with the getopts funciton?
> 
> i.e.
> 
> use Getopt::Std;
> 
> getopts('v')
> 
> if (defined($opt_v)) {
>    # Do stuff here
> }
> 
> produces a warning like the following:
> 
> Identifier "main::opt_v" used only once: possible typo at ...
> 
> Is there a "standard" way to remove these warnings?
> 
> Thanks
> -Will
How about:
perldoc vars   shows

use vars qw($opt_v);

How about:
$opt_v = "";
getopts('v');


HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Tue, 28 Apr 1998 08:34:05 +1000
From: Sam Holden <sholden@ug.cs.usyd.edu.au>
Subject: Re: Why doesn't this work?
Message-Id: <354507DD.E437255F@ug.cs.usyd.edu.au>

Uri Guttman wrote:
> 
> >>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
> 
>   CB> Uri Guttman (uri@sysarch.com) wrote:
>   CB> : how about this one liner:
>   CB> :
>   CB> : #!/usr/local/bin/perl -n0
>   CB> : # run this with the file you want to extract meta as the arglist.
>   CB> : # redirect output to your favorite file
>   CB> :
>   CB> : while ( m/(<meta\s+[^>]+>)/ig ) { print "$1\n" ; }
> 
>   CB> Or even more simply, replace the regex with
> 
>   CB>   m/(<meta\s+.+?>)/ig
> 
> nice try, but no cigar. this fails for newlines in the <meta>. . won't
> match a newline without the /s modifier. either add /s to your regex or
> use mine which will match any char other than a > and doesn't need the
> nongreedy modifier.
> 
> also neither will match plain <meta> but that may not need to be found.

And you both miss <meta name=">"> - which I think is significant...

Surely the obvious thing to do is use a module that does it for you...

Sam


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2433
**************************************

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