[16130] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3542 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 3 06:05:40 2000

Date: Mon, 3 Jul 2000 03: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: <962618713-v9-i3542@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 3 Jul 2000     Volume: 9 Number: 3542

Today's topics:
    Re: $_ and @_ use? <gellyfish@gellyfish.com>
    Re: $_ and @_ use? (Villy Kruse)
    Re: ANNOUNCE: database version 0.90 alpha <gellyfish@gellyfish.com>
        Archives in perl?? <Roger.Tillmann@extern.rwso.de>
    Re: Archives in perl?? (Eric Bohlman)
    Re: CGI and cookies (Rafael Garcia-Suarez)
        Errors when running debugger pinkpanther1970@my-deja.com
    Re: Golf problem <gellyfish@gellyfish.com>
    Re: How to open redirect and open new browser at same t <Peter.Dintelmann@dresdner-bank.com>
        Include a C function (or any *.h) in Perl code <ambrogio.delorenzo@art-web.it>
    Re: Interchage the role of key and value in a hash <gellyfish@gellyfish.com>
        Password Security <grichards@flashcom.net>
    Re: Perl Object Oriented Persistance (The POOP Group) (Gwyn Judd)
        PERL-CGI question anuragmenon@my-deja.com
    Re: PERL-CGI question <steven.van-poeck@SPAM.wanadoo.com>
    Re: PERL-CGI question anuragmenon@my-deja.com
        Problem with Pipes and forks tony_123@my-deja.com
    Re: Reading a file without <CR><LF> (newbie!!!) <belana@lycosmail.com>
    Re: Reading a file without <CR><LF> (newbie!!!) <foo@bar.va>
    Re: Reading a file without <CR><LF> (newbie!!!) (Eric Bohlman)
    Re: Reading a file without <CR><LF> (newbie!!!) <belana@lycosmail.com>
        Reading a file without <CR><LF> <belana@lycosmail.com>
    Re: Reading a file without <CR><LF> <foo@bar.va>
    Re: regex - slurp file and extract email addresses <gellyfish@gellyfish.com>
        Size of CPAN <J.E.J.opdenBrouw@st.hhs.nl>
    Re: Strange behaviour in upper case conversion (Philip Lees)
    Re: Sybase and perl (Philip Lees)
    Re: Thanks <henryl@sc.mcel.mot.com>
        this annoying carriage return <madl@mb-consultants.fr>
    Re: Tk::JPEG <iltzu@sci.invalid>
    Re: trouble compiling modules <gellyfish@gellyfish.com>
    Re: Welcome to.... <gellyfish@gellyfish.com>
    Re: Welcome to.... <Magic@mattnet.freeserve.co.uk>
    Re: Welcome to.... <Magic.@mattnet.freeserve.co.uk>
    Re: Welcome to.... (Bart Lateur)
        why? why? <henryl@sc.mcel.mot.com>
    Re: why? why? (Sam Holden)
    Re: why? why? (Bart Lateur)
        Win32 .htpasswd encryption problem. <steven.van-poeck@SPAM.wanadoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 3 Jul 2000 09:52:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: $_ and @_ use?
Message-Id: <8jpk7j$cep$1@orpheus.gellyfish.com>

On Thu, 29 Jun 2000 22:49:09 -0500 Jim Kauzlarich wrote:
> 
> What is "Perl golf"?  I assume it has something to do with randomly hacking
> your way to the goal.  I've heard the term at least twice now and I'm
> curious.
> 

No that would be Crazy Golf - I believe North Americans call it Miniature
Golf.  Anyhow just as with the real thing Perl Golf is 'a good walk
spoiled' ...

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: 3 Jul 2000 10:03:43 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: $_ and @_ use?
Message-Id: <slrn8m0p7u.qdc.vek@pharmnl.ohout.pharmapartners.nl>

On 3 Jul 2000 09:52:03 +0100, Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On Thu, 29 Jun 2000 22:49:09 -0500 Jim Kauzlarich wrote:
>> 
>> What is "Perl golf"?  I assume it has something to do with randomly hacking
>> your way to the goal.  I've heard the term at least twice now and I'm
>> curious.
>> 
>
>No that would be Crazy Golf - I believe North Americans call it Miniature
>Golf.  Anyhow just as with the real thing Perl Golf is 'a good walk
>spoiled' ...
>


What you do in golf is minimizing the number of strokes (keystrokes that is).



Villy



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

Date: Mon, 03 Jul 2000 09:21:00 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ANNOUNCE: database version 0.90 alpha
Message-Id: <0WY75.1113$iP2.100751@news.dircon.co.uk>

On 3 Jul 2000 02:59:35 GMT, Josiah Bryan Wrote:
> Announcing:
>         database version 0.90 alpha.
> 
> This is the first public release of the database package.
> Comments and criticism are welcome and desired.
> 
> SYNOPSIS
> 
>      use database;
> 

I gotta say I'm not keen on the name, did you seek the opinion of the people
on the modules mailing list ?  All lower case module names are reserved for
'pragmatic modules' by convention and Database is just too generic for my
taste (even though it does do what it says on the box) - How about
'Tie::Database' for instance ?

 

/J\


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

Date: Mon, 03 Jul 2000 09:18:09 +0200
From: Roger Tillmann <Roger.Tillmann@extern.rwso.de>
Subject: Archives in perl??
Message-Id: <39603E31.D854485A@extern.rwso.de>

Hy out there ..

hope someone can help me :-))

