[19612] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1807 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 24 18:06:03 2001

Date: Mon, 24 Sep 2001 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001369113-v10-i1807@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 24 Sep 2001     Volume: 10 Number: 1807

Today's topics:
    Re: a bit of help please. (J.B. Moreno)
    Re: Best way to hide the perl source code.. <uri@sysarch.com>
        Can not grab program output on error <novastar@novastar.dtdns.net>
    Re: Checking for an empty hash?? nobull@mail.com
    Re: Creating a file (BUCK NAKED1)
    Re: eval-statement fools garbage-collection ? nobull@mail.com
    Re: eval-statement fools garbage-collection ? <pilsl_@goldfisch.at>
        Hash containing Array's question.. (JHenstay)
    Re: Hash containing Array's question.. <ren@tivoli.com>
    Re: Hash containing Array's question.. <tsee@gmx.net>
    Re: Hash containing Array's question.. <ronh@iainc.com>
    Re: Hash containing Array's question.. <glex@qwest.net>
    Re: How do I compare strings? <bart.lateur@skynet.be>
        How do I get a list of files in a directory using perl? <scott.bell1@ntlworld.com>
    Re: How do I get a list of files in a directory using p <rsherman@ce.gatech.edu>
    Re: How do I get a list of files in a directory using p <scott.bell1@ntlworld.com>
    Re: How do I get a list of files in a directory using p <rsherman@ce.gatech.edu>
    Re: How do I get a list of files in a directory using p <jurgenex@hotmail.com>
    Re: How to remove whitespace without losing the 'real'  <uri@sysarch.com>
    Re: How to remove whitespace without losing the 'real'  (Tim Hammerquist)
        How to send a cookie from perl to perl? <mdudley@execonn.com>
    Re: Looking for Perl programers in Toronto <dha@panix.com>
        OPEN file inside a compress gz (EP)
    Re: OPEN file inside a compress gz <glex@qwest.net>
    Re: Perl-Oracle database connectivity <ron@indra.com>
    Re: Perl-Oracle database connectivity <brian@jankoNOnet.SPAMcom.INVALID>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Sep 2001 16:27:08 -0400
From: planb@newsreaders.com (J.B. Moreno)
Subject: Re: a bit of help please.
Message-Id: <1f08wcz.rffvu6a2wl2hN%planb@newsreaders.com>

NEWS <na> wrote:

> "Dave Tweed" <dtweed@acm.org> wrote in message
-snip-
> > NEWS wrote:
> > > thanks that is really handy, but for example how would i make the
> > > clock/timer count in 10's but by the second?
>
> > Do you understand what I wrote? Do you understand Perl at all?
>
> no i dont - hence the opening lines of "im new to perl" just trying to
> learn by using online info and comparing scripts to see what they do and
> how they do it.

Perl generally isn't considered the ideal first language, which I assume
this is for you, otherwise it'd have been fairly obvious what you would
need to do to make it count by 10.

> if you can offer advice without getting on your high horse, then dont offer
> advise at all.

Your best bet is to either get a book on programming or take a
programming course, learn the basics without any reference to perl and
then come back to it afterwords.

-- 
JBM
"Your depression will be added to my own" --  Marvin of Borg


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

Date: Mon, 24 Sep 2001 18:17:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Best way to hide the perl source code..
Message-Id: <x7r8swbghr.fsf@home.sysarch.com>

>>>>> "MH" == Michael Houghton <herveus@Radix.Net> writes:

  MH> Howdy!
  MH> In article <9ohcf3$ha2$1@towncrier.cc.monash.edu.au>,
  MH> Damian Conway <damian@cs.monash.edu.au> wrote:
  >> Dan Sugalski <dan@tuatha.sidhe.org> writes:
  >> 
  >>>> That's Acme::Bleach...
  >> 
  >>> Acme::Buffy would work too. And Acme::DWIM isn't that bad either...
  >> 
  >> Also Lingua::Romana::Perligata and (by Christmas!) Lingua::thlInganHol::yIghun.
  >> 
  >> Damian

  MH> Sir, you are a sick, sick man...

you just found out? :)

that is why YAS has been funding him for 1+ years.

we gets our moneys worth. :)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: Mon, 24 Sep 2001 23:17:01 +0300
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Can not grab program output on error
Message-Id: <9oo466$mm1$1@usenet.otenet.gr>

