[18132] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 292 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 15 00:05:59 2001

Date: Wed, 14 Feb 2001 21:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982213511-v10-i292@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 14 Feb 2001     Volume: 10 Number: 292

Today's topics:
         File extraction problem (Falc2199)
    Re: Array - reading two files. <c_clarkson@hotmail.com>
    Re: calling clock ! <me@noshadow.net>
    Re: Determining memory usage within Perl (Ilya Zakharevich)
    Re: Email Attachments - Help (Chris Fedde)
    Re: email script problem (Chris Fedde)
    Re: email script problem <bwalton@rochester.rr.com>
    Re: File extraction problem <joe+usenet@sunstarsys.com>
        Help understanding Lists of Lists or Multi-dimensional  <Jodyman@usa.net>
        How can I use template files? <ameesh@interweavetech.com>
    Re: Locking really large file <bkennedy99@Home.com>
    Re: Newbie : Help <bwalton@rochester.rr.com>
    Re: no headers using CGI.pm <jeff_fletcher@pacbell.net>
    Re: OT:status of the reorg of The Perl Journal <terrence.brannon@oracle.com>
    Re: OT:status of the reorg of The Perl Journal (Mark Jason Dominus)
        Problem on mail <p3@netnavi.net>
    Re: regex experts (Garry Williams)
    Re: Why can't I grab this URL? (BUCK NAKED1)
    Re: Why can't I grab this URL? (David Efflandt)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 15 Feb 2001 03:27:30 GMT
From: falc2199@aol.comNOJUNK (Falc2199)
Subject:  File extraction problem
Message-Id: <20010214222730.20837.00001067@ng-ct1.aol.com>

What I want to do is create a script that randomly selects a line from a list
of numbered lines.

For example if the file looked like the following

1. Be all you can be
2. Helping others makes you feel good

the script would choose either sentence  1 or 2 and  print it. 

But I am having trouble with extraction part of this. Here is what I have so
far....

my $random = rand();
while(<FILE>)
{
  if ($_ =  $random)
   {

        print $_;
   }
}

This does not  produce the output desired. Can anyone give me a few pointers on
how this could be modified to extract the sentence properly. 

Thanks in advance for any help,
Jehan


To e-mail, remove NOJUNK


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

Date: Wed, 14 Feb 2001 20:04:48 -0600
From: "Perl" <c_clarkson@hotmail.com>
Subject: Re: Array - reading two files.
Message-Id: <80025A1F009FE973.52EB5AFFB00935F9.F45DACACBDFBFE39@lp.airnews.net>


"cindy" <cindyann@mbox3.singnet.com.sg> wrote in message
news:01c0968c$963f69e0$2cb115a5@default...
: hi,
:
: File1 contains
: 1010, John, 12/05/65
: 1020, Peter, 21/10/69
: 1030, May, 27/02/70
:
: File2 contains
: 1010, swimming, jogging, tennis
: 1020, jogging, badminton
: 1030, swimming, tennis
:
: I read File1 and 2 into an array
:
: @File1 = File1;
: @File2 = File2;
:
: I did a for loop
:
: foreach $file1 (@File1)
: {
: ($student_no1, $name, $birth_date) = split( /, /, $file1);
:
:      foreach $file2 (@File2)
:      {
:        ($student_no2, $activity_1, $activity_2, $activity_3)
:            = split( /, /, $file2);
:
:         if $student_no1 = $student_no2
:           {
:            print $student_no1, $name, $birth_date,
:                            $activity_1, $activity_2, $activity_3
:            ( How do I ask Perl to exit from here after printing and read
:                the next record from File1)

Try using last:

    last LABEL
    last
    The last command is like the break statement in C (as used
    in loops); it immediately exits the loop in question. If the
    LABEL is omitted, the command refers to the innermost
    enclosing loop.

:           }
:
:         else
:           {   ( I am stuck here too. How do I ask Perl to exit from
:                     the 2nd loop and read the next record from File1)

    If you are going to exit the second 'for' under either condition
why start it in the first place? It will never get past the first
iteration. I assumed you don't really want to read the next record
from File1 in the else clause and omitted it below.

:            }
:    } # exit from File2
: } # exit from File1
:
: I believed there are simple way to do the above. Can anyone advice me?
: Thank you.
:

foreach $file1 (@File1) {
    ($student_no1, $name, $birth_date) = split( /, /, $file1);
    foreach $file2 (@File2) {
        ($student_no2, $activity_1, $activity_2, $activity_3)
                    = split( /, /, $file2);
        if ($student_no1 = $student_no2) {
            print $student_no1, $name, $birth_date,
                    $activity_1, $activity_2, $activity_3;
            last; #exit from Filee2
        }
    } # exit from File2
} # exit from File1

    If you have long files you may want to consider using
hashes and letting perl do the matching.

HTH,
Charles K. Clarkson





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

Date: Thu, 15 Feb 2001 02:22:47 GMT
From: Chicheng Zhang <me@noshadow.net>
Subject: Re: calling clock !
Message-Id: <3A8B3E4D.9A4790CB@noshadow.net>

Martijn Mulder wrote:

> print "Time: ${\scalar localtime(time)}";
>
> nowayandnohow <nowayandnohow@hotmail.com> wrote in article
> <K8Ci6.21$is3.12330@typhoon2.ba-dsg.net>...
> > How do i get the time from my NT server into my perl script ? And how do
> i
> > convert it to a value ?
> >
> > // Jo
> >
> >
> >

I guess

 print "Time:" . localtime(time);

is cleaner.



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

Date: 15 Feb 2001 02:38:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Determining memory usage within Perl
Message-Id: <96fffk$kij$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Terrence Monroe Brannon 
<terrence.brannon@oracle.com>],
who wrote in article <3A8B2D87.25A1A086@oracle.com>:
> Is there some means  within Perl to find the amount of memory that a
> running Perl program has used thus far?

With bleeding edge perl and perl's malloc: yes.  Older Perls can
report this info to stderr, but you can't get to it (without trapping
your STDERR).

Ilya


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

Date: Thu, 15 Feb 2001 02:16:01 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Email Attachments - Help
Message-Id: <BZGi6.131$zN2.170610176@news.frii.net>

[mailed and posted]

In article <HtGi6.3544$D3.16688@tor-nn1.netcom.ca>,
TeamZulu HQ <teamzulu@teamzulu.com> wrote:
>I am looking for an email attachment type script - Anybody ?
>
>Please email me direct.
>
>Thanks
>

Look for Mime::Lite on CPAN.  

good luck
chris
-- 
    This space intentionally left blank


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

Date: Thu, 15 Feb 2001 02:24:34 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: email script problem
Message-Id: <C5Hi6.133$zN2.188317696@news.frii.net>

My comments are intermingled with your code below