I want to store various files with paths to some sort of archive-file.
On the other hand I want to extract files with pathnames from there. The
archive does not need to be packed - but packing would be even better.
Normally I would call some external program like zip. But I need some
way which enables me to add / delete files to the archive very fast and
without need of much extra space. If I would use zip and add one file to
an archive of lets say 100MB, then zip would add the archive and the
file to an temp-storage, rebiuld the whole archive there - needing 100mb
extra space - and then replace the old archive.

Is there some solution with maybe built in funtions which won't take up
taht much space?

Thanx

Roger



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

Date: 3 Jul 2000 09:33:04 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Archives in perl??
Message-Id: <8jpmkg$hv5$2@nntp9.atl.mindspring.net>

Roger Tillmann (Roger.Tillmann@extern.rwso.de) wrote:
: I want to store various files with paths to some sort of archive-file.
: On the other hand I want to extract files with pathnames from there. The
: archive does not need to be packed - but packing would be even better.
: Normally I would call some external program like zip. But I need some
: way which enables me to add / delete files to the archive very fast and
: without need of much extra space. If I would use zip and add one file to
: an archive of lets say 100MB, then zip would add the archive and the
: file to an temp-storage, rebiuld the whole archive there - needing 100mb
: extra space - and then replace the old archive.
: 
: Is there some solution with maybe built in funtions which won't take up
: taht much space?

Have you looked into Archive::Tar and Compress::Zlib?



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

Date: Mon, 03 Jul 2000 06:39:38 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: CGI and cookies
Message-Id: <slrn8m0dhc.tfv.garcia_suarez@rafael.kazibao.net>

snakedjip@my-deja.com wrote in comp.lang.perl.misc:
>I'm experiencing some weird behavior, and i'm looking for ideas to
>guide me...
>
>I have a web site.  I use cookies to check if a user is logged in or
>not.
>
>In development (on my PC) AND in production (at my hosting service), I
>have no problem with this setup using my PC as the browser, whether it
>be with Netscape or IE.  Cookies are being set, users are being
>recognized (I turned prompts on for cookies in the browsers).
>
>When I go to my friend's PC, the cookies are simply not set.  He had
>only IE installed, it didn't work, so I installed Netscape, turned on
>the cookie prompts, and NOTHING.
>
>I went to another site that uses cookies, and those sites worked fine
>on his PC.
>
>By the way, he's on ADSL, and his ISP uses some kind of proxy to limit
>bandwidth consumption.  Could this be the reason ???????

A proxy can do one of those things :
  * filtering out Set-Cookie headers in HTTP requests
  * Changing domain names while transmitting HTTP requests (e.g. to IP
    addresses)
Put a simple script that prints %ENV on your web site, and look if all
variables look normal (esp. HTTP_HOST).

>Here's my code.  This peace of code is run after the user has clicked
>on submit in the login form, and redirects to the user's profile page.
>
>If anyone has a clue, PLEASE RESPOND :-)
>
>Thanks.
>
>
>
>my $userCookie = $cgi->cookie(-name => 'user',
>			  -value => $user,
>			  -path => '/',
>			  -domain => '<the domain>',
>			  -secure => 0);
>my $loggedInCookie = $cgi->cookie(-name => 'loggedin',
>			      -value => 1,
>			      -path => '/',
>			      -domain => '<the domain>',
>			      -secure => 0,
>			      -expires => '+3h');
>print $cgi->redirect(-uri=>$redirUrl, -cookie=>
>$userCookie,$loggedInCookie]);

And some browsers can't handle set-cookie commands in redirect requests.

-- 
Rafael Garcia-Suarez


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

Date: Mon, 03 Jul 2000 06:19:49 GMT
From: pinkpanther1970@my-deja.com
Subject: Errors when running debugger
Message-Id: <8jpb9t$up0$1@nnrp1.deja.com>

Hello,

I'm trying to get a perl script with modules to run on a webserver.
When I run perl debugger I get the following two things:
1. Value of construct can be "0"; test with defined()
   at /wwwroot/my/account/myscript.pm line 65535.
2. "my" variable $num masks earlier declaration in same scope

On another script it gives me:
Can't locate object method "seqno" via package "Apache"
at /usr/lib/perl5/i386-linux/5.004/CGI.pm line 263

Does anyone know how to avoid these errors?
With the first error I'm really confused. It says "line 65535" but the
script isn't that long, is this a server problem?
The second error I can find in the script, but I don't know how to fix
it.
The third one also confuses me. How can I fix an error in CGI.pm that's
located on the webserver? Or is this also caused by my script?
I'm really a newbie at perl and I've searched all over the internet for
weeks, but I haven't found any solution to these problems.
If anyone can help, I'd appreciate it a lot.

Pink Panther


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 3 Jul 2000 09:41:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Golf problem
Message-Id: <8jpjkd$af2$1@orpheus.gellyfish.com>

On 30 Jun 2000 05:08:21 EDT Abigail wrote:
> Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote on MMCDXCV
> September MCMXCIII in <URL:news:slrn8logbo.mm6.bernard.el-hagin@gdndev25.lido-tech>:
> -: 
> -: I renamed my words file to "w" and moved it to /tmp to get 9 strokes
> -: less:
> -: 
> -: perl -pe 'length==11&&\!/(.).*\1/ or$_=""' /tmp/w
> 
> 
> Then you could have saved another 5 strokes by first cd'ing to /tmp.
> 