I was writing a big perl program, and everything was fine untill the point I
had to grab a program output on fault conditions. Disaster, perl returned
absolute nothing ( WinNT4 )

@output=`dir /zz`;
foreach (@output) {  print "$_\n";  }

The @output array is completely empty.  It is not the dir command but a good
example to the situation I face, please help.




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

Date: 24 Sep 2001 18:56:30 +0100
From: nobull@mail.com
Subject: Re: Checking for an empty hash??
Message-Id: <u91ykwwjzl.fsf@wcl-l.bham.ac.uk>

Carlos C. Gonzalez <aperlprogrammer@yahoo.com> writes:

> if (%hash = new_person()) {

> sub new_person
> {
>   return {};
> }

%hash is a hash.  new_person() returns a _reference_ to a hash.  This
is not the same thing.

Assigning to a hash replaces the contents of the hash with the
keys/values taking alternate elements of the list.

You should probably stick with using only references.

You should also enable warnings as your code would have generated
warning that would have given you a clue to your mistake.

Carlos C. Gonzalez <aperlprogrammer@yahoo.com> writes:

> my %hash = (
>   first_name => "Tom",
>   last_name  => "Smith",
>   age        => 41 );
> 
> print $hash{first_name};
> 
> if (%hash = new_person()) {
>   print $hash{first_name};
> }

Change that to:

 my $hash = {
   first_name => "Tom",
   last_name  => "Smith",
   age        => 41 };
 
 print $$hash{first_name}; # or $hash->{first_name}
 
 if ($hash = new_person()) {
    print $$hash{first_name};
 }

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 24 Sep 2001 13:49:23 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Creating a file
Message-Id: <16676-3BAF8033-54@storefull-248.iap.bryant.webtv.net>

I don't recommend using >> when opening a file. It always clobbers files
when I use it, and often creates garbage files.

I like to use sysopen. See perldoc -f sysopen. Of course, you'll need to
call out the Fnctl module to use it; but it comes with the regular
distribution I believe.

Good Luck!
--Dennis
"just trying to help instead of ask for a change" :-)



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

Date: 24 Sep 2001 18:46:19 +0100
From: nobull@mail.com
Subject: Re: eval-statement fools garbage-collection ?
Message-Id: <u94rpswkgk.fsf@wcl-l.bham.ac.uk>

mgjv@tradingpost.com.au (Martien Verbruggen) writes:

> I do not have a 5.6.0 without threads, or a 5.6.1 with threads, but it
> looks like the problem was either fixed between 5.6.0 and 5.6.1 or it is
> related to thread support.

I doubt that it's that simple I've reproduced the bug on 5.6.0 (Linux)
and 5.6.1 (ActiveState-Win32).

Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define

Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration:
  Platform:
    osname=linux, osvers=2.2.16, archname=i586-linux
    uname='linux wcl-l 2.2.16 #1 wed aug 2 20:22:26 gmt 2000 i586 unknown '
    config_args='-d'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 24 Sep 2001 23:59:20 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: eval-statement fools garbage-collection ?
Message-Id: <3bafacb9$1@e-post.inode.at>

Joe Schaefer wrote:


> 
> Completely agreed- 5.6.1 is much improved over 5.6.0; but it's still
> very easy to produce memory leaks when working with closures, eval,
> and the like.  A nasty one (and it's not entirely uncommon in a
> modperl setting) was discussed recently on p5p and the modperl mailing
> lists:
>

I just installed perl5.6.1 (and made my $%&#-mandrake8 distribution almost 
unusable by doing so - even vim didnt work any more - but thats another 
story) and my problem is solved for the moment.
The problem does not occure under 5.6.1 on a linux2.4.10-machine. Cant 
check it out on the BSD-machine, cause I need to talk with the admin before 
upgrading.

I really prefer the undef against the 'manual' deletion of my structure, 
cause it is very much faster.  Manual deletion can be very slow on big 
structures, where arrays with thousends of entries can hold references 
too...

Nevertheless I'll have to write a modified dest-routine cause the script 
needs to run on other systems too and I cant require 5.6.1 installed there. 
Maybe its enough to free the sub-references manually and let undef do the 
rest. I'll check this out.

>   {
>     my $bigvar = "really big variable";
>     my $x = sub { sub { $bigvar } };
>   }
> 

Thats an interesting example too. One can easily imagine such construct 
under mod_perl.

thnx a lot,
peter


