[11364] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4964 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 11:19:50 1999

Date: Fri, 26 Feb 99 08:17:40 -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           Fri, 26 Feb 1999     Volume: 8 Number: 4964

Today's topics:
        Confused: Which Win95 perl to download? <raffals@access1.net>
    Re: Confused: Which Win95 perl to download? dturley@pobox.com
    Re: Confused: Which Win95 perl to download? <Allan@due.net>
    Re: Confused: Which Win95 perl to download? <metcher@spider.herston.uq.edu.au>
    Re: Confused: Which Win95 perl to download? dturley@pobox.com
    Re: Confused: Which Win95 perl to download? <Allan@due.net>
    Re: Confused: Which Win95 perl to download? dturley@pobox.com
        Connecting to NT servers mirak63@my-dejanews.com
    Re: Connecting to NT servers <zenin@bawdycaste.org>
    Re: Connecting to NT servers <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
        CONTEST: The Solitaire 500 <david@kasey.umkc.edu>
    Re: CONTEST: The Solitaire 500 (Ronald J Kimball)
    Re: CONTEST: The Solitaire 500 (brian d foy)
    Re: CONTEST: The Solitaire 500 <jdf@pobox.com>
        CONTRACT PERL PROGRAMMER (Adam Fishman)
        Converting a 64-bit int to hex? <stephane.barizien@ocegr.fr>
        create files from contents of txt file <seugenio@man.amis.com>
    Re: create files from contents of txt file <seugenio@man.amis.com>
    Re: create files from contents of txt file the_ferret@my-dejanews.com
    Re: create files from contents of txt file (Bart Lateur)
        Create HTML files from a tab file <seugenio@man.amis.com>
    Re: Create HTML files from a tab file <rick.delaney@home.com>
        Create HTML files from contents of txt file <seugenio@man.amis.com>
    Re: Create HTML files from contents of txt file <root@redbox.caroline.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 24 Feb 1999 13:22:39 -0800
From: Rich Raffals <raffals@access1.net>
Subject: Confused: Which Win95 perl to download?
Message-Id: <36D46D9F.F4F735B2@access1.net>

Hi there,

     I'm hoping that someone who's used a couple different flavors of
the x86 DOS and/or Win32 perls can help me with this.

     I went to www.perl.com, since I want to install the latest version
of Perl5 on my Windows 95 machine.  (I have an old perl4 dosperl,
currently.)  I want to do development of perl/CGI scripts on my machine,
which can then run on other people's servers (over which I have no
control).  There may also be licensing issues here, since I might
someday sell my code to people who then put it on their or their ISP's
servers.

** But, I don't want waste my limited hard drive space on a hugs package
of stuff which I will never need/use. **

     Well, www.perl.com points me to ActivePerl (which I'm just learning
about now from their site) when I click on "latest version". 
Www.perl.com also points me to:

http://language.perl.com/info/software.html

when I click on "Download Software".  At this software.html page, I can
download the source for perl 5.005_02.  Also appearing on
that page is this statement:

"Binary Distributions
    Binaries are not available for native systems. For a lot of reasons,
it's really much better if you configure and build Perl
    yourself. Anyway, it's contrary to the open and inquisitive spirit
of Perl, the Internet, and software freedom to pass
    around potentially viral binaries that people can't open up and look
at, fix up, learn from, rewrite, and simply enjoy for
    the pure sense of coding fsthetics. If your vendor didn't provide
you with a C compiler, you will need to get a binary
    version of gcc to bootstrap."

 ...which appears to conflict with the existence/philosophy of the
ActivePerl page/distribution.  And, then there's
ftp://ftp.digital.com/pub/plan/perl/CPAN/ports/win95/README, which calls
The Intel distribution is maintained by Gurusamy Sarathy "the Official
Perl 5.004_02 distribution".  I'm assuming that the 5.004_02 comment is
and old one which is now out of date.

SO, HERE ARE MY QUESTIONS:

1) What's the difference between downloading/building the Perl 5.005_02
source and downloading/installing (I'm assuming that it's already built)
the ActivePerl distribution?

2) If I go the ActivePerl route, what will be the ramifications when I
try to later upload/run my scripts on somebody else's server (who may
not have the ActivePerl installation)?