Or symlinked the file to 'w' in the current directory ... I guess you could
also alter the perl source so that length became 'l' and rename perl to 'p'

;-}


/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 3 Jul 2000 09:59:17 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: How to open redirect and open new browser at same time?
Message-Id: <8jph3v$1pm1@intranews.dresdnerbank.de>

    Hi,

shaohong schrieb in Nachricht <8josh7$s4d$1@newton3.pacific.net.sg>...
>If we want to use a redirect to send the browser to some other URL, a
>redirect('http://somewhere.else/') method in Perl exists to facilitate
this.
>
>Now my problem is
>First I want to redirect to URL1, at same time I want to open a new browser
>to some other URL2, the URL1 is still existing in the background.
>
>What technology may I use in Perl? Need your help help!!

    I don't think this is really a Perl issue. From what I understand
    you need some intelligence on the client (browser) side to
    open the appropriate browsers.
    Thus send e.g. some javascript code to the browser telling him what
    to do....

    Best regards,

        Peter Dintelmann







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

Date: Mon, 03 Jul 2000 11:01:59 +0200
From: Ambrogio De Lorenzo <ambrogio.delorenzo@art-web.it>
Subject: Include a C function (or any *.h) in Perl code
Message-Id: <igl0mss8g0s3tqq6v4d53bl3qgai97vu27@4ax.com>

There is someone that can explain me how I can include C code in Perl
code?

It is the same if you take me some information on how I can find
manual about this.

Tanks in advance
Ciao
	Pirla

Per rispondere in E-mail the (punto) pirla (chiocciola) flashnet.it
*** un bacio ai pupi ***

---> Linux user since yesterday <---


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

Date: 3 Jul 2000 10:13:24 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Interchage the role of key and value in a hash
Message-Id: <8jplfk$gk1$1@orpheus.gellyfish.com>

On 2 Jul 2000 19:49:34 GMT Tina Mueller wrote:
> hi,
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Sat, 1 Jul 2000 18:33:51 +0800 multiplexor wrote:
>>> 
>>> %entity = ('&' , '&amp;' , '>' , '&gt;');
>>> 
>>> That is, interchange the role of the keys and values of %entity.
>>> 
>>> I think of using a foreach loop:
>>> foreach (keys %entity) {
>>>     %code($entity($_)) = $_
>>> }
> 
>> Thats one way of doing it,
> 
> no, it isn't. i get a syntax error. if you want to
> use something like the above foreach loop, better write
> $code{$entity{$_}} = $_;
> 

I blame the font I am using ... theres not enough difference between () and
{} and I'm sticking to it ...

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 3 Jul 2000 03:03:06 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Password Security
Message-Id: <sm0p15a8op350@corp.supernews.com>

I'm coming across security issues for the first time in my Perl experience.
Here's the problem...

I'm writing an administrative interface for a MySQL database using Perl/DBI.
The user must log in with the database username and password. After logging
in, the user is provided with a menu of options to do stuff in the database.
If the user clicks on an option, the script will route to the relevant
subroutine where a connection to the database is established. To connect to
the database I need to supply a username and password. I don't want the user
to have to type it in every time they do a database action, and it's not
secure to hide the un/pw in the HTML or in the script, so what is a good
method for passing passwords between instances of a script being invoked?

Directions to relevant docs would be appreciated as well as personal advice.

Gabe




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

Date: Mon, 03 Jul 2000 06:26:28 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl Object Oriented Persistance (The POOP Group)
Message-Id: <slrn8m0cgh.4v1.tjla@thislove.dyndns.org>

I was shocked! How could Michael G Schwern <stupid@pobox.com>
say such a terrible thing:
>    Announcements.
>    POOP-scoop:  poop-scoop@lists.sourceforge.net
>                 http://mail1.sourceforge.net/mailman/listinfo/poop-scoop
>
>So, if you've written an object persistance library, or if you're just
>interested in the state of POOP today, join up!

 ...and the winner for the best named mailing list in the "Technical"
category is...<drumroll>

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
I have a very good DENTAL PLAN.  Thank you.


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

Date: Mon, 03 Jul 2000 07:59:50 GMT
From: anuragmenon@my-deja.com
Subject: PERL-CGI question
Message-Id: <8jph5h$3hr$1@nnrp1.deja.com>

Hi all...

This is my question.

I have one CGI script (say Script1.pl) that runs using the input from
one form - say Form1.html

That script creates another form - say Form2

Form2 now has a text field with a submit and reset button etc

I would like a second script(say Script2.pl) to be run when this text
field is filled in and the submit button is clicked..in other words, if
I were to create Form2 through regular HTML, the ACTION tag will be =
Script2.pl.

How do I program the creation of this into Script1.pl which is actually
 creating Form2 ? I am using the CGI module. A direction to a CLEAR
documentation of the PerlCGI module will also probably be fine so that I
can check this out.

Thanks,
Vinod.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 3 Jul 2000 11:05:36 +0200
From: "Steven Van Poeck" <steven.van-poeck@SPAM.wanadoo.com>
Subject: Re: PERL-CGI question
Message-Id: <8jpl1t$l1r$1@wanadoo.fr>

Just use:

start_form({-action=>'/cgi-bin/Script2.pl', -method=>'post'}),

to get the correct form tag printed into your Form2 HTML.

HTH,

Steven VAN POECK