-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: 24 Sep 2001 13:11:29 -0700
From: Joseph_Henstay@yahoo.com (JHenstay)
Subject: Hash containing Array's question..
Message-Id: <23b7814d.0109241211.85fbc5e@posting.google.com>

I am trying to get a length of an array that is contained within a
hash and I am just going in circles here.  If I have something like
this:

-----
my %HashTest;

$HashKey = "Var_1";

$HashTest{$HashKey} = ();

$HashTest{$HashKey}[0] = "Test 1";
$HashTest{$HashKey}[1] = "Test 2";

$ArrayRef = $HashTest{$HashKey};

$ArrayLen = @$ArrayRef;

-----

It does give me the length of the array in $ArrayLen.  However, what I
do not understand is why I can not do it all in one line such as:

$ArrayLen = @($HashTest{$HashKey});

What am I missing here?

Thanks,
 -JH

Joseph_Henstay@yahoo.com


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

Date: 24 Sep 2001 15:25:21 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Hash containing Array's question..
Message-Id: <m3u1xsfia6.fsf@dhcp9-161.support.tivoli.com>

On 24 Sep 2001, Joseph_Henstay@yahoo.com wrote:

> I am trying to get a length of an array that is contained within a
> hash and I am just going in circles here.  If I have something like
> this:
> 
> -----
> my %HashTest;
> 
> $HashKey = "Var_1";
> 
> $HashTest{$HashKey} = ();

This is useless and doesn't really do what you seem to think.

> $HashTest{$HashKey}[0] = "Test 1";
> $HashTest{$HashKey}[1] = "Test 2";
> 
> $ArrayRef = $HashTest{$HashKey};
> 
> $ArrayLen = @$ArrayRef;
> 
> -----
> 
> It does give me the length of the array in $ArrayLen.  However, what
> I do not understand is why I can not do it all in one line such as:
> 
> $ArrayLen = @($HashTest{$HashKey});
> 
> What am I missing here?

So close!

  $ArrayLen = @{$HashTest{$HashKey}};

-- 
Ren Maddox
ren@tivoli.com


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

Date: Mon, 24 Sep 2001 22:33:55 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Hash containing Array's question..
Message-Id: <9oo5b5$3s0$00$1@news.t-online.com>

"JHenstay" <Joseph_Henstay@yahoo.com> schrieb im Newsbeitrag
news:23b7814d.0109241211.85fbc5e@posting.google.com...

[snip]

> $ArrayLen = @($HashTest{$HashKey});
>
> What am I missing here?

curly brackets at the very least.

$ArrayLen = @{ $HashTest{$HashKey} };

Steffen




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

Date: Mon, 24 Sep 2001 20:42:16 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: Hash containing Array's question..
Message-Id: <IUMr7.94580$Hm.1047364@typhoon.mw.mediaone.net>

Try ...

$ArrayLen = @{$HashTest{$HashKey}};

You could read perlreftut about using the curlies.

"JHenstay" <Joseph_Henstay@yahoo.com> wrote in message
news:23b7814d.0109241211.85fbc5e@posting.google.com...
> I am trying to get a length of an array that is contained within a
> hash and I am just going in circles here.  If I have something like
> this:
>
> -----
> my %HashTest;
>
> $HashKey = "Var_1";
>
> $HashTest{$HashKey} = ();
>
> $HashTest{$HashKey}[0] = "Test 1";
> $HashTest{$HashKey}[1] = "Test 2";
>
> $ArrayRef = $HashTest{$HashKey};
>
> $ArrayLen = @$ArrayRef;
>
> -----
>
> It does give me the length of the array in $ArrayLen.  However, what I
> do not understand is why I can not do it all in one line such as:
>
> $ArrayLen = @($HashTest{$HashKey});
>
> What am I missing here?
>
> Thanks,
>  -JH
>
> Joseph_Henstay@yahoo.com




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

Date: Mon, 24 Sep 2001 16:05:38 -0500
From: Jeff Gleixner <glex@qwest.net>
Subject: Re: Hash containing Array's question..
Message-Id: <3BAFA022.E3966ADE@qwest.net>


> It does give me the length of the array in $ArrayLen.  However, what I
> do not understand is why I can not do it all in one line such as:
> 
> $ArrayLen = @($HashTest{$HashKey});
> 
> What am I missing here?

@{$HashTest{$HashKey}}

-- 
Jeff Gleixner
Steven Wright Saying of the moment:
	When I was crossing the border into Canada, they asked if I
	had any firearms with me.  I said, "Well, what do you need?"


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