3) And, then, there's DOSPERL.ZIP at
ftp://ftp.digital.com/pub/plan/perl/CPAN/ports/msdos/
which might just be sufficient.  (I have used the Perl4 version of this,
however, and wasn't too pleased: bugs.)  In terms of disk space and
simplicity, any reason why I shouldn't just stick with this?  What's the
difference between this and the Win32 perls?

NOTES: 

* I think that I'm most interested in CGI modules, like CGI.pm.

* I have an old C/C++ compiler, Borland's Turbo C++ version 3.1 (circa
'92), which I migrated over from Win 3.1 when I bought my new Win95
machine.  I just tried to run it (for the first time on my new system)
in in a win95 dos window and the results weren't too pretty.  Maybe I
just need to do something special to make it run on win95...or, maybe it
just doesn't run on win95.  If the latter is true, then I don't have a
working C/C++ compiler to use to build perl.  This unknown makes me lean
toward ActivePerl.  Someone please tell me if I'd be making a mistake! 
:-)


Can you help?
Rich Raffals


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

Date: Thu, 25 Feb 1999 19:57:01 GMT
From: dturley@pobox.com
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <7b49u6$ere$1@nnrp1.dejanews.com>

In article <36D46D9F.F4F735B2@access1.net>,
  raffals@access1.net wrote:

> SO, HERE ARE MY QUESTIONS:
>
> 1) What's the difference between downloading/building the Perl 5.005_02
> source and downloading/installing (I'm assuming that it's already built)
> the ActivePerl distribution?

You can't build Perl form the source on windows95. You need NT to build itr on
windows. So get the ActiveState build.
>
> 2) If I go the ActivePerl route, what will be the ramifications when I
> try to later upload/run my scripts on somebody else's server (who may
> not have the ActivePerl installation)?

Perl is Perl is Perl. ActivePerl is built from the standard Perl distribution.
AS adds in some Microsoft crud like PerlScript, but you can opt not to install
it.

I regularly use AS Perl to test scripts locally before uploading them to a
Unix server. As long as you write _Perl_ and not OS-specific stuff, you won't
have problem.


--

____________________________________
David Turley

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


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

Date: Thu, 25 Feb 1999 16:00:25 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <7b4dlc$lj9$1@camel15.mindspring.com>

dturley@pobox.com wrote in message <7b49u6$ere$1@nnrp1.dejanews.com>...
:In article <36D46D9F.F4F735B2@access1.net>,
:  raffals@access1.net wrote:
:
:> SO, HERE ARE MY QUESTIONS:
:>
:> 1) What's the difference between downloading/building the Perl 5.005_02
:> source and downloading/installing (I'm assuming that it's already built)
:> the ActivePerl distribution?
:
:You can't build Perl form the source on windows95. You need NT to build itr
on
:windows. So get the ActiveState build.

I am curious as to why it is that you can't compile perl from the source
code on Win95/98 systems.

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Be consistent.
   Larry Wall in the perl man page






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

Date: Fri, 26 Feb 1999 12:38:44 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <36D60934.BF1BF153@spider.herston.uq.edu.au>

"Allan M. Due" wrote:
> 
> 
> I am curious as to why it is that you can't compile perl from the source
> code on Win95/98 systems.
> 

The makefiles say things like: command1 && command2  :which might as
well be Swahili to the 95/98 command shell.  It can be done by kluging
around with alternate shells, but there's not the history and culture of
alternate shells that Unix has.  It really is pretty difficult to do
anything useful with the standard shell.

-- 
Jaime Metcher


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

Date: Fri, 26 Feb 1999 13:18:05 GMT
From: dturley@pobox.com
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <7b66u6$37q$1@nnrp1.dejanews.com>

In article <7b4dlc$lj9$1@camel15.mindspring.com>,
  "Allan M. Due" <Allan@due.net> wrote:

> I am curious as to why it is that you can't compile perl from the source
> code on Win95/98 systems.

Are you asking why *I* can't, or why it can't be done?

--

____________________________________
David Turley

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


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

Date: Fri, 26 Feb 1999 09:05:21 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <7b69ak$ibi$1@camel19.mindspring.com>

dturley@pobox.com wrote in message <7b66u6$37q$1@nnrp1.dejanews.com>...
:In article <7b4dlc$lj9$1@camel15.mindspring.com>,
:  "Allan M. Due" <Allan@due.net> wrote:
:
:> I am curious as to why it is that you can't compile perl from the source
:> code on Win95/98 systems.
:
:Are you asking why *I* can't, or why it can't be done?