<anuragmenon@my-deja.com> a écrit dans le message :
8jph5h$3hr$1@nnrp1.deja.com...
> Hi all...
>
> This is my question.
>
> I have one CGI script (say Script1.pl) that runs using the input from
> one form - say Form1.html
>
> That script creates another form - say Form2
>
> Form2 now has a text field with a submit and reset button etc
>
> I would like a second script(say Script2.pl) to be run when this text
> field is filled in and the submit button is clicked..in other words, if
> I were to create Form2 through regular HTML, the ACTION tag will be =
> Script2.pl.
>
> How do I program the creation of this into Script1.pl which is actually
>  creating Form2 ? I am using the CGI module. A direction to a CLEAR
> documentation of the PerlCGI module will also probably be fine so that I
> can check this out.
>
> Thanks,
> Vinod.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Mon, 03 Jul 2000 09:21:10 GMT
From: anuragmenon@my-deja.com
Subject: Re: PERL-CGI question
Message-Id: <8jpltu$6l7$1@nnrp1.deja.com>

Hi all..I found good documentation and figured out how to use the
startform method to specify action and its working. Thanks again,

Vinod.

In article <8jph5h$3hr$1@nnrp1.deja.com>,
  anuragmenon@my-deja.com wrote:
> Hi all...
>
> This is my question.
>
> I have one CGI script (say Script1.pl) that runs using the input from
> one form - say Form1.html
>
> That script creates another form - say Form2
>
> Form2 now has a text field with a submit and reset button etc
>
> I would like a second script(say Script2.pl) to be run when this text
> field is filled in and the submit button is clicked..in other words,
if
> I were to create Form2 through regular HTML, the ACTION tag will be =
> Script2.pl.
>
> How do I program the creation of this into Script1.pl which is
actually
>  creating Form2 ? I am using the CGI module. A direction to a CLEAR
> documentation of the PerlCGI module will also probably be fine so that
I
> can check this out.
>
> Thanks,
> Vinod.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 03 Jul 2000 06:27:56 GMT
From: tony_123@my-deja.com
Subject: Problem with Pipes and forks
Message-Id: <8jpbp2$v4a$1@nnrp1.deja.com>

Hi Folks

I have the following program(after this message).  When I run it I only
get the output

Parent Pid 17094 just read this: `Child Pid 17095 is sending this'
Parent Pid 17094 just read this: `1'
Parent Pid 17094 just read this: `4'
Parent Pid 17094 just read this: `7'
Parent Pid 17094 just read this: `10'
Parent Pid 17094 just read this: `13'
Parent Pid 17094 just read this: `16'
Parent Pid 17094 just read this: `19'
Parent Pid 17094 just read this: `22'
Parent Pid 17094 just read this: `25'
Parent Pid 17094 just read this: `28'
Parent Pid 17094 just read this: `31'
Parent Pid 17094 just read this: `34'
Parent Pid 17094 just read this: `37'
Parent Pid 17094 just read this: `40'
[snip]

Can someone please tell me why it is not printing all the numbers 1 to
10000.  I thought that using the autoflush function would ensure that
all numbers are printed.

Cheers

Tony

#!/usr/bin/perl -w

use IO::Handle;

pipe(PARENT_RDR, CHILD_WTR);                # XXX: failure?
pipe(CHILD_RDR,  PARENT_WTR);               # XXX: failure?
CHILD_WTR->autoflush(1);
PARENT_WTR->autoflush(1);
pipe(PARENT_RDR2, CHILD_WTR2);                # XXX: failure?
pipe(CHILD_RDR2,  PARENT_WTR2);               # XXX: failure?
CHILD_WTR2->autoflush(1);
PARENT_WTR2->autoflush(1);

if ($pid = fork) {
        close PARENT_RDR; close PARENT_WTR;
        print CHILD_WTR "Parent Pid $$ is sending this\n";
        chomp($line = <CHILD_RDR>);
        print "Parent Pid $$ just read this: `$line'\n";
}
else {
    die "cannot fork: $!" unless defined $pid;
    close CHILD_RDR; close CHILD_WTR;
    chomp($line = <PARENT_RDR>);
    print "Child Pid $$ just read this: `$line'\n";
    print PARENT_WTR "Child Pid $$ is sending this\n";
    for ( $i=0;$i<10000;$i++)
    {
        print PARENT_WTR "$i\n";
    }
    close PARENT_RDR; close PARENT_WTR;
    exit;
}

if ( $pid != 0 )
{
    while (1 )
    {
        if ( defined <CHILD_RDR> )
        {
            chomp($line = <CHILD_RDR>) ;
            print "Parent Pid $$ just read this: `$line'\n";
        }
        if (!  defined <CHILD_RDR> )
        {
            last;
        }
    }
}




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 3 Jul 2000 11:27:58 +0200
From: "belana" <belana@lycosmail.com>
Subject: Re: Reading a file without <CR><LF> (newbie!!!)
Message-Id: <8jpmar$hgr$1@mail.pl.unisys.com>

Sorry - I forgot to mention I'm working with
NT perl.

"belana" <belana@lycosmail.com> wrote in message
news:8jplkv$gsq$1@mail.pl.unisys.com...
> Hi
>
> How can I read a fixed record-length (2000) file that doesn't have any
> <CR><LF>
> without getting the whole file into the variable $ActLine at once?
>
> At the moment, my script looks like that:
>
> if (!open(H_IN, "$infName")) {
>    $errMsg = "Cannot open $infName";
>    $RetCode = 0;
>    exit 0;
> }
> if (!open(H_OUT, ">$outFName")) {
>    $errMsg = "Cannot create $outFName";
>    $RetCode = 0;
>    exit 0;
> }
> $RecCount = 0;
> $ActLine[2000];
> while (defined ($ActLine = <H_IN>))
>    {
>    chomp $ActLine;
>    print H_OUT $ActLine;
>    ++$RecCount;
>    }
>
>
> Thanks!
>
>




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

