[12333] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5933 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 9 16:07:17 1999

Date: Wed, 9 Jun 99 13:00:26 -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           Wed, 9 Jun 1999     Volume: 8 Number: 5933

Today's topics:
    Re: _Please_ improve localtime! zenin@bawdycaste.org
    Re: can i variably name an array? <tchrist@mox.perl.com>
        Checking symlinks in Perl <jak@knoware.nl>
        Conditional END blocks (Gregory Snow)
    Re: Conditional END blocks <craig@mathworks.com>
        cookie-monster.pl, a cookie scrambler. <ocschwar@MIT.EDU>
    Re: Creating an external config file. How ? <tchrist@mox.perl.com>
    Re: Current Directory Name <bill@fccj.org>
    Re: Extracting form fields (HTML::Parser), then printin <bill@fccj.org>
    Re: Functions <jdporter@min.net>
        How to get info from a file with sed/awk/perl <cgutierr@firstcom.cl>
        how to pass a shell command to Perl <zeng@haas.Berkeley.EDU>
        How to write TO a socket? (client/server socket stuff) (RikTAIT)
        Installing Modules and MakeMaker <burton@lucent.com>
    Re: Interesting Update <bill@fccj.org>
    Re: Intersection of several lists <ludlow@us.ibm.com>
    Re: macperl - directory names with embedded spaces (Dan Wilga)
    Re: macperl - directory names with embedded spaces <rootbeer@redcat.com>
    Re: MySQL Placeholders II (Graham Ashton)
    Re: Mysql Placeholders <hecubas1@my-deja.com>
    Re: Need a book ... <rootbeer@redcat.com>
    Re: perl debugging in emacs <rootbeer@redcat.com>
    Re: PERL T SHIRT FOR SALE <csaba.raduly@sophos.com>
    Re: problem reporting and tracking package? <gbartels@xli.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 09 Jun 1999 19:51:11 GMT
From: zenin@bawdycaste.org
Subject: Re: _Please_ improve localtime!
Message-Id: <928958051.197131@localhost>

Russell Schulz <Russell_Schulz@locutus.ofb.org> wrote:
: rlb@intrinsix.ca (Lee) writes:
:>> So, hey, give us poor programmers a break.  Introduce a $^something
:>> option to give localtime more useful semantics.
:>
:> I think what you want to do is write yourself a realtime() sub that calls
:> localtime and does the things you want, and then never call localtime
:> directly.
: 
: I agree -- obviously, changing localtime() is a bad idea.
: 
: But once you write this realtime(), _please_ submit it to perlbug, so it
: can become part of the standard distribution (helping the poor interface
: on localtime die an all-too-late death).

	Already done:

	use POSIX;
	print POSIX::strftime ("%A, %B %d, %Y", localtime());
	# Prints "Wednesday, June 09, 1999"

	If you want human grokable output, use a tool designed for it.
	localtime() isn't that tool and any "realtime()" kluges would
	be little more then redundant.

-- 
-Zenin (zenin@archive.rhps.org)         Caffeine...for the mind.
                                        Pizza......for the body.
                                        Sushi......for the soul.
                                             -- User Friendly


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

Date: 9 Jun 1999 13:15:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: can i variably name an array?
Message-Id: <375ebd5f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, abigail@delanet.com writes:
:Do you have the urge to do this when programming in C or Pascal
:as well? 

Script kiddies don't have real programming backgrounds.

:Why is this question popping up 17 times a week?

Because the price of entry is so low -- that is, perl is so easy to use --
that most perl programmers are just script kiddies.

--tom
-- 
I eschew embedded capital letters in names; to my prose-oriented eyes,
they are too awkward to read comfortably.  They jangle like bad typography.
    --Rob Pike


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

Date: Wed, 9 Jun 1999 21:49:59 +0200
From: Jaap Keuter <jak@knoware.nl>
Subject: Checking symlinks in Perl
Message-Id: <Pine.BSI.4.05L.9906092147070.8304-100000@utopia.knoware.nl>

Hi all,

I'm using Perl on HP-UX 10 and I'm looking for a way to check if the file a
symlink points to has gone. This is to be used in a script that checks all
symlinks in a directory and if a symlinks points to nothing it is removed.

Any takers?

Jaap




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