I was not trying to cast aspersions on your skills :-)  I was just asking
why it cannot be done.  I have never tried but was actually considering
giving it a go so I was curious why it cannot be done.   What the inherent
problems are, are they surmountable, how difficult would it be, etc..  I was
just curious why it is not possible to compile the code in Win95
particularly as opposed to NT or UNIX.

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Skill in manipulating numbers is a talent, not evidence of divine guidance.
  Ashley-Perry Statistical Axioms[2]





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

Date: Fri, 26 Feb 1999 15:41:37 GMT
From: dturley@pobox.com
Subject: Re: Confused: Which Win95 perl to download?
Message-Id: <7b6fbe$atp$1@nnrp1.dejanews.com>

In article <7b69ak$ibi$1@camel19.mindspring.com>,
  "Allan M. Due" <Allan@due.net> wrote:

> I was not trying to cast aspersions on your skills :-)


It very well could be my skills, or lack thereof. :-) But I think it's got
more to do with the broken shell provided by win95. I've tried many times to
get it to work to no avail. I've asked/posted around to various experts, and
have never found anyone who actually has done it. (Of course, they may be
hiding and not want anyone to know they spent the time with such an OS. :-)


--

____________________________________
David Turley

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


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

Date: Tue, 23 Feb 1999 21:15:50 GMT
From: mirak63@my-dejanews.com
Subject: Connecting to NT servers
Message-Id: <7av5pt$271$1@nnrp1.dejanews.com>

I'm trying to attach to a number of servers (NT and Netware). I have been
using the system() function to accomplish this by desigination of a drive
mapping. However, I have never had to actually move to this network drive...
ie... system('t:');.  When I do this on a 95 box I end up on T:, but when I
do this from an NT system I stay on the local drive.

Any Ideas or a better way of doing this, such as hook into an API?? The
utility I need to run can only run from the target drive.

Thanks,
Karim Wall

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


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

Date: 23 Feb 1999 22:11:15 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Connecting to NT servers
Message-Id: <919807970.153344@thrush.omix.com>

mirak63@my-dejanews.com wrote:
: I'm trying to attach to a number of servers (NT and Netware). I have been
: using the system() function to accomplish this by desigination of a drive
: mapping. However, I have never had to actually move to this network drive...
: ie... system('t:');.  When I do this on a 95 box I end up on T:, but when I
: do this from an NT system I stay on the local drive.
:
: Any Ideas or a better way of doing this, such as hook into an API?? The
: utility I need to run can only run from the target drive.

	Hmm, your utility is brain dead, but none the less what might
	chdir('T:') do on a Win32 box? -Untested, as my NT box crashed
	yesterday running my Java code and now won't start at all...

	Or, *blagh*, in a batch file:

	@T:
	perl c:\path\to\my\perl\script

	Maybe?

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Tue, 23 Feb 1999 17:11:14 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Connecting to NT servers
Message-Id: <RjIA2.8543$yv3.5764@news2.giganews.com>

mirak63@my-dejanews.com wrote in message
<7av5pt$271$1@nnrp1.dejanews.com>...
>I'm trying to attach to a number of servers (NT and Netware). I have been
>using the system() function to accomplish this by desigination of a drive
>mapping. However, I have never had to actually move to this network
drive...
>ie... system('t:');.  When I do this on a 95 box I end up on T:, but when I
>do this from an NT system I stay on the local drive.
>
>Any Ideas or a better way of doing this, such as hook into an API?? The
>utility I need to run can only run from the target drive.


>From Chapter 9 of my book:
-------------------------
Just as you can retrieve the current directory you can also change it using
the undocumented SetCwd() function:

    Win32::SetCwd( $Path );

The only parameter that it takes is a string representing the path which is
to become the current working directory. This path can be a relative or full
path but it can not be a UNC.

If the function is successful it returns a TRUE (1) value and the working
directory is set to the new path otherwise the function fails and returns
undef.

Both of these functions are demonstrated in Example 9.25 and Example 9.27.