Date: Mon, 24 Sep 2001 20:08:05 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How do I compare strings?
Message-Id: <ba4vqto422aj579pspgu8bg4imj51m0oii@4ax.com>

Dimitri wrote:

>I have two very long strings, which I need to compare. I am looking for
>the position of the first mismatching character :
>
>$str1: abcdefghijklmn....
>$str2: abcdefghiXklmn..
>$pos :          9
>
>How can I find this position, short of writing a for loop that will go
>through each string and use substr to compare character by character?

One name for this is "common prefix length". And the mechanism that
seems best accepted by perl geeks, is doing bitwise xor (with ^ ) on the
strings, and getting the length of the leading prefix of null bytes.

	("$str1" ^ "$str2") =~ /^(\0*)/;
	$pos = length $1;

Note: $str1 and $str2 MUST be strings. If there's any chance that one of
them is a number, i.e. last used as a number, for example by using it in
a mathematical expression, the bitwise xor will work on the numerical
values, and not on the bytes that make up the strings. That is why I
sstringify them here, just to make sure.

-- 
	Bart.


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

Date: Mon, 24 Sep 2001 20:59:19 +0100
From: "Scott Bell" <scott.bell1@ntlworld.com>
Subject: How do I get a list of files in a directory using perl?
Message-Id: <H2Mr7.3313$2K4.718824@news6-win.server.ntlworld.com>

I'm writing a webpage that gives the user a list of files in a directory, so
far I have this:

   $dir = parse_dir("", '+0000');
   print $dir;

When I view the webpage it just gives me ARRAY(0x17a2454), so what am I
doing wrong?


--
Scott Bell
Email: scott.bell1@ntlworld.com

The content of this message has been certified 100% correct.





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

Date: Mon, 24 Sep 2001 15:55:49 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: How do I get a list of files in a directory using perl?
Message-Id: <3BAF1135.D4D9E5FD@ce.gatech.edu>

Scott Bell wrote:
> 
> I'm writing a webpage that gives the user a list of files in a directory, so
> far I have this:
> 
>    $dir = parse_dir("", '+0000');
>    print $dir;
> 
> When I view the webpage it just gives me ARRAY(0x17a2454), so what am I
> doing wrong?
> 
> --
> Scott Bell
> Email: scott.bell1@ntlworld.com
> 
> The content of this message has been certified 100% correct.


looks like it is returning a reference to an array. try: 

print @$dir;

-- 
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa


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

Date: Mon, 24 Sep 2001 21:24:22 +0100
From: "Scott Bell" <scott.bell1@ntlworld.com>
Subject: Re: How do I get a list of files in a directory using perl?
Message-Id: <bqMr7.3464$2K4.738035@news6-win.server.ntlworld.com>

that just gives me a null string, I could be doing parse_dir wrong?

--
Scott Bell
Email: scott.bell1@ntlworld.com

The content of this message has been certified 100% correct.

Robert Sherman <rsherman@ce.gatech.edu> wrote in message
news:3BAF1135.D4D9E5FD@ce.gatech.edu...
> Scott Bell wrote:
> >
> > I'm writing a webpage that gives the user a list of files in a
directory, so
> > far I have this:
> >
> >    $dir = parse_dir("", '+0000');
> >    print $dir;
> >
> > When I view the webpage it just gives me ARRAY(0x17a2454), so what am I
> > doing wrong?
> >
> > --
> > Scott Bell
> > Email: scott.bell1@ntlworld.com
> >
> > The content of this message has been certified 100% correct.
>
>
> looks like it is returning a reference to an array. try:
>
> print @$dir;
>
> --
> robert sherman
> css, cee
> georgia institute of technology
> atlanta, ga, usa




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

Date: Mon, 24 Sep 2001 16:42:57 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: How do I get a list of files in a directory using perl?
Message-Id: <3BAF1C41.4B43FDE4@ce.gatech.edu>

Scott Bell wrote:
> 
> that just gives me a null string, I could be doing parse_dir wrong?
> 
>     $dir = parse_dir("", '+0000');

i am not familiar with parse_dir...is it part of a module? but anyway,
the standard way to read the contents of a directory with perl is with
opendir and readdir like this:

---------------------------
#get filehandle for directory
opendir DIR, "/path/to/directory";

#read contents of directory into array
@list = readdir DIR;