Date: 9 Jun 1999 18:25:46 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Conditional END blocks
Message-Id: <7jmbja$109s$1@nntp6.u.washington.edu>

I greped the faqs and other docs and while they had a lot of info on
END blocks, I didn't find what I was looking for (I found stuff that
confirmed that the naive approach wouldn't do what I wanted), so tell
me what you think.

I want to be able to do some clean-up just before my program ends, so
the END block sytax seems like the way to go, however, there are some
things that I only want to do if certain things happen in the program
(a certain subroutine gets called).  But the standard END block gets
run either way, i.e. for the following code:

#!/home/bin/perl -w

my $temp=0;

sub test {
  print "in sub\n";
  END { print "ending stuff: $temp\n"; }

}


if ($temp) {
  test();
}


prints "ending stuff" regaurdless of the value of $temp, when what I
want is for it to only print if the subroutine "test" is run.  

Here are the ideas that I've come up with (some tested, some not):

1.  Set a global variable (or lexical with scope including both
subroutine and END block) in the subroutine, and check the value of
the variable in the END block (END {print "end stuff" if $sub_ran;} ).

2.  In the subroutine(s), push references to functions onto a global
array (or properly scoped lexical array), then in the end block pop
off the references and run each one.

3.  Somehow use AUTOLOAD (I don't know AUTOLOAD very well, so don't
know if or how this would work).

4.  Define a subroutine that does nothing, inside the subroutine of
interest, use eval to redefine the subroutine that did nothing to do
something, then call it in the end block (generates a warning).

5.  Put each subroutine in a different module with it's own end block
and only "require" it if it will be called.


My current preference is for #2, because it seems the most flexible
while still being fairly simple and not generating warnings and can
use closures for the clean-up if useful.  But I was wondering if there
are any other ideas out there, or some critiques of the above ideas
(which do you think is best and why, which should be avoided at all
costs and why)

Thanks,


-- 
-------------------------------------------------------------------------------
     Gregory L. Snow         |   Imagination is the one weapon in the
     (Greg)                  |  war against reality.
snow@biostat.washington.edu  |                -- Jules de Gaultier


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

Date: Wed, 09 Jun 1999 14:55:48 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Conditional END blocks
Message-Id: <375EB8B4.DA37889E@mathworks.com>

2. may be your best bet.  The Camel book has the following to say about END blocks:

Your END blocks should not assume that any or all of your main code ran.  (They
shouldn't do this in any event, since the interpreter might exit early from an
exception.)  This is not a bad problem in general.  At worst it means you should
test for the "definedness" of a variable before doing anything rash with it.  In
particular, before saying something like:

  system "rm -rf '$dir'"

you should always check that $dir contains something meaningful, whether or not
your doing it in an END block.

In any case, the following does what you want -- I think:

#!/home/bin/perl -w

my $temp=0;

sub test {
  print "in sub\n";

      END { print "ending stuff: $temp\n" if ( $temp ); }
}


if ($temp) {
  test();
}

Craig


Gregory Snow wrote:

> I greped the faqs and other docs and while they had a lot of info on
> END blocks, I didn't find what I was looking for (I found stuff that
> confirmed that the naive approach wouldn't do what I wanted), so tell
> me what you think.
>
> I want to be able to do some clean-up just before my program ends, so
> the END block sytax seems like the way to go, however, there are some
> things that I only want to do if certain things happen in the program
> (a certain subroutine gets called).  But the standard END block gets
> run either way, i.e. for the following code:
>
> #!/home/bin/perl -w
>
> my $temp=0;
>
> sub test {
>   print "in sub\n";
>   END { print "ending stuff: $temp\n"; }
>
> }
>
> if ($temp) {
>   test();
> }
>
> prints "ending stuff" regaurdless of the value of $temp, when what I
> want is for it to only print if the subroutine "test" is run.
>
> Here are the ideas that I've come up with (some tested, some not):
>
> 1.  Set a global variable (or lexical with scope including both
> subroutine and END block) in the subroutine, and check the value of
> the variable in the END block (END {print "end stuff" if $sub_ran;} ).
>
> 2.  In the subroutine(s), push references to functions onto a global
> array (or properly scoped lexical array), then in the end block pop
> off the references and run each one.
>
> 3.  Somehow use AUTOLOAD (I don't know AUTOLOAD very well, so don't
> know if or how this would work).
>
> 4.  Define a subroutine that does nothing, inside the subroutine of
> interest, use eval to redefine the subroutine that did nothing to do
> something, then call it in the end block (generates a warning).
>
> 5.  Put each subroutine in a different module with it's own end block
> and only "require" it if it will be called.
>
> My current preference is for #2, because it seems the most flexible
> while still being fairly simple and not generating warnings and can
> use closures for the clean-up if useful.  But I was wondering if there
> are any other ideas out there, or some critiques of the above ideas
> (which do you think is best and why, which should be avoided at all
> costs and why)
>
> Thanks,
>
> --
> -------------------------------------------------------------------------------
>      Gregory L. Snow         |   Imagination is the one weapon in the
>      (Greg)                  |  war against reality.
> snow@biostat.washington.edu  |                -- Jules de Gaultier



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