Example 9.25. Discovering a drives file system type.
1. use Win32;
2. $NewDrive = "c:\\";
3. ($Drive, $Path) = ( Win32::GetCwd() =~ /(\d:).*)/ );
4. print "The file system for $Drive is " . Win32::FsType() . "\n";
5. if( Win32::SetCwd( $NewDrive ) )
6. {
7.   ($Drive, $Path) = ( Win32::GetCwd() =~ /(\d:).*)/ );
8.   print "The file system for $Drive is " . Win32::FsType() . "\n";
9. }

Example 9.27. Discovering a drives file system yype with Perl 5.005.
1. use Win32;
2. $NewDrive = "c:\\";
3. ($Drive, $Path) = ( Win32::GetCwd() =~ /(\d:).*)/ );
4. @Volume = Win32::FsType();
5. print "The file system for $Drive is $Volume[0].\n";
6. print "The largest file name can be $Volume[2] characters long.\n";
7. if( Win32::SetCwd( $NewDrive ) )
8. {
9.   @Volume = Win32::FsType();
10.   print "The file system for $Drive is $Volume[0].\n";
11.   print "The largest file name can be $Volume[2] characters long.\n";
12. }




You could write your code like this:

use Win32;
$Drive = "t:";
Win32::SetCwd( $Drive ) || die "Can not switch to $Drive.\n";
# Your code goes here...


dave

--
=================================================================
Dave Roth                                ...glittering prizes and
Roth Consulting                      endless compromises, shatter
http://www.roth.net                     the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net

Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/





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

Date: Wed, 24 Feb 1999 15:54:36 -0600
From: David L Nicol <david@kasey.umkc.edu>
Subject: CONTEST: The Solitaire 500
Message-Id: <36D4751C.48D46539@kasey.umkc.edu>


Hash: SHA1



Contest to see who can write the most efficient Perl program to
tackle an AI problem, of optimizing a strategy for a game of
52-card solitaire ("Wheels," based on "Idiot's delight.")

Entry deadline May 1;

Winners will be written up in summer 1999 issue of The Perl Journal.

Contest home page: http://www.tipjar.com/games/solitaire/wheels

Game demonstration GUI: http://www.tipjar.com/cgi/games/wheels/play


Version: GnuPG v0.9.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE21G3tJiOJhroV3bkRArxSAJ4jDzpyRIjg2DxjnVB+WFQxmcJ7bgCglY4y
nZ2qvmU6U1JMv/Pz5a+Nfn0=
=CTyB
-----END PGP SIGNATURE-----

________________________________________________________________________
  David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
             ++++ stop the execution of Mumia Abu-Jamal ++++
  ++++ more info: http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++


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

Date: Thu, 25 Feb 1999 00:23:17 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: CONTEST: The Solitaire 500
Message-Id: <1dnr7m6.1glh6eg1afpptgN@bay1-206.quincy.ziplink.net>

David L Nicol <david@kasey.umkc.edu> wrote:

> Contest home page: http://www.tipjar.com/games/solitaire/wheels

That's great.  Let us know when the Contest home page is ready for
viewing.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 25 Feb 1999 15:37:46 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CONTEST: The Solitaire 500
Message-Id: <comdog-ya02408000R2502991537460001@news.panix.com>

In article <36D4751C.48D46539@kasey.umkc.edu>, David L Nicol <david@kasey.umkc.edu> posted:

> Contest to see who can write the most efficient Perl program to
> tackle an AI problem, of optimizing a strategy for a game of
> 52-card solitaire ("Wheels," based on "Idiot's delight.")

what does "efficient" mean? i'm not being facetious.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 25 Feb 1999 19:24:46 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: CONTEST: The Solitaire 500
Message-Id: <m3d82yko4x.fsf@joshua.panix.com>

comdog@computerdog.com (brian d foy) writes:

> what does "efficient" mean? i'm not being facetious.

It means, "with ketchup and mustard".

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf
being facetious


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

Date: Sun, 21 Feb 1999 14:12:50 -0800
From: adam@netstores.com (Adam Fishman)
Subject: CONTRACT PERL PROGRAMMER
Message-Id: <adam-2102991412500001@coho.fishbone.com>

CONTRACT PERL PROGRAMMER

A Commercial Internet Service Provider providing Internet E-Commerce
Websites for companies around the country is accepting applications for
the position of CONTRACT PERL PROGRAMMER. Applicants must be
self-motivated, talented and have at least 3 years experience in computer
programming.