Date: Mon, 03 Jul 2000 11:34:43 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Reading a file without <CR><LF> (newbie!!!)
Message-Id: <39605E33.B5947FD6@bar.va>

belana,

belana wrote:
> Sorry - I forgot to mention I'm working with NT perl.

<cite src="perldoc -f read">
	=item read FILEHANDLE,SCALAR,LENGTH,OFFSET

	=item read FILEHANDLE,SCALAR,LENGTH

	Attempts to read LENGTH bytes of data into variable SCALAR 
	from the specified FILEHANDLE.  Returns the number of 
	bytes actually read, C<0> at end of file, or undef if there 
	was an error.  SCALAR will be grown or shrunk to the 
	length actually read.  An OFFSET may be specified to place 
	the read data at some other place than the beginning of 
	the string.  This call is actually implemented in terms 
	of stdio's fread(3) call.  To get a true read(2) system 
	call, see C<sysread()>.
</cite>

  It should work in the same manner on every platform, as the Perl
philosophy states.


	Best regards,
		Marco


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

Date: 3 Jul 2000 09:37:32 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Reading a file without <CR><LF> (newbie!!!)
Message-Id: <8jpmss$hv5$3@nntp9.atl.mindspring.net>

belana (belana@lycosmail.com) wrote:
: Sorry - I forgot to mention I'm working with
: NT perl.

As Marco pointed out, you'll want to use the read() function.  Since 
you're running on NT, you'll also want to binmode() the filehandle you're 
reading from (although Larry Rosler would tell you that you should do 
that even if you're running on an OS where binmode() is a no-op).



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

Date: Mon, 3 Jul 2000 11:42:08 +0200
From: "belana" <belana@lycosmail.com>
Subject: Re: Reading a file without <CR><LF> (newbie!!!)
Message-Id: <8jpn5g$i4i$1@mail.pl.unisys.com>

Thanks! Problem is solved. And sorry for the
silly question, I'm new to perl and this group.
Miriam.




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

Date: Mon, 3 Jul 2000 11:16:17 +0200
From: "belana" <belana@lycosmail.com>
Subject: Reading a file without <CR><LF>
Message-Id: <8jplkv$gsq$1@mail.pl.unisys.com>

Hi

How can I read a fixed record-length (2000) file that doesn't have any
<CR><LF>
without getting the whole file into the variable $ActLine at once?

At the moment, my script looks like that:

if (!open(H_IN, "$infName")) {
   $errMsg = "Cannot open $infName";
   $RetCode = 0;
   exit 0;
}
if (!open(H_OUT, ">$outFName")) {
   $errMsg = "Cannot create $outFName";
   $RetCode = 0;
   exit 0;
}
$RecCount = 0;
$ActLine[2000];
while (defined ($ActLine = <H_IN>))
   {
   chomp $ActLine;
   print H_OUT $ActLine;
   ++$RecCount;
   }


Thanks!




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

Date: Mon, 03 Jul 2000 11:29:07 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Reading a file without <CR><LF>
Message-Id: <39605CE3.5A892DCC@bar.va>

belana,

belana wrote:
> How can I read a fixed record-length (2000) file that doesn't have 
> any <CR><LF> without getting the whole file into the variable 
> $ActLine at once?

	$ perldoc -f read


	Best regards,
		Marco


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

Date: 3 Jul 2000 09:36:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regex - slurp file and extract email addresses
Message-Id: <8jpjb1$9f9$1@orpheus.gellyfish.com>

On 29 Jun 2000 20:52:38 EDT Abigail wrote:
> Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCDXCIV September
> MCMXCIII in <URL:news:8jgj4g$1br$1@orpheus.gellyfish.com>:
> \\ On 29 Jun 2000 05:15:00 EDT Abigail wrote:
> \\ > Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCDXCIV September
> \\ > MCMXCIII in <URL:news:8jf3si$uft$1@orpheus.gellyfish.com>:
> \\ >
> \\ > )) But people arent saying that what you are proposing is a worse
> \\ > )) way of searching for e-mail addresses , they are saying that
> \\ > )) it isnt a way of searching for *e-mail addresses* at all.
> \\ > )) You might as well print every line of the text with an '@'
> \\ > )) in it for all the hand cleaning you are going to have to do
> \\ > )) with your data (and even that isnt foolproof as the address
> \\ > )) might easily have a newline in it).
> \\ > 
> \\ > 
> \\ > And let's not forget, not every address has a @ in it.
> \\ > 
> \\ 
> \\ Yes, but one doesnt like to mention 'bang path' in the company of some of
> \\ these boys ...
> 
> 
> I wasn't talking about bang paths.
> 
> RC822 doesn't deal with bang paths. RFC822, however, defines a grammar
> that allows for email addresses without a @.
> 

Sure, but the OP didnt mention rfc822 - perhaps he was interested in X400
or something else entirely different who knows ?