In article <t8m4u5s8f68d5a@corp.supernews.com>,
Brian McCann <bmccann@naisp.net> wrote:
>I cant' get this to work.
>Even though jspbuild.txt has the word "ERROR" in it the script never
>executes the The jspbuild failed on flyhalf. part of the script. on top of
>that it keeps
>looping sending emails the same amount as there are ERROR's in the
>jspbuild.txt file unless
>I put the last; in the else part of the code.
>
>what am I missing?
>tia
>Brian
>
>use warnings;
>use strict;
>use Net::SMTP;
>
>open (FILE, "<c:/perl/perlscripts/jspbuild.txt") or die $!;
>while(<FILE>) {
>   if (/ERROR/) {
>
>
>
>my $server       = 'mail.pactolus.com';
>my $from_address = 'bui-@pactolus.com';
>my $to_address   = 'bmcc-@pactolus.com';
>
>
># If there's problems, turn on debugging output.
>#$mailserv = Net::SMTP->new( $server. Debug => 1 );

                                     ^
                                     |
You probably want a comma here-------+

>
>my $mailserv = Net::SMTP->new( $server );
>
>unless ( $mailserv ) {
>   die "Could not connect to server $server. $!\n";
>}
>
>my $subject = "Subject: The jspbuild failed on flyhalf.";
>#my $msg     = "This is a test build message";
>
>
>$mailserv->mail( "$from_address\n" );
>$mailserv->to( "$to_address\n" );

You probably don't want to use \n on ether of the above lines.

>$mailserv->data();
>$mailserv->datasend( "To: $to_address\n" );
>#$mailserv->datasend( "Cc: $to_address\n" );
>$mailserv->datasend( "$subject\n\n" );
>#$mailserv->datasend( "$msg" );
>open (FILE, "<c:/perl/perlscripts/jspbuild.txt") or die $!;

You might want to open the file before you start sending the mail.

>$mailserv->datasend( $_ ) while <FILE>;
>
>#Close connection.
>$mailserv->dataend();
>$mailserv->quit();
>print "Found ERROR\n";
>last;
>
>   }else {

Of what is this the else?


chris
-- 
    This space intentionally left blank


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

Date: Thu, 15 Feb 2001 02:43:29 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: email script problem
Message-Id: <3A8B42DD.3795C031@rochester.rr.com>

Brian McCann wrote:
> 
> I cant' get this to work.
> Even though jspbuild.txt has the word "ERROR" in it the script never
> executes the The jspbuild failed on flyhalf. part of the script. on top of
> that it keeps
> looping sending emails the same amount as there are ERROR's in the
> jspbuild.txt file unless
> I put the last; in the else part of the code.
 ...
> Brian
> 

<lengthy script deleted>

You are generating lots of emails because you are looping through one of
the two portions of your program that generate email one way or the
other for each line you read from the file.  Also, upon finding ERROR,
you re-open the FILE filehandle, which probably has bizarre consequences
for the while loop that is reading the file already open on the FILE
filehandle.  You do execute a last; after the second open, so it
probably doesn't actually bother things that much for your program,
since you're not repeating the while any more.  But don't do that.  At a
minimum it is very confusing.

I don't know why you're not getting "failed" emails.  It looks to be OK
to me.  Are you sure the word "ERROR" is in all caps in your file?  You
might try if(/error/i){ if it isn't.  The only difference of note
between your two email setups is that $from_address for one is
bui-@pactolus.com, and bui-@flyhalf.pactolus.com for the other.  Will
your mail server send mail if you specify a wrong address in the mail()
method (one of the two addresses must be wrong)?

I would expect you would get an email for each line that does *not* have
ERROR in it, not one for each line that *does*.

You should probably just loop through your file looking for ERROR and if
it is found, set a flag, and when done reading the file, fire off an
email, like maybe:

      open FILE,"..." or die "Oops, $!";
      while(<FILE>){
            $err++ if /ERROR/;
      }
      close FILE;
      if($err){
            #send an email indicating $err failures
      }
      else{
            #send an email indicating success
      }

That way, you'll only ever get one email per program execution.  And you
can re-open and copy the entire file to the email with no problem, since
at that point the filehandle is closed.  Plus you can then easily
consolidate the email portion of the program into one basic sequence,
with only the subject and content of the email differing.  Then you
won't have two sequences which might differ.
-- 
Bob Walton


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

Date: 14 Feb 2001 22:36:15 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: File extraction problem
Message-Id: <m3zofohb2o.fsf@mumonkan.sunstarsys.com>

falc2199@aol.comNOJUNK (Falc2199) writes:

> What I want to do is create a script that randomly selects a line from a list
> of numbered lines.

[...]

    % perldoc -q "random line"

    =head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq5.pod

    =head2 How do I select a random line from a file?

    Here's an algorithm from the Camel Book:

            srand;
            rand($.) < 1 && ($line = $_) while <>;

    This has a significant advantage in space over reading the whole
    file in.  A simple proof by induction is available upon 
    request if you doubt its correctness.


Insert your open filehandle inside the diamond operator above and
you should be all set.  The random line will be stored in the $line
variable.

-- 
Joe Schaefer      "The past may not repeat itself, but it sure does rhyme."
                                               --Mark Twain


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

Date: Wed, 14 Feb 2001 22:57:10 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Help understanding Lists of Lists or Multi-dimensional arrays
Message-Id: <96fk2g$1ie$1@plonk.apk.net>

First, I've read and re-read Programming Perl pg 257-264.  Also Perl
Cookbook
pg 97-105 I don't understand them
 .
I've gotten my program so far but can't continue.  What I want to be able to
do
is retrieve data by the following variable:

unit (key(data)), so far I have all the key,value pairs in the unit arrays.
In Programming
Perl it talks of retrieveing data using $LoL[2][2].  Can you do something
like:
Variables $unit $key and retieve data from the List of Lists by using
$LoL[$unit][$key]?

I guess I don't know how to get the List of Lists.  I currently have 12
arrays (@$unit) which
contain key=value pairs.  I don't know how to get to using
$LoL[$unit][$key].

Any help understanding this would be of help.

TIA - Jody

PS - I know there isn't any use strict.

The Program:
#!c:/perl -w

%unit = (
akrn => "Akron Ward",
alli => "Alliance Ward",
ashl => "Ashland Branch",
can1 => "Canton Ward",
can2 => "Canton II Ward",
medi => "Medina Ward",
newp => "New Philadelphia Ward",
root => "Rootstown Ward",
stow => "Stow Branch",
tall => "Tallmadge Ward",
wads => "Wadsworth Branch",
woos => "Wooster Ward",
);

@unit = keys %unit;

$yr = "2001"; $mo = "01"; # Will be variable in live program

print "Checking for files\n";

foreach $unit (@unit) {

 $filename = "c:/www/reports/$yr$mo$unit.dat";
 if (-e "$filename") { print "$filename exists\n"; &process; &pause;}
 else { print "$filename does not exist!\n"; }

}

foreach $unit (@unit) {
 print "\@$unit = @$unit\n\n"; &pause;
 }

sub process {
 $in = "";
 open (INFILE, "$filename" ) or die "Can't open $filename: $!\n";
  while (<INFILE>) {$in .= $_;}
 close (INFILE) or die "Can't close $filename: $!\n";

 @$unit = split (/\n/,$in);
 print "\@$unit = @$unit\n"; #for debug only


 foreach $inrec (@$unit) {
       ($name, $value) = split(/=/, $inrec);
   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
   $value =~ s/<!--(.|\n)*-->//g;
   $ins{$name} = $value;
 print "\$ins{$name} = $ins{$name}\n"; # for de-bug only
 }

}

sub pause {

 print "\nPress Enter to Continue\n";
 chomp ($inkey = <STDIN>);
}
-----------------------------------------------------------------
The Data:

file: 200101woos.dat

unit=woos
childnoattend=15
mnoph=1
totsplit=34
ymnoattend=15
copycount=0
firstnoattend=1
month=01
totyw=21
first=6
vt=77
totfam=168
totpe=52
ywnoattend=9
totschild=15
totend=106
year=2001
penoattend=54
totht=92
totmp=51
wnoattend=61
totmem=338
norec=31
pass=cccc
mpnoattend=12
totchild=52
report=report
totym=26
totwomen=121
avgsm=196

file: 200101medi.dat

unit=medi
childnoattend=4
mnoph=0
totsplit=13
ymnoattend=5
copycount=0
firstnoattend=0
month=01
totyw=20
first=2
vt=72
totfam=128
totpe=33
ywnoattend=2
totschild=13
totend=90
year=2001
penoattend=32
totht=68
totmp=55
wnoattend=50
totmem=272
norec=28
pass=6666
mpnoattend=7
totchild=40
report=report
totym=12
totwomen=99
avgsm=143





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

Date: Wed, 14 Feb 2001 18:26:28 -0800
From: Ameesh Oza <ameesh@interweavetech.com>
Subject: How can I use template files?
Message-Id: <3A8B3E54.EAA03FD7@interweavetech.com>

I am trying to use template files to create other files.
I want to substitute variables inside the template files with
the values that my perl extracts from somwhere. Is there an
automatic or algorithmic way to do this?

As an aside...

If

@array_of_vars="$var1","$var2"...  (list of variable names)

How can I substitute the values of these vars directly into the array??

thanks,

Ameesh


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

Date: Thu, 15 Feb 2001 02:34:19 GMT
From: "Ben Kennedy" <bkennedy99@Home.com>
Subject: Re: Locking really large file
Message-Id: <LeHi6.1742$PT.262777@news1.rdc2.pa.home.com>


"Scott Williams" <jscottwilliams@excite.com> wrote in message
news:96ai0g$nij$1@news.phone.com...
> I'm trying to use flock to get an exclusive lock on a
> large (7.8 gig) file. When using open() or sysopen(),
> the command fails with:
>
> > can't open "/u1/largefile": Value too large for
> > defined data type
>
> Is the "defined data type" actually the file handle?
> Any way around this? I simply need to lock a bunch
> of files temporarily so another process does not write
> to them, and then unlock them.

I'm not sure if its related to your problem, but some OS'es (like Linux)
have issues when working with files of unusally large size since the size is
too big for a 32 bit long (4+ Gigs).  There are large file system patches
that may help you out.  Hope this helps--

--Ben Kennedy




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

Date: Thu, 15 Feb 2001 03:01:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Newbie : Help
Message-Id: <3A8B46FD.8886D308@rochester.rr.com>

Stan Sainte-Rose wrote:
 ...
> I need a script that can :
> 
> -1  Receive datas from a url (like :
> www.mywebsite/script.pl?param1=xxx&param2=yyy)

Include the line:

   use CGI;

and do:

   perldoc CGI

at your OS's command line prompt for documentation about the CGI module.

> -2  Make a search into a database using odbc and the param1 and param2

If you really want ODBC, include:

    use Win32::ODBC;

You would be better off to:

    use DBI;

> -3  If the datas are found then
>          Run a exe file with some datas from the database (I don't want to
> load a new webpage)

    open FH,"|programname.exe" or die "Oops, $!";

and write your data to filehandle FH.  This avoids the problem of
writing it to a disk file (what if more than one hit occurs at the same
time?).

>      Else
>         redirect to another webpage

CGI can handle this.
 ...
> Stan
-- 
Bob Walton


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

Date: Wed, 14 Feb 2001 19:56:06 -0600
From: "Jeff Fletcher" <jeff_fletcher@pacbell.net>
Subject: Re: no headers using CGI.pm
Message-Id: <tpIi6.90964$Wq1.38346424@nnrp5-w.sbc.net>

[reply to group and sender]

Actually, I was doing very well with perl and CGI, but then I switched web
hosts to a server that uses MS IIS instead of UNIX, and that's causing me
some problems.

My basic problem is this: When the scripts are called via a server-side
include, the script runs OK, but the server adds some header information
that shows up in the browser. Like this:

HTTP/1.0 200 OK Content-Type: text/html

There is a lot of documentation about this bug in IIS. It seems that IIS
needs to get all scripts with non-parsed headers. I've tried every possible
solution I've found to accomplish this, but nothing works.

That, in a nutshell, is my problem.

--------
Jeff Fletcher, Editor
sfbaygolf.com: The online guide to Bay Area golf
jeff@sfbaygolf.com
http://www.sfbaygolf.com

"Jon Ericson" <Jonathan.L.Ericson@jpl.nasa.gov> wrote in message
news:863ddgu8oi.fsf@jon_ericson.jpl.nasa.gov...
> "Jeff Fletcher" <jeff_fletcher@pacbell.net> writes:
>
> > My server uses MS IIS, so I've been told I need to prevent my scripts
from
> > sending a header. I've tried to use...
> >
> > use CGI qw(:standard -nph);
> >
> > and a few other suggested syntaxes I got here
> > (http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#nph) that
supposedly
> > do the same thing. Nothing seems to work.
>
> You seem to be learning 1) perl, 2) CGI, 3) MS IIS configuration, and
> 4) Usenet, all at the same time.  That would be a mistake.  Focus on
> one (or possibly two) until you are comfortable, then move on.
>
> I don't know how to solve your problem because I haven't got a clue
> what it *is*.  What are your expected and actual outputs?  Can you
> show us a small piece of code that reproduces your problem?  Are you
> sure it's a Perl problem, not a MS IIS or CGI problem?  Who told you
> MS IIS requires this option and what do they say when you ask this
> question?  Have you talked to a co-worker about your problem?
>
> Jon
>




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