Programming experience in C/Unix, CGI scripting, SHELL, AWK, SED and PERL.
Duties will include documentation, programming, and debugging. Flexible
hours. Part-Time. 

Please send a resume and samples of programming work to:

FCI.NET 
1462 W. 8th Ave. 
Eugene, OR 97402
FAX: 541-345-1257
OR 
EMAIL jobs@fci.net


   Experience/Skills:

   * CGI scripting (Perl/C)
   * Software Debugging
   * BSDi UNIX, Linux, FreeBSD or Sun operating systems
   * system backups/maintenance scripts
   * ability to troubleshoot and solve problems creatively
   * self-motivated with a positive attitude
   * Reliable at completing projects in a timely manner

     Not Required, But Helpful:

   * UNIX system administration
   * UNIX security
   * database programming/SQL


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

Date: Mon, 22 Feb 1999 14:47:54 GMT
From: "=?iso-8859-1?Q?St=E9phane?= Barizien" <stephane.barizien@ocegr.fr>
Subject: Converting a 64-bit int to hex?
Message-Id: <36D16E1A.92AB444@ocegr.fr>

Probably a dummy's question, or I'm gonna be RTFMed on that one, but
never mind:

How do I convert a 64-bit integer to a hex string, and vice-versa?


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

Date: 23 Feb 1999 04:20:05 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: create files from contents of txt file
Message-Id: <01be5ee3$9bcd1b10$2bbe10ac@amipnet>

Hi all,
	I was wondering if its possible to create an HTML file depending on the
contents of a txt file. For instance, the ff is the output of the tab file
I extracted from the database:

Device				Lotid	    Location		               Qty
01854-005-FTA.01                LAT87533.1  R-NVAL_BXSV-BOXSTOCK     
1291.0           FINISHNOPRCD  
02072-001-FTA.01                LAT98451.1  V-BOXSTOCKV-BOXSTOCK     
808.00           FINISHNOPRCD  
02148-002-FTA.01                LAT100986.1 V-BOXSTOCKV-BOXSTOCK     
739.00          FINISHNOPRCD  
02148-002-FTA.01                LAT98568.1  V-BOXSTOCKV-BOXSTOCK     
151.00          FINISHNOPRCD  
02148-005-FTA.01                DDR50644B.1 V-BOXSTOCKV-BOXSTOCK     
2524.0          FINISHNOPRCD  

After extraction, I want to run a perl program that will automatically
create 1854.htm, 2072.htm etc where 1854.htm and 2072.htm  will have only
one line each, while 2148.htm will have two lines. Each HTML file will
enumerate the no. of  LOTIDS, that's why.


Thanks very much for your assistance...


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

Date: 23 Feb 1999 05:45:03 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: Re: create files from contents of txt file
Message-Id: <01be5ef0$451245e0$2bbe10ac@amipnet>

By the way, here's the program initially created. What it did, though, was
create 1854.htm but it printed all the contents of the tab file.

$html_dir = "D:/Inetpub/wwwroot/amip/reports/promis";

print ("parsing actl file\n");

open(FILE, "F:/actl/actl.tab") || die ("no actl file");

$/ = "Part Id";

while (!eof(FILE)) {

	$_=<FILE>;
	($part) = /0(\d+)/;
	$actl{$part} .= "Part Id" . $_;
}

foreach $part (sort keys %actl) {
	open (HTML, ">$html_dir/$part.htm");
	print HTML "
<HTML>
<HEAD>
<TITLE> AMIP PROMIS Device Report for $part</TITLE>
</HEAD>
<BODY bgcolor = \"FFFFFF\">
<H1>AMIP Part $part</H1>
<hr>
<PRE>
Part Id. $part;
";

print HTML $actl{$part};

print HTML '
</PRE>

</BODY>
</HTML>
';

close (HTML);
$last_part=$part;
}



