[10731] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4330 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 1 06:07:19 1998

Date: Tue, 1 Dec 98 03:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 1 Dec 1998     Volume: 8 Number: 4330

Today's topics:
    Re: `Scripting languages' are marketing deceipts (was:  (Mark Thompson)
    Re: Access Database <lss@shaw.wave.ca>
        array value find and replace/update (Vili)
        Bad free() with perl, DBI, Informix and blobs <smith@avl.com>
    Re: Breaking a string into fixed lengths <qdtcall@esb.ericsson.se>
    Re: browsing or paging <rra@stanford.edu>
    Re: Bug in strict (5.004_04) (Andrew Allen)
        Camel Book <luoni@gol.com>
        cgi script with path_info problem, some help needed (Vili)
    Re: does perl support | piping? (was Re: localtime () - (David Formosa)
    Re: field selection using "split" - question dave@mag-sol.com
    Re: Help - replacing a substring (Bart Lateur)
    Re: how to delete from i. to j. line in a file (Cesar Romani)
    Re: Input from <TEXTAREA> via perl and DBI into MySQL d <prauz@sprynet.com>
    Re: localtime () - perl's  bug ? <jhi@alpha.hut.fi>
    Re: localtime () - perl's  bug ? <jhi@alpha.hut.fi>
    Re: localtime () - perl's  bug ? <jhi@alpha.hut.fi>
    Re: localtime () - perl's  bug ? <jhi@alpha.hut.fi>
        pdf converter <christian.lindholm@NOSPAM.fr.origin-it.com>
    Re: Perl for old, outdated, ancient systems (Bart Lateur)
        read html <roxanne@compusnet.com>
    Re: When does CLOSE not FLUSH? <cgormley@netcomuk.co.uk>
    Re: Y2K and Programmer Denial (David Alan Black)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 01 Dec 1998 08:05:07 GMT
From: mark-lists@webstylists.com (Mark Thompson)
Subject: Re: `Scripting languages' are marketing deceipts (was: Y2K and Programmer Denial)
Message-Id: <3663a2f3.40988916@news.supernews.com>

I think it's the ISP part of it.  I know that I got paid a lot less doing
scripting at an ISP than I get paid working for a "real" web development
company. 

On 1 Dec 1998 01:56:28 GMT, eln@cyberhighway.net (Erik) wrote:

>Propagated to keep salaries of "scripters" much lower than those
>of "real programmers".  At least, I'm a perl programmer, and I know I get
>paid astronomically less than people who program primarily in C...or maybe
>that's got something to do with working at an ISP.



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

Date: Tue, 01 Dec 1998 08:42:12 GMT
From: "LSS" <lss@shaw.wave.ca>
Subject: Re: Access Database
Message-Id: <EZN82.368$OW.790708@news.rdc1.ab.wave.home.com>

# Here's a start.
# It is simple, once you see how it is done.
# Squint when you read the VB samples and you will see the Perl equivalents
:-)

use OLE;
use Win32;
use Win32::File;

# DSN Connection
$dbconnection = "DSN=MyData;Uid=my;Pwd=password;";
# DSNless Connection
#$dbconnection = 'DBQ=D:\SubDir\MyData.mdb;Driver={Microsoft Access Driver
(*.mdb)};Uid=sa;Pwd=;';
$Cn1;
$Cm1;
$Rs1;

StartDb();

# Show what its made of:
while ( !$Rs1->EOF )
{
  # $Rs->EOF is true when an internal pointer is at the end of the recordset

  # extract the row
 $fields = $Rs1->Fields;

  # count the columns
 $co = $fields->Count;

  for ( $j=0; $j < $co; $j++ )
  {
    # get the jth field
  $i = $fields->Item($j);
   $n = $i->Name;
    $v = $i->Value;

  print "$n: $v "; # print its name and value
  }

  print "\n";

  # advance to the next record
 $Rs1->MoveNext();
}

StopDb();


die "\n";


sub ReportFatalError
{
  local($errmsg) = $_[0];

  print "Error: $errmsg\n";
  die "\n";
}

sub StartDb
{
  if ( $dbconnection )
  {
    if ( dbOpen($Cn1, $Cm1, $Rs1, $dbconnection) )
    {
        $Cm1->{CommandText} = "SELECT * FROM ATABLE";
        $Rs1->Open($Cm1);
    }
  }
}