#print out the directory listing
for (@list) {
print $_."\n";
}
---------------------------

hth.

-- 
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa


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

Date: Mon, 24 Sep 2001 14:11:59 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How do I get a list of files in a directory using perl?
Message-Id: <3bafa19f$1@news.microsoft.com>

"Robert Sherman" <rsherman@ce.gatech.edu> wrote in message
news:3BAF1C41.4B43FDE4@ce.gatech.edu...
> Scott Bell wrote:
> >
> > that just gives me a null string, I could be doing parse_dir wrong?
> >
> >     $dir = parse_dir("", '+0000');
>
> i am not familiar with parse_dir...is it part of a module? but anyway,
> the standard way to read the contents of a directory with perl is with
> opendir and readdir like this:

And of course Perl offers alternative ways, too, e.g. globbing:

@list = <*>;

jue





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

Date: Mon, 24 Sep 2001 18:25:00 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to remove whitespace without losing the 'real' whitespace?
Message-Id: <x7ofo0bg4q.fsf@home.sysarch.com>

>>>>> "TH" == Tim Hammerquist <tim@vegeta.ath.cx> writes:

  >> >testfile contains examples like
  >> >    a  b
  >> >   c
  >> >  d
  >> >e
  >> >
  >> >and the output should be like
  >> >a b
  >> >c
  >> >d
  >> >e

  TH> while (<>) {
  TH>     s/[ \t]+/ /g;
  TH>     s/[ \t]*$//;
  TH>     s/^[ \t]*//;
  TH>     print;
  TH> }

tr is just perfect for this:

	tr/ \t/ /s ;
	s/^ // ;
	s/ $// ;

and that can be one lined:

	perl -pi -e 'tr/ \t/ /s ; s/^ // ; s/ $//' file

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: Mon, 24 Sep 2001 20:55:04 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to remove whitespace without losing the 'real' whitespace?
Message-Id: <slrn9qv869.45p.tim@vegeta.ath.cx>

Me parece que Uri Guttman <uri@sysarch.com> dijo:
> >>>>> "TH" == Tim Hammerquist <tim@vegeta.ath.cx> writes:
> 
>   >> >testfile contains examples like
>   >> >    a  b
>   >> >   c
>   >> >  d
>   >> >e
>   >> >
>   >> >and the output should be like
>   >> >a b
>   >> >c
>   >> >d
>   >> >e
> 
>   TH> while (<>) {
>   TH>     s/[ \t]+/ /g;
>   TH>     s/[ \t]*$//;
>   TH>     s/^[ \t]*//;
>   TH>     print;
>   TH> }
> 
> tr is just perfect for this:
> 
> 	tr/ \t/ /s ;
> 	s/^ // ;
> 	s/ $// ;
> 
> and that can be one lined:
> 
> 	perl -pi -e 'tr/ \t/ /s ; s/^ // ; s/ $//' file

Damn. Yeah, this is what I would have written, if I were more familiar
with the tr op.

Thx.
-- 
E Pluribus Unix


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

Date: Mon, 24 Sep 2001 12:50:28 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: How to send a cookie from perl to perl?
Message-Id: <3BAF6453.8647CE12@execonn.com>

How do you send a cookie from one perl script to another.

http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2109.html indicates that
you put the following syntax in the header:

Cookie: $Version="1"; name="value";

But that does not seem to work at all.  I am unable to use normal
cookies because cookies cannot be passed between domains. So in a blind
GET request I need to pass the ID cookie so the 3rd party affiliate
program will know the affiliate ID.

This is the code I am using. If anyone knows how to do it, I would
appreciate a response.  Thanks,

Marshall

Script to send blind GET to affiliate program with ID in cookie:

sub do_affiliate {

my $path;
my ($affiliate,$total,$subtotal) = @_;
my $chopped;
$affiliate =~ s/http:\/\///i;   #remove http://
$affiliate =~ s/https:\/\///i;
if ($affiliate =~ /\//) {       #if there is any path information
        $affiliate =~ /([\w-]+)(\/.+)/;
        $them = $1;
        $path = $2;
} else { $them = $affiliate; }
$function = "GET";
$workFile = "$path?total=$total&subtotal=$subtotal";
$versionInfo = "HTTP/1.0\n\n";

$id = $cookie{'AFFIL'};
#print "ID = $id<br>";
#The following line is suppose to send the cookie AFFILIATE=[ID], but
doesn't
$request = "$function $workFile $versionInfo\nCookie: \$Version=\"1\";
AFFILIATE=\"$id\";\n\n";
#print "affiliate = $them doing $request<p>";
&do_socket;
}