Date: Wed, 09 Jun 1999 14:48:27 -0400
From: Omri Schwarz <ocschwar@MIT.EDU>
Subject: cookie-monster.pl, a cookie scrambler.
Message-Id: <375EB6FA.F33F80F4@MIT.EDU>

#!/usr/athena/bin/perl
# cookie monster: a utility for scrambling the
# cookies of annoying websites.
#
# (C) Omri Schwarz
#
# Motive: a site that was configured to retry cookie requests that are
refused.

$arg_check=@ARGV;
zsrand;
@poschars_hex=("a","b","c","d","e","f","1","2","3",
               "4","5","6","7","8","9","0");
@poschars_b64=("1","2","3","4","5","6","7","8","9","0","=","/",
               "a","b","c","d","e","f","g","h","i","j","k","l","m",
               "n","o","p","q","r","s","t","u","v","w","x","y"."z",
               "A","B","C","D","E","F","G","H","I","J","K","L","M",
               "N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$site_file="$ENV{HOME}/.netscape/cookies.victims";
#Going through the subroutines.
#
for ($look_at=0; $look_at<=$arg_check; $look_at++){
    $argument = @ARGV[$look_at];
    if ($look_at < $arg_check){
        $new_site=$ARGV[$look_at+1 ];
    }
    if ($look_at < $arg_check-1){
        $last_arg=$ARGV[$look_at+2 ];
    }

    if ($argument eq "-a") {
        append_site($new_site,$site_file,$last_arg);
    } ;

    if ($argument eq "-d") {
        delete_site($site_file,$new_site);
    }
    if ($argument eq "-f") {
        $site_file=@ARGV[$look_at +1 ];
    } 
    if ($argument eq "-s") {
        scramble_cookies($site_file);
    } 
    if ($argument eq "-l") {
        list_victims($site_file);
    }

#    print "---\n";
}

sub append_site {
    open(SITEFILE,">>$site_file") || 
        open(SITEFILE,">$site_file") || 
            die "Sorry, your site list $site_file is a nono.\n";
    print SITEFILE "$new_site $last_arg\n";
    print "Adding $new_site to your victims.\n";
    close(SITEFILE);
}

sub delete_site {
    $tempfile= $site_file;
    $tempfile .= ".temp";
    print "hmm $new_site\n";

    open(SITEFILE,$site_file) || 
        die "Sorry, your site list $site_file is AWOL.\n";
    open(TEMPFILE,">$tempfile") || 
        die "Sorry, no room for temp file. ";
    while(<SITEFILE>) {
        s/$new_site//g;
        if (length($_) > 1 ) {
            print TEMPFILE $_;
        }
    }
    close(SITEFILE);
    close(TEMPFILE);
    system "mv -f $tempfile $site_file";
}
sub list_victims {
    open(SITEFILE,$site_file) || 
        die "Sorry, your site list $site_file is AWOL.\n";

    while(<SITEFILE>) {
        print STDOUT $_;
    }
    if ($argument eq "-l") {
        list_victims($site_file);
    }

#    print "---\n";
}

sub scramble_cookies {
    open(SITEFILE,$site_file) || 
        die "Sorry, your site list $site_file is AWOL.\n";
    chomp(@sites = <SITEFILE>);
    close(SITEFILE);
    open(TEMPFILE, ">$ENV{HOME}/.netscape/cookies.scrambled");
    open(COOKIEFILE,"$ENV{HOME}/.netscape/cookies") ||
        die "Sorry, your cookie file is missing.\n";
    while(<COOKIEFILE>) {
        $outgoing=$_;
        $scramble_method="hex_eq";
        @cookie = split /\s+/,$outgoing ;
        $cookie_site=$cookie[0];
#       print "\n   $cookie_site . ";
        foreach $site_entry (@sites) {
            $sitename = $site_entry;
            @entries = split $site_entry;
            if ($#entries>1){
                $sitename = $entries[0];
                $scramble_method = $entry[1];
            } 
#           print " $sitename,";

            if ($sitename eq $cookie_site){

                if ($scramble_method eq "hex_eq") {

                    scramble_hex_eq_mode($sitename,@cookie,$outgoing);
                } elsif ($scramble_method eq "b64_eq") {
                    scramble_b64_eq_mode($sitename,@cookie,$outgoing);
                } elsif ($scramble_method eq "hex") {
                    scramble_hex_mode($sitename,@cookie,$outgoing);

#
# add elsifs for other cookie modes as you see fit.
#  -Omri
#
                } else {
#                   print "baz!! ";
                    
                    scramble_hex_eq_mode($sitename,@cookie,$outgoing);
            
                }

            }
        }
        print TEMPFILE "$outgoing\n";


    }
    close(COOKIEFILE);
    close(TEMPFILE);
   system "mv -f $ENV{HOME}/.netscape/cookies.scrambled
$ENV{HOME}/.netscape/cookies";
       
}






sub scramble_hex_eq_mode {
#
# updates to this may include new methods for other cookies.
# this should be called hex mode.
# --Omri Schwarz
    my ($cookie_content);
    my ($foo);

    $cookie_content= $cookie[6]; 
#    print "$cookie_content\n";
    $equal_index=index($cookie_content,"=");
    $cookie_content=substr($cookie_content,0,$equal_index+1);
    for ($foo=$equal_index+2; $foo<=length($cookie[6]); $foo++) {
        $cookie_content .= $poschars_hex[rand(@poschars_hex)];
    }
    $cookie[6]=$cookie_content;
    $outgoing=join("\t",@cookie);
    
}

sub scramble_hex_mode {
#
# updates to this may include new methods for other cookies.
# this should be called hex mode.
# --Omri Schwarz
    my ($cookie_content);
    my ($foo);

    $cookie_content= $cookie[6]; 

    $cookie_content="";
    for ($foo=0; $foo<=length($cookie[6]); $foo++) {
        $cookie_content .= $poschars_hex[rand(@poschars_hex)];
    }
    $cookie[6]=$cookie_content;
    $outgoing=join("\t",@cookie);
    
}


sub scramble_b64_eq_mode {
#

    my ($cookie_content);
    my ($foo);

    $cookie_content= $cookie[6]; 

    $equal_index=index($cookie_content,"=");
    $cookie_content=substr($cookie_content,0,$equal_index+1);
    for ($foo=$equal_index+2; $foo<=length($cookie[6]); $foo++) {
        $cookie_content .= $poschars_b64[rand(@poschars_b64)];
    }
    $cookie[6]=$cookie_content;
    $outgoing=join("\t",@cookie);
    
}



-- 
Omri Schwarz --- 
Timeless wisdom of biomedical engineering:
"Noise is principally due to the presence of the 
patient." -- R.F. Farr


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

Date: 9 Jun 1999 13:26:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Creating an external config file. How ?
Message-Id: <375ebfd8@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "Greg Savage" <greg@paradox.net.au> writes:
:I have compilled my perl script and now need to store my configuration
:options in an external text file for ease of modification. I am looking for
:an efficient routine to read in the following pairs, ignoring # comments
:and assign them to variables.
:
:# This is a comment
:logdir /var/log
:logfile local0
:warning 2
:limit 5
:admin admin@domain.com

You did that wrong.

    :# This is a comment in myproggie.cf
    $logdir     = '/var/log';
    $logfile    = 'local0';
    $warning    = 2;
    $limit 	    = 5;
    $admin 	    = 'admin@domain.com';

Now: 

    do "myproggie.cf";";

in the real prorgam.

--tom
-- 
Weinberg's Second Law: If builders built buildings the way programmers
write programs, the first woodpecker to come along would destroy civilization.


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

Date: Tue, 08 Jun 1999 22:54:10 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Current Directory Name
Message-Id: <375dd710.0@usenet.fccj.cc.fl.us>

In article <kqc73.5987$By5.542@news4.mia>, "Donny Simonton" 
<donsimon@bellsouth.net> wrote:


> What's the easiest way to get the current directory name, but not the path.
>
> For example, if you are in the PROGRAMS directory, I need to get just the
> name of the directory, and not /home/sites/blabla/programs.


use CWD;

Then you would be a simple split away...

HTH,
-Sneex- :]
_________________________________________________________________________
Bill Jones  | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map{defined $_ ? $_ : " "} $`, $&, $', $+), "\n";}


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

Date: Tue, 08 Jun 1999 23:04:59 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Extracting form fields (HTML::Parser), then printing them?
Message-Id: <375dd99a.0@usenet.fccj.cc.fl.us>

In article <375d5821.69214995@news.erols.com>, wasteNOSPAMbasket@bigfoot.com
(Jamie Jackson) wrote:


> Anyone have any sample code that'll illustrate how to slurp form
> fields (<form>,<input>,</form>), then print them?
>
> I've got all the HTML::Parser docs here, if you want to refer to them.
> (I'm having a hard time understanding the perldocs).


Something simple, right?
Here ya go -


#!/usr/local/bin/perl -wT

# Error Checking ...
use strict;
use diagnostics;

# CGI Processing ...
use CGI qw(:all);
use CGI::Carp qw/fatalsToBrowser/;

# Variable Declarations ...
my($fccjPointer) = new CGI;
$fccjPointer->import_names('FCCJ');

# Program Logic ...
print "Content-type: text/html\n\n'Use
Diagnostics' - Initialized! &nbsp;", $fccjPointer->dump;


Enjoy!
-Sneex- :]
_________________________________________________________________________
Bill Jones  | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map{defined $_ ? $_ : " "} $`, $&, $', $+), "\n";}



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