# To update just call with UpdateDb(par1, par2)
sub UpdateDb
{
  my($ObjectName, $ObjectValue);

  if ( $dbconnection )
  {
    $ObjectName = $_[0];
    $Extension  = $_[1];

    $Rs1->AddNew;
    $Rs1->Fields(0)->{value} = $ObjectName;
    $Rs1->Fields(1)->{value} = $ObjectValue;
    $Rs1->Update;
  }
}

sub StopDb
{
  if ( $dbconnection )
  {
    $Rs1->Close;
    $Cn1->Close;
  }
}

sub SetErrMsg
{
  my($errmsg);

  $errmsg = $_[0];

  ReportFatalError($errmsg);
}

sub dbOpen
{
  my($Cn, $Cm, $Rs, $Errors, $LoadName, $retval);

  $LoadName = $_[3];

 $retval = 0;

  $Cn = CreateObject OLE "ADODB.Connection";

  if ( $Cn )
  {
    $Cn->{ConnectionTimeout} = 15;
    $Cn->{CommandTimeout} = 30;
    $Cm = CreateObject OLE "ADODB.Command";

    if ( $Cm )
    {
      $Rs = CreateObject OLE "ADODB.Recordset";

      if ( $Rs )
      {
        $Cn->Open($LoadName, "", "");

        $Errors = $Cn->Errors();
        $retval = keys %$Errors;

        if ( $retval )
        {
          $retval = 1;
          # May return multiple errors, warnings.
          foreach $error ( keys %$Errors )
          {
            if ( $error->{Number} != 0 )
            {
              $retval = 0;
            }
          }

          if ( !$retval )
          {
            SetErrMsg("Unable to open ADO connection.");
          }
        }
        else
        {
          $retval = 1;
        }

        if ( $retval )
        {
          $Cm->{ActiveConnection} = $Cn;
          $Cm->{CommandType} = 1;

          $Rs->{CursorType} = 1;
          $Rs->{LockType} = 3;

          $_[0] = $Cn;
          $_[1] = $Cm;
          $_[2] = $Rs;
        }
      }
      else
      {
        SetErrMsg("Unable to create ADO recordset object.");
      }
    }
    else
    {
      SetErrMsg("Unable to create ADO command object.");
    }
  }
  else
  {
    SetErrMsg("Unable to create ADO connection object.");
  }

  return $retval;
}






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

Date: Tue, 01 Dec 1998 10:42:56 GMT
From: vili.ga.ga@altavista.net (Vili)
Subject: array value find and replace/update
Message-Id: <3663c517.8333272@news.siol.net>

I would like to match a line in my data file and replace/update it
with a new value...

#@line = <FILE>

@match = grep (/matchline/, @file);

The line I would like to replace/update is now in @match so i can
replace/update it... When that is done I would like to return it to
the same place in @file... How do I do that?

$file [Is it possible to get this number?] = "new value";

Any suggestions?
--
Vili
<mailto:vili.ga.ga@altavista.net>


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

Date: Tue, 1 Dec 1998 09:02:11 +0100
From: "Steven Primrose-Smith" <smith@avl.com>
Subject: Bad free() with perl, DBI, Informix and blobs
Message-Id: <7407s4$ejc@fstgal00.tu-graz.ac.at>

Hi,

After much playing about, I finally managed to get blobs
in and out of an Informix database using DBI. However,
there is a problem. I have a function that returns the blob
as a scalar. Whenever I have a script that calls it, I get
the following error:

Bad free() ignored at <program name> line <x>

where program name is the name of the script calling the
function and x is the line number. This always occurs
whenever I try to extract a blob from the database.  The
error occurs (according to the line number) on the line
*immediately after* the function call even if the scalar is not
used within that line. The scalar contains the blob as
required but this error message is littering my web pages.
I don't know whether this is a perl, DBI or Informix problem -
can anyone help?

Best wishes,
Steven
smith@avl.com





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

Date: 01 Dec 1998 11:05:55 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Breaking a string into fixed lengths
Message-Id: <ispva418jg.fsf@godzilla.kiere.ericsson.se>

steve.cooke@wmc.com.au writes:

> Hi, I have a requirement to break a string into sub-strings of 20
> characters (provided the original string is longer than 20 chars). I
> have written some code to do this (it works!) but I would like to
> know if this is the most efficient way. Any comments on my code
> would be very welcome.

It looks like you're a C programmer new to Perl :-) Which is not meant 
to be a put-down at all, many of us started there.