Sheila  Eugenio <seugenio@man.amis.com> wrote in article
<01be5ee3$9bcd1b10$2bbe10ac@amipnet>...
> Hi all,
> 	I was wondering if its possible to create an HTML file depending on the
> contents of a txt file. For instance, the ff is the output of the tab
file
> I extracted from the database:
> 
> Device				Lotid	    Location		               Qty
> 01854-005-FTA.01                LAT87533.1  R-NVAL_BXSV-BOXSTOCK     
> 1291.0           FINISHNOPRCD  
> 02072-001-FTA.01                LAT98451.1  V-BOXSTOCKV-BOXSTOCK     
> 808.00           FINISHNOPRCD  
> 02148-002-FTA.01                LAT100986.1 V-BOXSTOCKV-BOXSTOCK     
> 739.00          FINISHNOPRCD  
> 02148-002-FTA.01                LAT98568.1  V-BOXSTOCKV-BOXSTOCK     
> 151.00          FINISHNOPRCD  
> 02148-005-FTA.01                DDR50644B.1 V-BOXSTOCKV-BOXSTOCK     
> 2524.0          FINISHNOPRCD  
> 
> After extraction, I want to run a perl program that will automatically
> create 1854.htm, 2072.htm etc where 1854.htm and 2072.htm  will have only
> one line each, while 2148.htm will have two lines. Each HTML file will
> enumerate the no. of  LOTIDS, that's why.
> 
> 
> Thanks very much for your assistance...
> 


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

Date: Thu, 25 Feb 1999 20:48:44 GMT
From: the_ferret@my-dejanews.com
Subject: Re: create files from contents of txt file
Message-Id: <7b4cv8$hm8$1@nnrp1.dejanews.com>

This can be done, but my first inclination would be to use a grep. However, in
your case a grep would need to written for each Device number - that is, if
you're exporing to text and then grepping the text - not very efficient.

A much better scenario would be to grep the database directly via DBI/DBD to
find the Device number thereby copying all related data and plopping it into
an html template.

Good luck.
Bruce


In article <01be5ee3$9bcd1b10$2bbe10ac@amipnet>,
  "Sheila  Eugenio" <seugenio@man.amis.com> wrote:
> Hi all,
> 	I was wondering if its possible to create an HTML file depending on the
> contents of a txt file. For instance, the ff is the output of the tab file
> I extracted from the database:
>
> Device				Lotid	    Location
       Qty
> 01854-005-FTA.01                LAT87533.1  R-NVAL_BXSV-BOXSTOCK
> 1291.0           FINISHNOPRCD
> 02072-001-FTA.01                LAT98451.1  V-BOXSTOCKV-BOXSTOCK
> 808.00           FINISHNOPRCD
> 02148-002-FTA.01                LAT100986.1 V-BOXSTOCKV-BOXSTOCK
> 739.00          FINISHNOPRCD
> 02148-002-FTA.01                LAT98568.1  V-BOXSTOCKV-BOXSTOCK
> 151.00          FINISHNOPRCD
> 02148-005-FTA.01                DDR50644B.1 V-BOXSTOCKV-BOXSTOCK
> 2524.0          FINISHNOPRCD
>
> After extraction, I want to run a perl program that will automatically
> create 1854.htm, 2072.htm etc where 1854.htm and 2072.htm  will have only
> one line each, while 2148.htm will have two lines. Each HTML file will
> enumerate the no. of  LOTIDS, that's why.
>
> Thanks very much for your assistance...
>

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


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

Date: Fri, 26 Feb 1999 09:11:10 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: create files from contents of txt file
Message-Id: <36da623b.3939770@news.skynet.be>

[posted and mailed]

Sheila  Eugenio wrote:

>	I was wondering if its possible to create an HTML file depending on the
>contents of a txt file. For instance, the ff is the output of the tab file
>I extracted from the database:
>
>Device				Lotid	    Location		               Qty
>01854-005-FTA.01                LAT87533.1  R-NVAL_BXSV-BOXSTOCK     
>1291.0           FINISHNOPRCD  
>02072-001-FTA.01                LAT98451.1  V-BOXSTOCKV-BOXSTOCK     
>808.00           FINISHNOPRCD  
>02148-002-FTA.01                LAT100986.1 V-BOXSTOCKV-BOXSTOCK     
>739.00          FINISHNOPRCD  
>02148-002-FTA.01                LAT98568.1  V-BOXSTOCKV-BOXSTOCK     
>151.00          FINISHNOPRCD  
>02148-005-FTA.01                DDR50644B.1 V-BOXSTOCKV-BOXSTOCK     
>2524.0          FINISHNOPRCD  
>
>After extraction, I want to run a perl program that will automatically
>create 1854.htm, 2072.htm etc where 1854.htm and 2072.htm  will have only
>one line each, while 2148.htm will have two lines. Each HTML file will
>enumerate the no. of  LOTIDS, that's why.