Date: Wed, 14 Feb 2001 18:21:27 -0800
From: Terrence Monroe Brannon <terrence.brannon@oracle.com>
Subject: Re: OT:status of the reorg of The Perl Journal
Message-Id: <3A8B3D27.CB20CE7C@oracle.com>

Since I was due to have an article published in TPJ #19, I received an email
from Jon Orwant which shows that Uri's hearsay is not quite right: TPJ wasn't
sold to Internet.com. I do know that I emailed them asking about the status
and they didn't reply (2 days now). And they dont answer the phone either.

But I would think O'Reilly could take it over.


   Date:
        Tue, 2 Jan 2001 19:18:48 -0500
  From:
        Jon Orwant <orwant@oreilly.com>  | Block address | Add to Address Book

     To:
        Jon Orwant <orwant@oreilly.com>
 Subject:
        The state of TPJ



January 2, 2001

Some folks have been asking me about the status of The Perl
Journal #20, and prospective authors have been asking me
about deadlines for future issues.  The answers: TPJ #20 is
in press and ready to print, but EarthWeb (the owner of TPJ)
has told the printer to stop the presses until further
notice.  I am currently responding to proposals sent to me
with approximately "I don't know if there's going to be
another issue, but when I do I'll respond to your proposal."

Since the future of the magazine is in doubt, I can't in
good conscience greenlight proposals; I will not encourage
an author to spend weeks writing an article when I know that
it might never be printed.  So I've told people who've asked
what I know about the current situation: while EarthWeb has
sold many of its properties to internet.com so that it can
focus on "career services", it has not sold TPJ.  However,
EarthWeb has also made it clear that they don't want to
publish TPJ any more.