Anyhow the mail system on this machine can handle 'gellyfish.com!gellyfish'
very nicely thank you ... 

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 03 Jul 2000 11:11:08 +0200
From: "J.E.J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl>
Subject: Size of CPAN
Message-Id: <396058AC.BEACAEA4@st.hhs.nl>



Hi,

does anyone know the size (in MBytes or so) of CPAN. We wish to
setup a local mirror for our students here.

Thanks,

-- 
--jesse
----------------------------------------------------------------------
J. op den brouw                             Johanna Westerdijkplein 75
Haagse Hogeschool                                    2521 EN  DEN HAAG
Sector Techniek                                        The Netherlands
Opleiding Elektrotechniek                               +31-70-4458936
----------------------------------------------------------------------
           Linux - because reboots are for hardware changes


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

Date: Mon, 03 Jul 2000 06:34:40 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Strange behaviour in upper case conversion
Message-Id: <396031c1.237174108@news.grnet.gr>

On Fri, 30 Jun 2000 11:06:08 -0400, tadmc@metronet.com (Tad McClellan)
wrote:

>>Reading and fully understanding the documentation are not the same
>>thing. I did the former, 
>        ^^^^^^^^^^^^^^^^
>And we could tell that how?
>
>There was nothing in your post that indicated that you had
>read it.

From my original post::

>> From what I've read in perlop and perlre, the ^
>> operator should match just the first character of the string.

>(of course you already know this, having lurked a bit before
> posting as recommended in   news.announce.newusers
>)

Yes. I've been reading this group for several months now. In that time
I have made two posts. The first was on May 31 and received no
responses at all.

>Do you see something there that indicates that you did
>not understand the docs? Or that you had even read them?

See above.

>But you did not make any mention of the docs whatsoever.

See above.

>You even found what might be considered a bug in the docs,
>an now you went and got vulgar in response to a perfectly
>understandable response.

Tom' s post was extremely offensive in tone and contained no useful
information. He simply accused me of not reading the docs, even though
I explicitly stated that I had. I responded to an insult with an
insult.

>So long.

Bye.

Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: Mon, 03 Jul 2000 07:54:31 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Sybase and perl
Message-Id: <39604207.241340479@news.grnet.gr>

On Fri, 30 Jun 2000 04:06:31 GMT, anuragmenon@my-deja.com wrote:

>Can anyone try to post a pseudocode or portion of script that connects
>to a sybase database, uses a parameter from a form, executes the SQL and
>retrieves the records that match that parameter - a very simple select.
>I will also need to access the records and the individual values in
>there.

If you're on Win 32 and have the Win32::ODBC module, then something
like the following should do the job. If you're expecting more than
one matching record, you'll need to modify the 'while' loop to read
the data into an array.

Note: I didn't write this code and I don't know how optimum it is -
but it works with Sybase Adaptive server, connecting through the ODBC
driver, checking whether a userID/password combination is in the
database..

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

use Win32::ODBC;

my $O;
my $DSN="Your_DSN_name";

			# connect to DBase, bale out if unsuccessful
        
if (!($O = new Win32::ODBC($DSN))){
	print "Failure. \n\n";
	print Win32::ODBC::Error(),"\n\n";
        	exit();
}

			# build select statement
			# $name and $passwd come from the form

my $sql_stat = "select USERNAME, PASSWORD  from DBA.Users where
USERNAME = \'$name\' AND PASSWORD = \'$passwd\'";

			# execute select statement
if ($O->Sql($sql_stat)){
	print "Error in SQL", $sql_stat,,"\n\n";
	exit();
}

my @FieldNames = $O->FieldNames();
my $userID;
my $passwdID;

			# get matching data 
while ($O->FetchRow()) {
	$userID =  $O->Data($FieldNames[0]);
	$passwdID =  $O->Data($FieldNames[1]);
}

$O->Close();

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

HTH.

Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: Mon, 3 Jul 2000 16:23:31 +0800
From: "Henry LIN" <henryl@sc.mcel.mot.com>
Subject: Re: Thanks
Message-Id: <8jpiik$qsu$1@schbbs.mot.com>