Date: Wed, 09 Jun 1999 18:24:32 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Functions
Message-Id: <7jmbgi$r42$1@nnrp1.deja.com>

In article <7jm5va$q08$1@prometheus.acsu.buffalo.edu>,
  "Bob Perini" <perini@buffalo.edu> wrote:
> I'm trying to include a file(which has a function) into my program,
and
> can't seem to get it to work.

Have you actually read the documentation for the 'require' function?
It clearly describes a condition which you are failing to meet.

	perldoc -f require


> @INC="c:/InetPub/scripts/jeopardyalpha/addtoDB/";

Unless you have some reason to completely override the previous
setting of @INC, you're better off using the 'use lib' directive
to add new components to @INC, e.g.

	use lib ('c:/InetPub/scripts/jeopardyalpha/addtoDB');


> require "c:/InetPub/scripts/jeopardyalpha/addtoDB/addtodb.pl";

You probably know that if @INC contains that path, you don't need
it in the filename you pass to "require"; this should be sufficient:

	require "addtodb.pl";


> Now the error that I get is:
>
> c:/InetPub/scripts/jeopardyalpha/addtoDB/addtodb.pl did not return a
true
> value at C:\InetPub\scripts\jeopardyalpha\addtodb\addtodbInter.pl line
9.

Maybe if you made addtodb.pl return a true value, your problem would
be solved.  Try it.  (perldoc -f require)

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 9 Jun 1999 14:58:24 -0400
From: "Claudio Gutierrez" <cgutierr@firstcom.cl>
Subject: How to get info from a file with sed/awk/perl
Message-Id: <375eba3a.0@omega>