This story has started to leak out to the Perl community and
has already mutated a bit in not-quite-correct directions,
so I wanted to write this note to set the record straight.
Or as straight as I can, given what little I know about
EarthWeb's decisions.

While TPJ's future is very much up in the air, people
shouldn't take this as any indicator about Perl itself.
TPJ was doing just fine back when I ran it, there's no
shortage of content out there, and the magazine could easily
go bimonthly and then monthly -- indeed, when EarthWeb
acquired TPJ I had thought that was the plan.  I still enjoy
the editing, the authors enjoy the writing, and the
designers enjoy the designing.  What happens now is up to
EarthWeb.  And no, I'm not suggesting that people bombard
them with email.  Heck, they just laid off 100 people, so
I'm not even sure who to bombard.  Eventually there will be
some resolution, and when there is I'll write again to let
everyone know.

As of December 27th, this matter is now in the courts, and
so I have to adopt the "just the facts" tone of this letter
without portraying my opinions.  Someday I'll be able to
talk more about what is happening in these strange days;
until then, you'll have to conjure up your own adjectives on
my behalf.

Cheers,

Jon Orwant





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

Date: Thu, 15 Feb 2001 04:08:44 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: OT:status of the reorg of The Perl Journal
Message-Id: <3a8b564b.6716$39f@news.op.net>