>>               {
>>                if ( $line == "\n")
>
>That's a numeric compare. Which explains the problem you are having since
"\n"
>becomes 0 and so does "Columns 1 through 7".

I got it . Thank you .Thank you very much.





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

Date: Mon, 03 Jul 2000 08:04:51 GMT
From: "Mathieu DE LORENZI" <madl@mb-consultants.fr>
Subject: this annoying carriage return
Message-Id: <DOX75.166$fF.742552@nnrp3.proxad.net>

Hello,
i've got a form on the site and a csv file on the server : the user fill the
form and the informations must be write in the CSV file. The csv will be
further imported in an excel file... That's why i want to substitute the
"carriage return" an "new line" caracters : I've try this, but it doesn't
work :

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

The server is an unix machine running perl 5...

Have anyone a clue ?

Thank's for all help.

Mathieu DE LORENZI




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

Date: 3 Jul 2000 06:47:41 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Tk::JPEG
Message-Id: <962606576.15874@itz.pp.sci.fi>

In article <395d9398$1@post.newsfeeds.com>, Greymaus wrote:
>*** post for free via your newsreader at post.newsfeeds.com ***
 [5-line question snipped]
>  **** Post for FREE via your newsreader at post.newsfeeds.com ****
 [18-line advertisement snipped]

Ouch.  It's been a while since I last plonked a whole domain..

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 3 Jul 2000 10:01:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: trouble compiling modules
Message-Id: <8jpkof$e78$1@orpheus.gellyfish.com>

On Wed, 28 Jun 2000 15:44:59 -0400 Lance E Sloan wrote:
> I've recently installed Perl 5.6.0 on a
> Solaris 2.6 machine.  The compile and install
> went well.  However, when it came to some
> modules, I ran into trouble.
> 
> For example, the AFS 1.8 module.  I had to
> use the "POLLUTE=1" option when running
> Makefile.PL and I got a few warnings during
> compilation.  I figured they're probably no
> big deal.  But when I ran "make test", I got
> this error:
> 
>> t/AFS...............Can't load 'blib/arch/auto/AFS/AFS.so' for module
>> AFS: ld.so.1: /usr/um/perl/5.6.0/bin/perl: fatal: relocation error:
>> file blib/arch/auto/AFS/AFS.so: symbol _et_list: referenced symbol not
>> found at /usr/um/perl/5.6.0/lib/5.6.0/sun4-solaris-thread/DynaLoader.pm
>> line 200.
>>  at t/AFS.t line 11
>> Compilation failed in require at t/AFS.t line 11.
>> BEGIN failed--compilation aborted at t/AFS.t line 11.
> 
> Can anybody suggest where I've gone wrong?  If you need
> more info, like the output of "perl -V", I can
> provide that.
> 

It might be useful if you showed us the coompilation warnings - this looks
like a problem with a library used by the module rather than with the module
itself ...

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: 3 Jul 2000 10:23:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Welcome to....
Message-Id: <8jpm38$il3$1@orpheus.gellyfish.com>

On Sun, 02 Jul 2000 19:30:50 +0100 Magic wrote:
> On Sun, 2 Jul 2000 10:11:29 -0400, tadmc@metronet.com (Tad McClellan)
> wrote:
> 
>> Feel free to go away if you do not like it here.
> 
> I fully intend to. If wankers like you are an indication of the type
> of people who hang around here then I have far bettert things to do.
> 

There isnt much point in trying to insult Americans by calling them that
because the word doesnt have the same connotations for them. 

Bye Bye now ... you already had one chance to many.

*plonk*

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 03 Jul 2000 09:38:19 +0100
From: Magic <Magic@mattnet.freeserve.co.uk>
Subject: Re: Welcome to....
Message-Id: <h4k0ms05vq0kddeg50ksrk6de74n94a2m3@4ax.com>

On Sun, 2 Jul 2000 17:33:52 -0500, "Billy Chambless"
<billy@erc.msstate.edu> wrote:

> I would offer some help, but my solution to running a Web server on
a PC
> involves
> installing Linux.

Anyone wanting a stable web server would probably stick with
Installing Linux, but as I only actually wanted a few scripts for a
web site this seemed overkill. When "WINE" runs my 3D apps happily
Windows will be deleted, but until then I'm stuck with Micro$oft.


Magic        ==|:o)
-- 
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk


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

Date: Mon, 03 Jul 2000 09:46:51 +0100
From: Magic. <Magic.@mattnet.freeserve.co.uk>
Subject: Re: Welcome to....
Message-Id: <rkk0msgt5jskrbh9bqjf2c93am2oti4n3m@4ax.com>

On 3 Jul 2000 10:23:52 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
wrote:

> Bye Bye now ... you already had one chance to many.
> 
> *plonk*

So you can't see this post then, right? I guess that means you'll
never see the apology either. Oh well, that's life!



Magic        ==|:o)
-- 
Location : Portsmouth, England, UK
Homepage : http://www.mattnet.freeserve.co.uk
EMail : mailto:Magic@mattnet.freeserve.co.uk


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

Date: Mon, 03 Jul 2000 09:03:28 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Welcome to....
Message-Id: <3961555e.3984698@news.skynet.be>

Billy Chambless wrote:

>I would offer some help, but my solution to running a Web server on a PC
>involves
>installing Linux.

Mine would be to get DynamicPerl from <www.dynamicstate.com>, which
installs both a Perl 5.6 and an Apache webserver.

I didn't get the "PerlConsole" to work, though. Start up Apache by
clicking on it's icon in the Start Menu, open a browser, and goto
<http://localhost/html/index.html>, and you're in. Er... you might need
a "hosts" file in your Windows directory, with an entry for "127.0.0.1
localhost". If you don't have one, copy "hosts.sam" to "hosts" (no file
extension).

-- 
	Bart.


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

Date: Mon, 3 Jul 2000 14:53:23 +0800
From: "Henryl LIN" <henryl@sc.mcel.mot.com>
Subject: why? why?
Message-Id: <8jpd95$n5v$1@schbbs.mot.com>


I want to remove blank line in file 'data.txt'.It contains following:


  Columns 1 through 7

    0.4221    0.4998    0.8098    0.9503    0.9048    0.9608    0.6511

  Columns 8 through 14

    0.0494    0.3305    0.4914    0.6068    0.0435    0.6392    0.2507

  Columns 15 through 21

    0.8661    0.5112    0.1055    0.3877    0.9866    0.3986    0.3467

  Columns 22 through 28

    0.2843    0.8373    0.7722    0.2641    0.0984    0.6316    0.0078

  Columns 29 through 35

    0.3621    0.1081    0.3331    0.9064    0.4658    0.2867    0.9013

  Columns 36 through 42

    0.4990    0.2058    0.3853    0.3287    0.1455    0.7240    0.4560

  Columns 43 through 49

    0.7003    0.4988    0.0791    0.6222    0.6945    0.1451    0.8825

  Columns 50 through 56

    0.6763    0.2668    0.5893    0.8668    0.5215    0.6750    0.1343

  Columns 57 through 63

    0.6690    0.3967    0.1367    0.1558    0.4446    0.6934    0.1402

  Column 64

    0.0931