I'll put you on track.

	while(<>) { # read each line
		next unless /^(\d+)/;   #only lines starting with number
		# $1 will contain that number (incl. leading zero's
		push @{$data{$1}}, $_;
	}

There. Now the %data hash has the part numbers as keys, and the value of
each entry is an anonymous array of the lines that apply to it (incl.
newlines).

You can generate all the files from that, like this (extremely simple
version):


BTW I'm using a hash, not an ordinary array, despite the partnumbers
being numbers, because of their sparse nature.

	my $outdir = "./output"; #or wherever
	mkdir $outdir, 0777 or warn "Can't create directory: $!\n"; 

	foreach $partnumber (keys %data) {
		my $count = scalar @{$data{$partnumber}};
		print STDERR "> $partnumber: $count\n";

		open(OUT,">$outdir/$partnumber.txt")
		   or die "Can't write to file $partnumber.txt: $!";
		select OUT;

		print "Count: $count\n";
		foreach (@{$data{$partnumber}}) {
			print;
		}
	}

	Bart.


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

Date: 24 Feb 1999 06:16:25 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: Create HTML files from a tab file
Message-Id: <01be5fbd$1f2d6940$2bbe10ac@amipnet>

I am having  a dilemma. I was wondering if it's possible to create HTML
files from the device number in my tab 
file such that if my tab file has the ff:
Device#				Lot#		Location	Stage
01854-005-FTA.01                LAT87533.1  	R-NVAL_BXS  	V-BOXSTOCK     
02072-001-FTA.01                LAT98451.1  	V-BOXSTOCK	V-BOXSTOCK     
02148-002-FTA.01                LAT100986.1 	V-BOXSTOCK	V-BOXSTOCK      
02148-002-FTA.01                LAT98568.1  	V-BOXSTOCK	V-BOXSTOCK      
02148-005-FTA.01                DDR50644B.1 	V-BOXSTOCK	V-BOXSTOCK      
02148-005-FTA.01                DDR50644B.2 	W-MDES    	V-BOXSTOCK

1854.htm, 2072.htm, and 2148.htm files will be created. Each of 1854.htm
and 2072.htm will have one line in the HTML page  while 2148.htm will have
4 lines. I have the ff codes but it produces only 1854.htm and writes all
the lines in it.  Thank you all for your help! 

$html_dir = "D:/Inetpub/wwwroot/amip/reports/promis";

print ("parsing actl file\n");

open(FILE, "F:/actl/actl.tab") || die ("no actl file");

$/ = "Part Id";

while (!eof(FILE)) {

	$_=<FILE>;
	($part) = /0(\d+)/;
	$actl{$part} .= "Part Id" . $_;
}

foreach $part (sort keys %actl) {
	open (HTML, ">$html_dir/$part.htm");
	print HTML "
<HTML>
<HEAD>
<TITLE> AMIP PROMIS Device Report for $part</TITLE>
</HEAD>
<BODY bgcolor = \"FFFFFF\">
<H1>AMIP Part $part</H1>
<hr>
<PRE>
Part Id. $part;
";

print HTML $actl{$part};

print HTML '
</PRE>

</BODY>
</HTML>
';

close (HTML);
$last_part=$part;
}






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

Date: Thu, 25 Feb 1999 04:58:41 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Create HTML files from a tab file
Message-Id: <36D4DA65.B17146C0@home.com>

[posted & mailed]

Sheila Eugenio wrote:
> 
> Device#                         Lot#            Location        Stage
> 01854-005-FTA.01                LAT87533.1      R-NVAL_BXS      V-BOXSTOCK
> 02072-001-FTA.01                LAT98451.1      V-BOXSTOCK      V-BOXSTOCK
> 02148-002-FTA.01                LAT100986.1     V-BOXSTOCK      V-BOXSTOCK
> 02148-002-FTA.01                LAT98568.1      V-BOXSTOCK      V-BOXSTOCK
> 02148-005-FTA.01                DDR50644B.1     V-BOXSTOCK      V-BOXSTOCK
> 02148-005-FTA.01                DDR50644B.2     W-MDES          V-BOXSTOCK
> 
> 1854.htm, 2072.htm, and 2148.htm files will be created. Each of 1854.htm
> and 2072.htm will have one line in the HTML page  while 2148.htm will have
> 4 lines. I have the ff codes but it produces only 1854.htm and writes all
> the lines in it.  Thank you all for your help!
> 
> $html_dir = "D:/Inetpub/wwwroot/amip/reports/promis";
> 
> print ("parsing actl file\n");
> 
> open(FILE, "F:/actl/actl.tab") || die ("no actl file");
                                                      ^