The way I'd do what you ask for is with a regular expression:

@substrings = $string =~ /.{1,20}/gs;

The regex matches from one to twenty of any character at all (the 's'
modifier to the match operator makes . really match everything) in
$string, taking as much as it can at a time. The 'g' modifier to the
match operator makes it match as many times as possible (that is,
until $string is used up), and because it is in a list context it
returns the matches, which are then assigned to @substrings.

It's hard to say if this is more efficient than your solution without
doing some benchmarks (although I strongly suspect that it is), but it 
certainly is easier on the eyes of a future reader. 
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
                         Mediocre minds think alike.


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

Date: 30 Nov 1998 23:57:29 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: browsing or paging
Message-Id: <ylyaosjnva.fsf@windlord.stanford.edu>

jbeck <jbeck@dolsun.dol.state.nj.us> writes:

> In shell scripting, i'd use more (or less) if i wanted to read a long
> file one screen at a time i'm finally making the commitment to learn
> perl and have been using it quite a bit over the past month or so. i
> thought the answer would be with he format command, but was unable to
> find it. anyone?

I'd recommend doing the same thing that you do in shell scripting and
piping the output through a pager.  Using $ENV{PAGER} (and falling back on
"more") is probably the best way of doing that.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 1 Dec 1998 08:43:41 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Bug in strict (5.004_04)
Message-Id: <740a7t$q5@fcnews.fc.hp.com>

ajs@ajs.com wrote:
: I was looking at Pod::Html, and came across a bit of code which I thought
: should a) not work the way the author had thought it might and b) cause
: strict to complain. I did some more research and was horrified to find that:

: perl -lwe 'use strict;my $x = 1;&y;&z;
: 	sub y{$x = 2}sub z{print $x};{package p;$x=3;print $x}print $x'

: fails to generate an error, and outputs:
: 2 
: 3 
: 3 
: I thought that my was supposed to defend you from such silliness, but in this 
: case, it's just hiding a global from strict, and what's worse, it's failing to
: hide it from the subs!

Umm... your 'my $x' creates a file-scope lexical. 'use strict' only
protects you from unqualified package-scope globals (which are
indistiguishable from typing mistakes :) . It's assumed
once you've said 'my $x', it's "mine". Or "yours", depending on the
point of view :). Now _that_ would be fun: 'your $x', for unscoping
lexical variables you shouldn't own :) I shouldn't be up this late.
For the grammar-impaired: 'your $funny_looking'. 'my $goodness'.

Andrew


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

Date: Tue, 1 Dec 1998 10:09:30 +0100
From: "Mario Luoni" <luoni@gol.com>
Subject: Camel Book
Message-Id: <740boj$t8b@gd2inews.swissptt.ch>

The 2nd edition of the Camel Book is from October 1996. Is there a 3rd
edition in the pipeline?

-Mario




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

Date: Tue, 01 Dec 1998 10:27:42 GMT
From: vili.ga.ga@altavista.net (Vili)
Subject: cgi script with path_info problem, some help needed
Message-Id: <3663c144.7354274@news.siol.net>

Running my script as:
http://server/cgisript/cgiscript.cgi/whatever
Works just fine... It runs a cgi and returns /whatever as a path_info.

Then I have renamed cgiscript.cgi to index.cgi:
http://server/cgisript/index.cgi/whatever
I get the same result as above...

But what I would really like to run is:
http://server/cgisript/whatever
I get Error 404 saying: no "/cgisript/whatever" directory.

It should run http://server/cgisript as a script and return /whatever
as a path_info...

If I run only http://server/cgisript without a path_info it does
notice the index.cgi and runs a script without path_info...

Should I write some info to .htaccess (Apache 1.3)?

Any suggestions?
--
Vili
<mailto:vili.ga.ga@altavista.net>


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