This is a multi-part message in MIME format.

------=_NextPart_000_00BD_01BEB288.85EF4720
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Sorry if this a basic questionand, of course, the cross post.   I need =
to process a text file containing statistics in the next way:=20
1)find the lines where appear the string 4[0-9][0-9][0-9] and after the =
4 digits a blank space
2) once we find such line, join the previous line with the curren and =
the next.

Example

aaaa aaaaaa aaaa
bbbbbb bbbbbbb bbbbbbb
4325 ccccc cccccc
ddddd dddd ddd
eeee eeeeeeeee eeee

The result:

bbbbbb bbbbbbb bbbbbbb 4325 ccccc cccccc ddddd dddd ddd

Thanks

------=_NextPart_000_00BD_01BEB288.85EF4720
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>Sorry if this a basic =
questionand, of=20
course, the cross post.</FONT><FONT color=3D#000000 face=3DArial =
size=3D2>&nbsp;&nbsp;=20
I need to process a text file containing statistics in the next way:=20
</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>1)find the lines where =
appear the=20
string 4[0-9][0-9][0-9] and after the 4 digits a blank =
space</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2) once we find such line, join the =
previous line=20
with the curren and the next.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Example</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>aaaa aaaaaa aaaa</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>bbbbbb bbbbbbb bbbbbbb</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>4325 ccccc cccccc</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ddddd dddd ddd</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>eeee eeeeeeeee eeee</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The result:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>bbbbbb =
bbbbbbb bbbbbbb=20
<FONT face=3DArial size=3D2>4325 ccccc cccccc <FONT face=3DArial =
size=3D2>ddddd dddd=20
ddd</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2><FONT =
face=3DArial=20
size=3D2><FONT face=3DArial =
size=3D2></FONT></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2><FONT =
face=3DArial=20
size=3D2><FONT face=3DArial=20
size=3D2>Thanks</FONT></FONT></FONT></FONT></DIV></BODY></HTML>