sub do_socket {

$AF_INET = 2;
$SOCK_STREAM = 1;
$sockaddr = "S n a4 x8";
$port = 80;

$errmsg = "";

($name, $aliases,$proto) = getprotobyname('tcp');
($name, $aliases,$port) = getservbyport($port,'tcp') unless $port
=~/^\d+$/;
($tname, $aliases,$type, $len, $thisaddr) = gethostbyname($hostname);
($name, $aliases,$type, $len,$thataddr) = gethostbyname($them);
#($taddr)=gethostbyname("www.ups.com");
#print "DEBUG: join(".",unpack("C4",$taddr))\n";

$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
eval
    {
        if (socket(S, $AF_INET, $SOCK_STREAM, $proto) < 0)
                {
                $raveServer = 0;
                return 0;
                }
        select(S);
        $| = 1;
        select(STDOUT);
        if (bind(S, $this) < 0)
                {
                $raveServer = 0;
                return 0;
                }
        if (!connect(S, $that))
                {
                $raveServer = 0;
                return 0;
                }
    };

print S "$request\n";
$resultlist = '';
while (<S>)
        {
        $resultlist .=$_;
        }
close(S);

open (LOG,">affiliate.log");
print LOG "result = $resultlist<p>";
close LOG;
}
1;




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

Date: 24 Sep 2001 20:01:41 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: Looking for Perl programers in Toronto
Message-Id: <slrn9qv4bi.2i6.dha@panix2.panix.com>

In article <orcp7.60560$j65.10376207@news4.rdc1.on.home.com>, hallaj wrote:
> 
> I'm looking for perl programers in Toronto. Contact me if you
> know one.

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

http://jobs.perl.org may be of more use to you

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
<< Atheists are so fun to poke with sharp sticks.>> 
Or sleep with.  Because they try really hard not to scream "OH GOD."
   - <<wheelekb>> and Vertilgo in goats-fans


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

Date: 24 Sep 2001 11:59:25 -0700
From: pomar@us.ibm.com (EP)
Subject: OPEN file inside a compress gz
Message-Id: <21d50f98.0109241059.6f0813a4@posting.google.com>

Is it possible to read a file for open in Perl that is part of a zip
(gz) file? For example. I have a file.gz. I compressed a bunch of
files into it. Like gzip -c file1 file2 > file.gz.
Can I open file1 for read inside a perl script?
I tried something in the format: 

open (FILE, "gzip -d -c $inDir/$file.gz |grep -i file1 |") or die
"can't   gzopen $file: $!";

However, I didn't have much luck with that. 

Any ideas on this one? 

Thanks, 
EP


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

Date: Mon, 24 Sep 2001 16:26:33 -0500
From: Jeff Gleixner <glex@qwest.net>
Subject: Re: OPEN file inside a compress gz
Message-Id: <3BAFA509.88C2C39B@qwest.net>

EP wrote:
> 
> Is it possible to read a file for open in Perl that is part of a zip
> (gz) file? For example. I have a file.gz. I compressed a bunch of
> files into it. Like gzip -c file1 file2 > file.gz.
> Can I open file1 for read inside a perl script?
> I tried something in the format:
> 
> open (FILE, "gzip -d -c $inDir/$file.gz |grep -i file1 |") or die
> "can't   gzopen $file: $!";
> 
> However, I didn't have much luck with that.

Right. You've concatenated your files into one file.  Roughly all you're
doing is:

% cat f1 f2 f3 ... fn > f
% gzip f

Take a look at "f" before you compress, it's just one file of
information with no knowledge that its contents are actually separate
files.

> Any ideas on this one?
o Use Tar, or something else to keep the file information.  Then you'd
need to untar it and open the various files.  Possibly Archive::Tar or
Archive::Any might help you.

o Add something to the beginning of each file, "###Begin file1", then
read through the file looking for that line, until you find another
###Begin.  Pick your unique line carefully.

o Maybe it's simpler to just gzip each file, then gunzip.  The
open/gzip/grep works, although you should have full paths to them, it's
that you've lost all information in file.gz that its contents are
actually different files.

See ya
-- 
Jeff Gleixner
What I've learned so far, from a kid's point of view :
	Don't get hit in the stomach right after you eat.


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