Date: 1 Dec 1998 08:07:04 GMT
From: dformosa@zeta.org.au (David Formosa)
Subject: Re: does perl support | piping? (was Re: localtime () - perl's  bug ?)
Message-Id: <slrn7678t8.95d.dformosa@godzilla.zeta.org.au>

In article <MPG.10cd0f52ee46069a989936@nntp.hpl.hp.com>, Larry Rosler wrote:

[...]

>I can't imagine what you are thinking of!  Here is an expansion of a 
>snippet I posted yesterday, that shows how a program can disambiguate 
>*any* year input (including each of the Y2K bugs):
>
>    $year = ($year % 100 > 69 ? 1900 : 2000) + $year % 100
>        if $year < 1900 || $year >= 19100;

# Crist was born in 1AD

$year=1;

#Your snipplet gives.

2001

# My Grandmother was born on 01/01/18 

$year=18;

#Your snipplet gives.

2018


-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.



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

Date: Tue, 01 Dec 1998 09:32:57 GMT
From: dave@mag-sol.com
Subject: Re: field selection using "split" - question
Message-Id: <740d49$u4$1@nnrp1.dejanews.com>

In article <36630803.1465278@news.demon.co.uk>,
  j.cook@ion.ucl.ac.uk (Jonathan Cook) wrote:
> Hi All,
>
> Does anyone know a more elegant way of selecting the last field from
> an arbitrary length string like this:
>
> $str = "/dir1/dir2/filename";
>
> @tmp_array = split(m:/:, $str);
> $last_field = $tmp_array[$#tmp_array]; # $last_field = "filename"

brian has already pointed out the File::Basename module, but there are ways of
making your method more elegant by removing the temp array and using the index
-1 for the last element:

$last_field = (split '/', $str)[-1];

hth,

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 01 Dec 1998 09:21:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help - replacing a substring
Message-Id: <3666b47d.5911687@news.skynet.be>

Dale Sutcliffe wrote:

>I would like to replace the a substring (| with &) in a string.  How can
>I do it without prior knowledge of location of the substring or without
>tearing apart the string?

	tr/|/&/;
or
	s/\|/&/g;

("|" is special in regexes).

 This is really basic for Perl. Perl can do a far cooler stuff than
this!

	Bart.


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

Date: 1 Dec 1998 09:58:22 GMT
From: romani_c@mailcity.com (Cesar Romani)
Subject: Re: how to delete from i. to j. line in a file
Message-Id: <slrn767fdt.vem.romani_c@public.uni-hamburg.de>

On 29 Nov 1998 16:49:30 GMT, Mike Stok <mike@stok.co.uk> wrote:
>In article <slrn7628ns.13ng.romani_c@rzaix05.rrz.uni-hamburg.de>,
>Cesar Romani <romani_c@mailcity.com> wrote:
>>
>>I haven't found anything about it in the FAQs.
>>You can do it with sed, but with perl, how?
>>I'd like to delete, for example, from the 3. line to the 10. line in a file
>>or from the 3. line to a line, which contains /pattern/.
>>many thanks in advance.
>
>You might want to check out the documentation for .. in perlop.  One thing
>to try might be
>
>  perl -ni.bak -e 'print unless 3 .. /pattern/' file
>
>The perlrun manual pace will describe the command line options, the perlop
>manual page the .. 
>
>Hope this helps,
>
>Mike
>
>-- 
>mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
>http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
>http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
>stok@colltech.com                  |            Collective Technologies (work)

But If I want to delete from /patt1/ to /patt2/ without including those lines,
How can I do that?
Many thanks in advance.

__
Cesar Romani
Hamburg, Germany


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

Date: Tue, 01 Dec 1998 09:45:23 +0000
From: Balazs Rauznitz <prauz@sprynet.com>
To: adrian <adrian@internetxs.com>
Subject: Re: Input from <TEXTAREA> via perl and DBI into MySQL database.
Message-Id: <3663BAB3.398F6B7A@sprynet.com>

adrian wrote:
> 
> On a webpage I have an area that people can input 'unlimited' length
> text using the <TEXTAREA> HTML tag. This is passed thru my perl script
> into a MySQL database using DBI and DBD:mysql. The receiving coloumn
> has been defined as TEXT.
> 
> Only this just doesn't work! If I "force" an entry of exactly what is
> input from the page by putting that in the INSERT statement the table
> does get updated?!

Maybe you could cite the code that attempts to insert the contents of
the TEXTAREA.

Balazs


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

Date: 01 Dec 1998 11:01:26 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: localtime () - perl's  bug ?
Message-Id: <oeebtlop76h.fsf@alpha.hut.fi>


Russ Allbery <rra@stanford.edu> writes:

> Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
> 
> > Definitely.  I hope whoever designed the contents of struct tm feels
> > really ashamed.  There are at least three bad decisions.  (1) The year
> > has no good reason [1] to be -1900'ed. (2) The month has no good reason
> > to be -1'ed [2].  (3) If the month is -1'ed, why not the day of the
> > month?
> 
> > [1] "the seconds since 1900-01-01 fit better into a X-bit integer
> >      than the seconds since 1-01-01" is not a good reason.  The library
> >      should worry about such details, the user shouldn't be punished
> >      for poor library implementation.
> 
> It's worse than that, of course.  Everything else uses seconds since 1970.

If you count ANSI C time_t as "everything"...but the "seconds since"
is not universally counted from 00:00:00 1970-01-01.  VMS uses some
random-looking-date in 1858 (*) and AFAIK MacOS uses the 1900.

(*) it's not random, it's actually good astronomical math.

> -- 
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 01 Dec 1998 11:14:28 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: localtime () - perl's  bug ?
Message-Id: <oee90gsp6kr.fsf@alpha.hut.fi>


Clive Newall <crn@itga.com.au> writes:

> Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
> 
> > Gareth Rees <garethr@cre.canon.co.uk> writes:
> > 
> > > (*) Poor design decisions are bugs too.
> > 
> > Definitely.  I hope whoever designed the contents of struct tm feels
> > really ashamed.  There are at least three bad decisions.  (1) The year
> > has no good reason [1] to be -1900'ed. (2) The month has no good
> > reason to be -1'ed [2].  (3) If the month is -1'ed, why not the day of the
> > month?
> > 
> > [1] "the seconds since 1900-01-01 fit better into a X-bit integer
> >      than the seconds since 1-01-01" is not a good reason.  The library
> >      should worry about such details, the user shouldn't be punished
> >      for poor library implementation.
> > [2]  Neither is "it's so handy to access 0-based array month_name[month]".
> >      Shaving off the time/space required to do the -1 is silly.
> 
> New at this game, aren't you? When these decisions were made, every

Yes, thankfully.

> clock cycle saved made significant difference. As did every byte of
> precious memory saved. Often forgotten in these days of software bloat
> and 100+MHz processors.

The space argument doesn't hold.  Why?

Because: please explain why waste whole ints for seconds, minutes,
hours, day-of-months, months, years, day-of-years,
is-daylightsaving-times?  9 ints?  shorts would have worked for all of
those, and chars for all except the day-of-year.

Why not pack the whole thing into bitfields?  I count only
6+6+5+5+4+7+9+1 = 43 bits needed (assuming here 7 bits for years since
1970, which gives us 59 years past the Y2K38, I'm being generous here)

Currently the struct tm is hogging 9*32 = 288 bits, egads, 245 wasted
bits...  Okay, okay, let's align that into two 32 bit integers: 64
bits.  That's still 224 wasted bits.

I doubt that the argument about time wasted in doing one substraction
also doesn't hold: if we are talking about outputting the month_name
elements, the O-side of I/O surely has always been magnitudes slower
than the substraction.  If we are talking about some in-core
computations, well, the subtraction need only be done when the
interface between the user-visible struct and the library internals is
crossed.

But as I said, I'm wasting my breath.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 01 Dec 1998 11:19:30 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: localtime () - perl's  bug ?
Message-Id: <oee3e70p6cd.fsf@alpha.hut.fi>


Clive Newall <crn@itga.com.au> writes:

> Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
> 
> > Gareth Rees <garethr@cre.canon.co.uk> writes:
> > 
> > > (*) Poor design decisions are bugs too.
> > 
> > Definitely.  I hope whoever designed the contents of struct tm feels
> > really ashamed.  There are at least three bad decisions.  (1) The year
> > has no good reason [1] to be -1900'ed. (2) The month has no good
> > reason to be -1'ed [2].  (3) If the month is -1'ed, why not the day of the
> > month?
> > 
> > [1] "the seconds since 1900-01-01 fit better into a X-bit integer
> >      than the seconds since 1-01-01" is not a good reason.  The library
> >      should worry about such details, the user shouldn't be punished
> >      for poor library implementation.
> > [2]  Neither is "it's so handy to access 0-based array month_name[month]".
> >      Shaving off the time/space required to do the -1 is silly.
> 
> New at this game, aren't you? When these decisions were made, every
> clock cycle saved made significant difference. As did every byte of
> precious memory saved. Often forgotten in these days of software bloat

Oh yes, that's explains why struct tm has to be, what, 9 integers or
288 bits (or 576 bits, in Crays and other ILP64 systems) wide, while,
ummm, about 43 bits would suffice.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 01 Dec 1998 12:17:38 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: localtime () - perl's  bug ?
Message-Id: <oeeyaosnp31.fsf@alpha.hut.fi>


Clive Newall <crn@itga.com.au> writes:
> New at this game, aren't you? When these decisions were made, every

Only hobby programming Z80 in the mid-80s.

> clock cycle saved made significant difference. As did every byte of
> precious memory saved. Often forgotten in these days of software bloat

Oh yes, that's explains why struct tm has to be, what, 9 integers or
288 bits (or 576 bits, in Crays and other ILP64 systems) wide, while,
ummm, about 43 bits would suffice.

> and 100+MHz processors.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Tue, 1 Dec 1998 11:23:21 +0100 
From: "Lindholm Christian" <christian.lindholm@NOSPAM.fr.origin-it.com>
Subject: pdf converter
Message-Id: <01be1d15$6acb9c40$d6c010ac@pc1447.surpat.fr.origin-it.com>

Does anybody know how to convert pdf files to simple text ? 
Is it possible to find a perl script for this ?
Thanks in advance
-- 
christian.lindholm@NOSPAM.fr.origin-it.com
Don't forget to remove NOSPAM from my adress



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

Date: Tue, 01 Dec 1998 09:16:51 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl for old, outdated, ancient systems
Message-Id: <3665a8e2.2940684@news.skynet.be>

Keith Paschal wrote:

>Aside from going out and spending a few hundred bucks on a newer laptop,
>is there a version of Perl that will run on my clunky old 486/MS-DOS/Win
>3.1 (Uhhhhgggg dreaded MS) system?

Thank you for calling my main system old and outdated. :-)

There are two excellent ports for MS-DOS: the OS/2 port, and the DJ
Delorie GNU port. I've just recently switched from the OS/2 port to the
(newer) DJGPP port. It seems to start up faster under Win3.1 than the
OS/2 port did.

Anyway, go to <http://www.perl.com>, and in the left column, look for
the word "CPAN". Go to the "Perl ports" section, to "MS-DOS". You can
easily find and download the files from there.

Once you get the DJGPP port, a near 2Mb file, and unzip it (maintain
directory tree when unzipping), there are just a few things to be done
manually:
 * Change the "Config.pm" module so that it contains only references to
your actual perl directories
 * By preference, add the Perl BIN directory to the PATH environmental
variable (in AUTOEXEC.BAT)
 * If necessary, set up the PERL5LIB environmental variable (in
AUTOEXEC.BAT) so that it points to the root of the libraries
 * If you want to run script in plain DOS, not just under Windows, you
need a DPMI server program as well. Get v2misc/csdpmi3b.zip from a GNU
site, e.g. <ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/>. (I
haven't tried v4 just yet.) Place the CWSDPMI.EXE file (a mere 20k) in
Perl's BIN directory, next to PERL.EXE, and it will be found and loaded
automatically when Perl is started under DOS, i.e. only if necessary. As
I said, you don't need this, to be able to run Perl scripts in a DOS
box.

There. These instructions are also part of the README.DOS file included
with the distribution as well, but I wanted to put them in in a concise
to-do list as well.

Oh, one more thing: to update the Config.pm module, DO NOT use the perl
command line as shown. It didn't work for me. It only renamed Config.pm
to Config.pm~, and created a new empty file Config.pm. That's not what
it should have done. Sigh.

To actually RUN Perl scripts, I'd advice you to get the PFE editor
(free; <http://pfe.iquill.net/>). You can edit scripts, run a command
line, usually in the form "perl -w script.pl *.txt", and see the printed
results (STDOUT and STDERR) in a window in the editor. Neat.

Happy scripting!

	Bart.


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

Date: Mon, 30 Nov 1998 03:41:05 -0500
From: "Bill G." <roxanne@compusnet.com>
Subject: read html
Message-Id: <36625A21.E742B02B@compusnet.com>

I'm a beginner with Perl and I'm trying to write cgi that will read the
html page at a given URL,
parse it and then send it to a requester as an HTML document. The part I
don't understand
how to do is to read in the HTML from a specified URL. If anyone could
give me a hint, I
would certainly appreciate it. This is probably an easy thing to do, if
you know how.

Thanks,
Bill G.
truedeals@yahoo.com



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

Date: Tue, 1 Dec 1998 09:58:19 -0000
From: "Clinton Gormley" <cgormley@netcomuk.co.uk>
Subject: Re: When does CLOSE not FLUSH?
Message-Id: <740eje$56r$1@taliesin.netcom.net.uk>


>>
>> However, surely any open file handles are closed when the script exits
>> (and thus presumably flushed?)
>
>Yes, unless something terribly wrong happens. (They're still closed, in
>that case, but they may not be flushed.)
>
>> When i did unlock the file first (with the
>> erroneous close in place), this also served to flush the buffer.
>
>That's perl, trying to save you from your mistakes. :-)  But it's a waste
>of an opcode, if you're only going to close the file anyway.
>
>But if you've got that small, self-contained example of data not being
>written properly when a file is auto-closed by Perl, please post it here.
>Thanks!


Here's the code.  This works now.  But take away the close and it would
malfunction.

#!/usr/local/bin/perl
use Fcntl qw(:flock);
 .
 .
 .
$rsafile='>>../dat/deposit.rsa';

 open (RF,$rsafile)||die ("Can't open rsafile : $!");
 flock(RF,LOCK_EX)||die ("Can't lock RSAFILE : $!");
 seek (DF,0,2);
  print RF rsa   ($entry{type}.";".
   $entry{title}.";".
   $entry{name}.";".
   $entry{names}.";".
   $entry{surname}.";".
   $entry{addr1}.";".
   $entry{addr2}.";".
   $entry{addr3}.";".
   $entry{addr4}.";".
   $entry{code}.";".
   $entry{stdt}.$entry{tel}.";".
   $entry{stdteve}.$entry{televe}.";".
   $entry{email}.";".
   $entry{year}.$entry{month}.$entry{day}.";".
   $entry{tax}.";".
   $entry{timestamp}."\r\n");
 close (RF);
 .
 .
 .

Thanks

Clint

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




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

Date: 1 Dec 1998 04:53:42 -0500
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Y2K and Programmer Denial
Message-Id: <740eb6$1n6$1@pilot.njin.net>

finsol@ts.co.nz writes:

>In article <73urot$g1a$1@marina.cinenet.net>,
>  cberry@cinenet.net (Craig Berry) wrote:
>> finsol@ts.co.nz wrote:
>> [snip]
>> : Many of you following the debate may be interested in reading further on
>> : the subject discussed.  My first article was on 'booby trap code', a
>> : problem that affects
>>
>> It is very difficult to take anything else you say seriously when your
>> list of 'programming languages' --
>>
>> : programming languages such as Perl, MacPerl, C, C++, Java,
>> : Javascript, CGI, MVS and CICS.
>>
>> -- consists of two variants of the same language, two languages that share
>> the same time-handling underpinnings, two other languages, and then -- the
>> kicker -- an interface specification and two operating systems.
>>
>> I stopped reading at this point.
>>

>I was writing for both a technical and non-technical audience. For the
>purposes of the article, there is no necessity to make the distinctions you
>mention. It does not improve meaning, it just adds unnecessary jargon.


"Operating system" is jargon?!  Why, even the OS is DOS stands for
"operating system"!  And the I in CGI stands for Interface, so Craig is
hardly "add[ing]" anything.

Actually, "operating system" is a more familiar term to most non-technical
people than "programming language" - so perhaps you'd be better off
describing Perl, C, Java, etc. as "operating systems". 

You're right, though - for the purposes of the article (the chief purpose
being to promote the image of you as a sage, prophet, oracle, etc. etc.),
it doesn't matter.  

>Technical people may dearly love to use jargon to show how very clever they
>are, but does not always assist in the understanding of the subject matter. 

You must be hanging out with some extremely down-market technical people.

>fact that they can ALL cause Y2K problems.  That is the issue and a very
>important one. Getting into a huff because someone, in your opinion, has
>failed to make these distinctions does not make this issue go away.  You seem

No huffs (huvs?) have been gotten into.  Craig's point was simply that you
were misusing technical terminology in a fairly striking and serious way,
which you were.

>to need to find reasons to ignore this issue. I know Y2K work is very boring,
>we'd all love to be doing the really clever stuff, we hate to find bugs -
>especially if they are our own BUT some very serious problems may occur if
>this message is lost.

No, actually, I can't think of any bugs I'd rather find than those in my
own code.  After all, I've invested time and effort in it - naturally I
want to make sure it's as good as it can be.

If programming were really the ego-trip/pissing-contest you think it is,
we wouldn't have perl (among many other projects).  


David Black
dblack@pilot.njin.net


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 4330
**************************************

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