In article <x78zn9m63d.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>>>>>> "m" == mothra  <mothra@nowhereatall.com> writes:
>
>  m> Hello All, I would like to subscribe to "The Perl Journal" but when
>  m> I went to the web site I found this: Unfortunately, The Perl
>  m> Journal is undergoing a transition and is not processing new
>  m> subscriptions or the ordering of back issues at this time.  Does
>  m> anyone know when they will be able to take subscriptions ?
>
>the last poop i heard was that (scum of the) earthweb sold tpj to
>internet.com.

According to Jan 2 email I received from Jon Orwant, the
editor-in-chief of TPJ:

        while EarthWeb has sold many of its properties to internet.com
        so that it can focus on "career services", it has not sold TPJ.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Thu, 15 Feb 2001 12:54:05 +0800
From: p3 <p3@netnavi.net>
Subject: Problem on mail
Message-Id: <3A8B60ED.39356829@netnavi.net>

What does 'O' mean in the header 'Status' in a mail ?

 Status: RO

Thanks for help !


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

Date: Thu, 15 Feb 2001 04:39:09 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: regex experts
Message-Id: <N3Ji6.469$MF5.6460@eagle.america.net>

On Wed, 14 Feb 2001 17:43:39 GMT, Uri Guttman <uri@sysarch.com> wrote:
>
>the $ before the ; makes no sense. that is going to be parsed as $;
>which is an obscure perl var (used to separate keys in a old perl4 style
>multilevel hash). $ only means an ending anchor if it is at the end of
>the whole regex (or some component that can end the regex).

That's interesting.  So /$^/ would be parsed as $^, the (obscure)
format_top_name Perl variable?  

A while back, I posted something like 

  perl -wne '/start_pattern/ .. /$^/ and print' file

as a way to print lines starting with the one that contains
start_pattern and continuing though the end of file.  My intention was
to choose an ending pattern that could never match (end of string
followed by beginning of string).  I just lucked out that the file
didn't contain a line with `STDOUT_TOP', eh?  I guess the correct way
would be 

  perl -wne '/start_pattern/ .. 0 and print' file