------=_NextPart_000_00BD_01BEB288.85EF4720--



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

Date: Wed, 9 Jun 1999 12:41:01 -0700
From: ZENG <zeng@haas.Berkeley.EDU>
Subject: how to pass a shell command to Perl
Message-Id: <Pine.SOL.4.05.9906091229410.6786-100000@haas.Berkeley.EDU>

I need to write a Perl program, which take a shell command and process it.
For example, let me call my program 'sw'. So I can use it like the
following:

1. sw ls
2. sw ls -l
3. sw who
4. sw more file

You got the idea. This is easy to do because I can use the @ARGV and pass
it to my program to 'sw'. 

Now it is the hard part. What if I want to do the following:

sw ls -l | grep Jun

The command runs but not what I want. The shell understands this as
process 'sw ls -l' first then pipe to 'grep Jun'. What I really want is
pass the whole command 'ls -l | grep Jun' to 'sw.

Actually, I still can solve this problem by simply quote the latter part.
i.e.

sw 'ls -l | grep Jun'

But what if I want to do

sw 'more file | grep 'Inter*st' '
or
sw 'more file | egrep 'good | bad' > newFile'

Then it broke down. Again, the goal is want to have everything after the
'sw' to pass to the Perl. Any suggestions?

Any help/hint/manpage #/sarcasm:) will be welcome.

Z.



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

Date: 9 Jun 1999 19:29:54 GMT
From: riktait@aol.com (RikTAIT)
Subject: How to write TO a socket? (client/server socket stuff)
Message-Id: <19990609152954.29320.00001080@ng33.aol.com>

Hi all,

I've written myself a nice little (actually, big) network && systems
monitoring program using perl, and I'm ready to take the next step and
plunge into making it a full client-->server app. Basically, what I am
after is something like this:

- server code starts on machine foo
- server code binds and accepts connections on port xxxx
- client code connects to port xxxx on server foo and then sends 
  data to server
- server code does <whatever> depending on data

Now, I've been experimenting with socket code, and I can quite easily
bind to my chosen socket, accept connections etc. But I can't figure
out how to have my client code write to the server socket, and then 
have the server accept it. I can only figure out how to have the
server write to the client. No good. 

Can someone give me some quick and dirty code, two programs:
1) server code that accepts connections on a port and then basically
   prints to stdout out anything that is sent to it via the port? 
2) client code that connects to said port and writes a sentence to
   that port and then exits

I know I am *so* close - I am just missing something pretty 
fundamental. 

Please folks - all I need is that small push over the edge!

Thanks much in advance,
Rik (riktait@aol.com)



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

Date: Wed, 09 Jun 1999 13:51:56 -0500
From: Burton Kent <burton@lucent.com>
Subject: Installing Modules and MakeMaker
Message-Id: <375EB7CC.943DC14E@lucent.com>

I'm trying to install String::Approx in my personal
lib directory.  I've installed modules in the past, but
this one just won't work!  I don't understand why not,
since the path seems right.