My program like this:

              $filename = 'data.txt' ;
               open(in_file, "<$filename") || die("unable to open $filename
for reading\n") ;
               @original_content = <in_file>;
               close(in_file);

               while ( $line = shift( @original_content) )
               {
                if ( $line == "\n")
                {
                }
                else
                {
                push( @dst, $line );
                }
               }

               open(out_file, ">$filename") || die("unable to open $filename
for writing\n") ;
               print out_file @dst;
               close(out_file);

But I get this result :

    0.4221    0.4998    0.8098    0.9503    0.9048    0.9608    0.6511
    0.0494    0.3305    0.4914    0.6068    0.0435    0.6392    0.2507
    0.8661    0.5112    0.1055    0.3877    0.9866    0.3986    0.3467
    0.2843    0.8373    0.7722    0.2641    0.0984    0.6316    0.0078
    0.3621    0.1081    0.3331    0.9064    0.4658    0.2867    0.9013
    0.4990    0.2058    0.3853    0.3287    0.1455    0.7240    0.4560
    0.7003    0.4988    0.0791    0.6222    0.6945    0.1451    0.8825
    0.6763    0.2668    0.5893    0.8668    0.5215    0.6750    0.1343
    0.6690    0.3967    0.1367    0.1558    0.4446    0.6934    0.1402
    0.0931

why ?








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

Date: 3 Jul 2000 07:50:03 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: why? why?
Message-Id: <slrn8m0hdb.c28.sholden@pgrad.cs.usyd.edu.au>

On Mon, 3 Jul 2000 14:53:23 +0800, Henryl LIN <henryl@sc.mcel.mot.com> wrote:
>
>I want to remove blank line in file 'data.txt'.It contains following:
>
>
>  Columns 1 through 7
>
>    0.4221    0.4998    0.8098    0.9503    0.9048    0.9608    0.6511
>
>  Columns 8 through 14
>
>    0.0494    0.3305    0.4914    0.6068    0.0435    0.6392    0.2507
<Snip more of the same>

>
>My program like this:
>
>              $filename = 'data.txt' ;
>               open(in_file, "<$filename") || die("unable to open $filename
>for reading\n") ;

including $! in that error message will save you some time if something goes
wrong later.

>               @original_content = <in_file>;
>               close(in_file);
>
>               while ( $line = shift( @original_content) )

There is no need to read the entire file into memory and then process it line 
by line. Something like
	while(<in_file>)
would be more efficient.


>               {
>                if ( $line == "\n")

That's a numeric compare. Which explains the problem you are having since "\n"
becomes 0 and so does "Columns 1 through 7".

Have a look in the perlop documentation for explanations of the different 
operators.... There's one called eq that you might want to read about.

>                {
>                }
>                else
>                {
>                push( @dst, $line );

Since all you do is print it out at the end, why store the whole thing in
memory... just send it to the file... It's the same file so use a second file
and rename it later... in fact perl will do that for you...

>                }
>               }
>
>               open(out_file, ">$filename") || die("unable to open $filename
>for writing\n") ;
>               print out_file @dst;
>               close(out_file);

A more perlish solution would be:

perl -i -ne "print unless /^$/"

or

perl -i -ne  "print if /./"

or

perl -i.bak -ne "print if /./"

if you are make mistakes sometimes...

Read the perlrun documentation to see what the i, n and e options do.


-- 
Sam

the Emacs editor is horrible
	--Linus Torvalds


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

Date: Mon, 03 Jul 2000 09:19:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: why? why?
Message-Id: <39625a00.5170309@news.skynet.be>

Henryl LIN wrote:

>I want to remove blank line in file 'data.txt'.

>                if ( $line == "\n")

That's a numerical compare. Try "eq" instead of "==".

And the common way of recoginizing blank lines, is using a regex:

	if(/^$/) { ... }

You can easily modify this to recognize lines containing only
whitespace:

	if(/^\s*$/) { ... }

or even

	unless(/\S/) { ... }

-- 
	Bart.


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

Date: Mon, 3 Jul 2000 11:15:08 +0200
From: "Steven Van Poeck" <steven.van-poeck@SPAM.wanadoo.com>
Subject: Win32 .htpasswd encryption problem.
Message-Id: <8jpljr$luo$1@wanadoo.fr>

Hello,

I'm trying to figure out how to make an HTML interface to manage a .htpasswd
file on a Win32 system with Apache 1.3.9. So I don't want to use the
htpasswd.exe from the command line.

The htpasswd.exe generates MD5 encryption, which is perfectly understood by
the Apache server. It generates things like
"$apr1$zF4.....$PRSEsb.38HBZHJO4zHsgE/"

I did not find any Perl module that was able to encrypt having a similar
result. I tried Digest::MD5 and MD5 (use MD5), but they both return
encryptions like "/osO9Uia23rXqqEq76N9kg". And Apache refuses the
authentication...

I downloaded Crypt-PasswdMD5-1.0 but I don't know how to install that on my
ActiveState Perl without using PPM.

Anyone has a clue ? I'm getting desperate :(

Thx,

Steven
mailto:steven.van-poeck@wanadoo.com




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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3542
**************************************


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