That's fewer strokes anyway.  :-)  

-- 
Garry Williams


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

Date: Wed, 14 Feb 2001 21:00:30 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Why can't I grab this URL?
Message-Id: <4065-3A8B464E-15@storefull-244.iap.bryant.webtv.net>

> cfedde@fedde.littleton.co.us

> > whataman@home.com> wrote: 
> > Why can't I grab this URL? 
> > http://www.fortunecity.com/millenium/blyton/243/clemrule.zip 
> > My coding below grabs most every 
> > URL for me and stores it in $tmpfile.
> > However, a URL on a webhost like
> > this one redirects to the webhost's 
> > HTML default page. From a browser I > > get the correct zip file,
but from the
 > > perl script below I get a default html page. Why? 

> > $ua =3D LWP::UserAgent->new;
> > $ua->agent("$0/0.1 " . $ua->agent); 
> > my $req =3D new HTTP::Request 'GET', $URL; $req->header('Accept' =3D>
'text/html'); 
> > $res =3D $ua->request($req, $tmpfile);
> > if ($res->is_error) { 
> > =A0=A0=A0=A0=A0=A0print "$res->status_line . "\n"; exit(); 
> > =A0=A0=A0=A0=A0=A0}; 
> > [ S N I P E R O O ]

> The code below prints "200 OK". I 
> suspect that the extra quote in your print > statement might be part
of the problem. 
> Good Luck 
> chris 

Thanks Chris, I'll fix that, but that's not the problem. The problem is
that the file is returning an HTML default page. Randall Schwartz
emailed me to suggest to me that the problem was the accept=3Dtext/html
line, but that doesn't seem to make any difference whether that line is
changed or even deleted. I tried accept=3Dapplication/* for zip and x-tar
files, and that didn't work. Is there another code to use for grabbing
binary tar and zip files.


Regards,
--Dennis



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

Date: Thu, 15 Feb 2001 03:20:07 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Why can't I grab this URL?
Message-Id: <slrn98mil1.ppn.efflandt@efflandt.xnet.com>

On Wed, 14 Feb 2001 05:24:00 GMT, What A Man ! <whataman@home.com> wrote:
>Why can't I grab this URL?
>
>http://www.fortunecity.com/millenium/blyton/243/clemrule.zip 
>
>My coding below grabs most every URL for me and stores it
>in $tmpfile. However, a URL on a webhost like this one
>redirects to the webhost's HTML default page. From a
>browser I get the correct zip file, but from the perl
>script below I get a default html page. Why? 

A HEAD request for that file returns response headers:

HTTP/1.1 302 Found
Date: Thu, 15 Feb 2001 03:08:19 GMT
Server: Apache/1.3.14 (Unix)
Location: http://www.fortunecity.com/denial/denial.html
Connection: close
Content-Type: text/html; charset=iso-8859-1

Maybe it doesn't like my User-agent (using plain Socket):

        if ($show == 1) {
            print SOCK "HEAD $uri HTTP/1.0\n";
        } else {
            print SOCK "GET $uri HTTP/1.0\n";
        }
        print SOCK 'Host: ',$remote,"\n",
            "User-agent: Perl/5.0 [en] (Unix script)\n\n";
        while (defined($line = <SOCK>)) { push @reply,$line; }


>$ua = LWP::UserAgent->new; 
>$ua->agent("$0/0.1 " . $ua->agent); 
>my $req = new HTTP::Request 'GET', $URL; 
>$req->header('Accept' => 'text/html'); 
>$res = $ua->request($req, $tmpfile);
>if ($res->is_error) { 
>   print "$res->status_line . "\n"; exit(); 
>   };
>
>I've also tried this using LWP::Simple's getstore($URL,
>$tmpfile), and LWP''s UserAgent $ua->mirror($URL,
>$tmpfile). Same results... they grab most files OK, except
>for one that defaults to an HTML page.
>
>My server is BSDi running Apache, and of course I don't
>know what software the servers are running where I am
>retrieving the files from.
>
>Is there a way to get around this problem, or am I doing
>something wrong?
>
>Please help. This is the fourth time I've posted this in
>over a week. I hope this one shows up. :-(
>
>Thanks,
>Dennis


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

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 V10 Issue 292
**************************************


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