To install, I used (I've successfully used this in the past)
perl Makefile.PL PREFIX=~ LIB=~/lib/perl


This time it doesn't work.  I keep getting this message:

Can't locate loadable object for module String::Approx in @INC (@INC contains:
[snip] /home/burton/lib/perl /home/burton/lib/perl/sun4-solaris/auto [snip]


The library I want to use is located at:
/home/burton/lib/perl/String/Approx.pm

There are also some binary files at 
/home/burton/lib/perl/sun4-solaris/auto/String/Approx/
called Approx.bs  Approx.so

All files have the correct permissions!  What could I
be doing wrong?


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

Date: Tue, 08 Jun 1999 22:41:30 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Interesting Update
Message-Id: <375dd415.0@usenet.fccj.cc.fl.us>

In article <375D44D1.BBF7259@workmail.com>, Raj <technology@workmail.com> 
wrote:


> * My CGI/Perl script shoud update a textfile eliminating
> duplicate rows(lines)
> * I'm trying to delete an "a.ext" file thru the system command
> System("rm $filename.ext");
> from within my script.
> but the file is not getting deleted. Any clue?


perldoc -f unlink

Do not use system() to do what perl can already do.

HTH,
-Sneex- :]
_________________________________________________________________________
Bill Jones  | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map{defined $_ ? $_ : " "} $`, $&, $', $+), "\n";}


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

Date: Wed, 09 Jun 1999 13:18:57 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Intersection of several lists
Message-Id: <375EB011.FC5EA3A3@us.ibm.com>

Thomas Weholt wrote:

> I got several ( 3 - 15) lists that I need to put into one, containing
> only the items that are in all the lists ( intersection ).

You should be able to modify the following FAQ into something that you
can use:
http://language.perl.com/newdocs/pod/perlfaq4.html#How_do_I_compute_the_difference_

If you have any trouble, post the broken piece of your code along with
an explanation of both what it's doing, and what you think it should be
doing.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Wed, 09 Jun 1999 15:24:00 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: macperl - directory names with embedded spaces
Message-Id: <dwilgaREMOVE-0906991524000001@wilga.mtholyoke.edu>

In article <7jm0fa$m5p$1@nnrp1.deja.com>, tom.hambleton@lmco.com wrote:

> How do I specify the path to a file where the some of the folder
> (directory) names have embedded spaces?
> 
> Similiar to,
> 
>         tah 1:new applications:perl tests:filename
> 
> I'm an admitted perl novice..

Just put it in quotes when you pass it as a parameter to open() or
whatever other function you're using.

  open( '<tah 1:new applications:perl tests:filename' );

(One thing to note as an aside: I've found that you can't rely on the
default path being anything in particular on the Mac. So if you did just
open('filename') or even the more Mac-correct open(':filename'), it might
be trying to open something in the working directory of some other app.
The way you're doing it, with absolute paths, is one way around this.
Another way is to use "chdir" to go the directory you want to use.)

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: Wed, 9 Jun 1999 12:38:18 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: macperl - directory names with embedded spaces
Message-Id: <Pine.GSO.4.02A.9906091234590.26349-100000@user2.teleport.com>

On Wed, 9 Jun 1999 tom.hambleton@lmco.com wrote:

> How do I specify the path to a file where the some of the folder
> (directory) names have embedded spaces?

The same way as with any other file name. :-) 

    my $file_name = "I've got spaces";
    open FILE, $file_name
	or die "Can't open '$file_name': $!";

Well, I know that was the file name which had spaces in it, but it's the
same principle. Have fun with Perl!

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



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

Date: 9 Jun 1999 18:55:15 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: MySQL Placeholders II
Message-Id: <slrn7lte4j.s2k.billynospam@wing.mirror.bt.co.uk>

In article <7jm9um$3m6$1@taliesin.netcom.net.uk>, Clinton Gormley wrote:

>Sorry, another placeholder issue

I'm not sure that this is the best place for this, but...

>I'm trying to do this :
>SELECT * FROM Table WHERE Id IN (1,2,3,4)
>
>I'd like to replace the 1,2,3,4 with a place holder, but it looks like I
>would have to do this :
>SELECT * FROM Table WHERE Id IN (?,?,?,?)
>
>Only problem is, I don't know how many numbers I will have beforehand.

can't you create the SQL statement once you know how many placeholders
you'll need? put a little loop in that adds enough ",?" strings in for
your requirements.

better yet, if you really do want to do 1,2,3,4, why not change your SQL
so that you say "SELECT blah WHERE Id BETWEEN ? AND ?" ?

-- 
Graham


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

Date: Wed, 09 Jun 1999 18:12:30 GMT
From: Hecubas <hecubas1@my-deja.com>
Subject: Re: Mysql Placeholders
Message-Id: <7jmaq3$qqg$1@nnrp1.deja.com>

In article <7jm66o$2ic$1@taliesin.netcom.net.uk>,
  "Clinton Gormley" <clint@drtech.co.uk> wrote:
> I'm using the latest version of DBI::MySQL with the latest version of
MySQL.
>
> I'm trying to do this :
>
> $sth=$dbh->prepare(<<END);
> SELECT Blurb FROM Blurb WHERE BlurbID='?'
> END

I would try:
SELECT Blurb FROM Blurb WHERE BlurbID=?

The quotes around your question mark are most likely the culprit.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 9 Jun 1999 12:39:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need a book ...
Message-Id: <Pine.GSO.4.02A.9906091238440.26349-100000@user2.teleport.com>

On Wed, 9 Jun 1999, Matthew G. Turland wrote:

> The form refuses to function; specifically, it
> brings up a blank message instead of sending the form data. 

Sounds as if you've got a browser problem. Maybe you should check with the
docs, FAQs, and newsgroups about browsers and related issues. Good luck!

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




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

Date: Wed, 9 Jun 1999 12:34:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl debugging in emacs
Message-Id: <Pine.GSO.4.02A.9906091232100.26349-100000@user2.teleport.com>

On Wed, 9 Jun 1999, Dan Pelton wrote:

> When ever I redirect stdin to a file, the debugger still
> reads from the keyboard.

I'm not completely sure, never having needed it, but I think you want the
noTTY option described in the perldebug manpage. Good luck!

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



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

Date: Wed, 09 Jun 1999 20:23:32 +0100
From: Csaba Raduly <csaba.raduly@sophos.com>
Subject: Re: PERL T SHIRT FOR SALE
Message-Id: <375EBF34.EA0424E2@sophos.com>

Clinton Pierce wrote:
> 
> On Sun, 06 Jun 1999 18:03:47 -0400, brian@pm.org (brian d foy) wrote:
> 
> >In article <7jd7go$lmb$1@news.inc.net>, "Jamie Brown" <brownjj@iserve.net> posted:
> >
> >>  You won't break a sweat on your next project with our PERL shirt!
> >
> >shouldn't that be "Perl"? ;)
> 
> I always wear my Perl shirt on the opening night of teaching my Perl
> class.  It's a Second Edition Programming Perl shirt--but the book cover
> (on the shirt) is pink.  I got it at LISA X, the week that the Second
> Edition Camel went on sale (and they had none)!
> 
> It's also signed by Larry, Randal and Tom.
> 
> I'll wear another Perl shirt, when someone pries this one from my cold,
> dead fingers.
> --
> Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
> clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
> http://www.geeksalad.org

That proposal is acceptable ! 
Where do you live ? :-)

--
GOD is real - unless explicitly declared integer.
Life is complex, with real and imaginary parts.


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

Date: Wed, 09 Jun 1999 13:55:13 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: problem reporting and tracking package?
Message-Id: <375EAA81.D7248090@xli.com>


if your're not attached to the program being in Perl, 
I think theres a program called GNATS, which is open source,
that you might be able to use. we used it at one of my
previous employers. it was a Unix tool, so if your on NT,
then I dont know what you'd use.

I dont know where you can download it though.
gnats => gnu something tracking system
I think...

Greg "could I be a little more vague" Bartels


Doug Elias wrote:
> 
> G'day ...
> 
> Before I get started on one of these myself, I thought I'd just check
> to see if anyone else has already written a Problem Reporting and
> Tracking application ... already checked CPAN and didn't see anything.
> 
> Thanks,
> doug
> --
> Doug Elias, Ph.D.
>   __|_        Internet:   dme7@cornell.edu
> dr _|_)oug    USmail:     Director of Technology
>   (_|                     Parker Center/Johnson Grad. School of Mgmt.
>   (_|__lias               302 Sage Hall/C.U./Ithaca/N.Y./14853-6201
>     |         Phone:      607-255-3521   Fax: 607-254-4590


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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