You should throw $! in there.                   >  >  ^

> 
> $/ = "Part Id";

Maybe I'me being dense, but I don't see "Part Id" anywhere in the above
data.  Are you sure the whole file isn't being slurped by the first
getline?  That would explain why you get only one output file.

> 
> while (!eof(FILE)) {
> 
>         $_=<FILE>;

That's kind of odd.  Why not just

    while (<FILE>) {

?

>         ($part) = /0(\d+)/;
>         $actl{$part} .= "Part Id" . $_;
> }
> 

You could do your processing in the while loop rather than collect
everything up to loop through later.  It would involve something like:

    open (HTML, ">>$html_dir/$part.htm")
        or die "Can't open $html_dir/$part.htm:  $!\n";

    print HTML;

    close HTML or die "Maybe I shouldn't be appending:  $!\n";

Or maybe it's better your way if you want to overwrite these files each
time this script is run.

> foreach $part (sort keys %actl) {

Not much point sorting here.

>         open (HTML, ">$html_dir/$part.htm");
>         print HTML "

This is a good place for a here-doc.

    print HTML <<EOF;

> <HTML>
> <HEAD>
> <TITLE> AMIP PROMIS Device Report for $part</TITLE>
> </HEAD>
> <BODY bgcolor = \"FFFFFF\">

Then you don't need to backwhack those quotes.

> <H1>AMIP Part $part</H1>
> <hr>
> <PRE>
> Part Id. $part;

EOF

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 23 Feb 1999 05:20:44 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: Create HTML files from contents of txt file
Message-Id: <01be5eec$31622140$2bbe10ac@amipnet>

Hi all,
	I was wondering if its possible to create HTML files depending on the
output of a single txt file such that if I have the ff:

Device				Lotid	Location		Location	Qty		Procd
01854-005-FTA.01                LAT87533.1  R-NVAL_BXS		V-BOXSTOCK     
1291.0        FINISHNOPRCD  
02072-001-FTA.01                LAT98451.1  V-BOXSTOCK		V-BOXSTOCK     
808.00         FINISHNOPRCD  
02148-002-FTA.01                LAT100986.1 V-BOXSTOCK		V-BOXSTOCK     
739.00        FINISHNOPRCD  
02148-002-FTA.01                LAT98568.1  V-BOXSTOCK		V-BOXSTOCK     
151.00         FINISHNOPRCD  
02148-005-FTA.01                DDR50644B.1 V-BOXSTOCK	V-BOXSTOCK     
2524.0       FINISHNOPRCD  
02148-008-FTA.01                LAT99650.1  V-BOXSTOCK		V-BOXSTOCK     
5500.0        FINISHNOPRCD  
02148-008-FTA.01                LAT99650.3  S-TAPESTK 		S-TAPESTK      
302.00        TRAN NORMAL  
02148-008-SCB.01                A17824.1    T-BNK    		 T-NASY_BNK     
24.000      TRAN  NORMAL  
02148-008-SCB.01                A17825.1    T-BNK    		 T-NASY_BNK     
25.000      TRAN  NORMAL   

after running the perl program it will automatically create different
device HTML files where 1854.htm and 2072.htm will both have one line each
while  2148.htm will have 7 lines.  Each HTML file will contain details on
Lotid.

Thanks in advance! 




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

Date: 23 Feb 1999 05:53:00 -0500
From: root <root@redbox.caroline.net>
Subject: Re: Create HTML files from contents of txt file
Message-Id: <7lt9bddf.fsf@redbox.caroline.net>

Well you could use some of the "automagical HTML modules", but for something this simple I usually just
construct a table by hand, pretty simple.  If you have control over how those files come in, you should just
have standard separators between the fields.  Then bring in a line while ($line=<FILE>) { process line,
spit it out}  .  Usually when I have this sort of situation I also create a template file for the header
and the footer of the HTML file, that way the non-programmers can make simple changes to HTML, without
touching the perl stuff.

Good Luck,
Shane


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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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