Date: Mon, 24 Sep 2001 12:54:24 -0600
From: Ron Reidy <ron@indra.com>
Subject: Re: Perl-Oracle database connectivity
Message-Id: <3BAF8160.AA48C77E@indra.com>

Brian Janko wrote:
> 
> I'm trying to set up Perl-Oracle database connectivity on our servers.
> 
> I ran the comman perldoc DBI and found that we had the DBI documentation.
> 
> I ran the code below (which I got from a book) on our server and got the
> following error message.
> 
> " Can't locate loadable object for module DBI in @INC (@INC contains:
> /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1
> /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
> /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at
> /usr/local/lib/perl5/site_perl/DBI.pm line 180
> BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/DBI.pm
> line 180.
> Compilation failed in require at available.pl line 5.
> BEGIN failed--compilation aborted at available.pl line 5."
> 
> Can someone give me an idea of what's going on here and how I can get this
> connectivity happening?
> 
> Thanks,
> Brian
> 
> #!/usr/bin/perl
> #available.plx
> use warnings;
> use strict;
> use DBI;
> 
> print "Available DBI Drivers and Data Sources:\n\n";
> my @drivers=DBI->available drivers('quiet');
> my @sources;
> 
> foreach my $driver (@drivers)
> 
> {
>  print "$driver\n";
>  @sources=eval { DBI->data_sources($driver) };
>  if ($@)
>  {
>   print "\tError: ", substr($@,0,60),"\n";
>  }
>  elsif (@sources)
>  {
>   foreach (@sources)
>   {
>    print "\t$_\n";
>   }
>  }
>  else
>  {
>   print "\tNo known data sources.\n";
>  }
> }

This looks like a problem with DBI.

Execute the following commands:

1.  perl -MDBI -e '0'
2.  perl -MDBD::Oracle -e '0'

Both of the above commands should return no errors or warnings.  If
errors or warnings are returned, you do not have the module specified by
the -M switch correctly installed.

-- 
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: Mon, 24 Sep 2001 19:02:17 GMT
From: "Brian Janko" <brian@jankoNOnet.SPAMcom.INVALID>
Subject: Re: Perl-Oracle database connectivity
Message-Id: <ZqLr7.280096$Lw3.17832437@news2.aus1.giganews.com>

Thanks!

Brian


"Ron Reidy" <ron@indra.com> wrote in message
news:3BAF8160.AA48C77E@indra.com...
> Brian Janko wrote:
> >
> > I'm trying to set up Perl-Oracle database connectivity on our servers.
> >
> > I ran the comman perldoc DBI and found that we had the DBI
documentation.
> >
> > I ran the code below (which I got from a book) on our server and got the
> > following error message.
> >
> > " Can't locate loadable object for module DBI in @INC (@INC contains:
> > /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1
> > /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
> > /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .)
at
> > /usr/local/lib/perl5/site_perl/DBI.pm line 180
> > BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/DBI.pm
> > line 180.
> > Compilation failed in require at available.pl line 5.
> > BEGIN failed--compilation aborted at available.pl line 5."
> >
> > Can someone give me an idea of what's going on here and how I can get
this
> > connectivity happening?
> >
> > Thanks,
> > Brian
> >
> > #!/usr/bin/perl
> > #available.plx
> > use warnings;
> > use strict;
> > use DBI;
> >
> > print "Available DBI Drivers and Data Sources:\n\n";
> > my @drivers=DBI->available drivers('quiet');
> > my @sources;
> >
> > foreach my $driver (@drivers)
> >
> > {
> >  print "$driver\n";
> >  @sources=eval { DBI->data_sources($driver) };
> >  if ($@)
> >  {
> >   print "\tError: ", substr($@,0,60),"\n";
> >  }
> >  elsif (@sources)
> >  {
> >   foreach (@sources)
> >   {
> >    print "\t$_\n";
> >   }
> >  }
> >  else
> >  {
> >   print "\tNo known data sources.\n";
> >  }
> > }
>
> This looks like a problem with DBI.
>
> Execute the following commands:
>
> 1.  perl -MDBI -e '0'
> 2.  perl -MDBD::Oracle -e '0'
>
> Both of the above commands should return no errors or warnings.  If
> errors or warnings are returned, you do not have the module specified by
> the -M switch correctly installed.
>
> --
> Ron Reidy
> Oracle DBA
> Reidy Consulting, L.L.C.
>




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1807
***************************************


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