[17291] in Perl-Users-Digest
Perl-Users Digest, Issue: 4713 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 24 18:14:14 2000
Date: Tue, 24 Oct 2000 15:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972425114-v9-i4713@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 24 Oct 2000 Volume: 9 Number: 4713
Today's topics:
Re: [Newbie]: "if" statements (Tad McClellan)
Re: A Simpler perlish way <Jodyman@usa.net>
Re: A Simpler perlish way <lr@hpl.hp.com>
Re: ActivePerl: Want to skip open files when unlinking jgrinwal@my-deja.com
Re: ActivePerl: Want to skip open files when unlinking (Martien Verbruggen)
Apache/Perl "Method Not Allowed" error al_woods@my-deja.com
Re: Associative Array Increment <lr@hpl.hp.com>
Re: Associative Array Increment (Tad McClellan)
Re: Associative Array Increment (Martien Verbruggen)
Re: Can someone help <tim@ipac.caltech.edu>
Re: CGI to run makefile (Michel Dalle)
DBM vs. hash text file <bruce_phipps@my-deja.com>
Re: Don't use -w in CGI? (brian d foy)
Re: File Locking and CGI <ddunham@redwood.taos.com>
force dowload <bcanning@netresults-media.co.uk>
Re: force dowload <camerond@mail.uca.edu>
Re: force dowload jb4mt@my-deja.com
Help!!! hsriniv@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Oct 2000 13:15:47 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: [Newbie]: "if" statements
Message-Id: <slrn8vbgu3.8ds.tadmc@magna.metronet.com>
On Tue, 24 Oct 2000 18:32:17 +0200, Sébastien Ferrandez
<sferrandez@wineandco.com> wrote:
>if ($jour=="lun") {
>I've been looking at various perl tutorial sites but I found that to be
>syntaxically (almost?) correct.
Of course it is syntactically correct, else it would not
compile and run :-)
"Syntax" seems to get lots of emphasis when it is merely a
housekeeping detail.
"Semantics" (the _meaning_ of the syntax) is Much Harder to get right.
Syntax problems are generally trivial to solve, a machine can
find them.
Semantic problems nearly always require a human (like?) intelligence.
You have a semantic error, not a syntax error.
You have asked for them to be compared as numbers (==). If you
want something else, then ask for something else :-)
( like "compare them as strings", which is "eq" instead of "==")
and TURN ON WARNINGS. It would have warned you about the mistake
you made in less than one second!
How much time did you spend on this problem?
How long would it have taken you to type 3 characters to turn
on warnings?
Work smart, ask perl to help you by starting off all of your
Perl programs with these 2 lines:
#!/usr/bin/perl -w
use strict;
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 24 Oct 2000 14:43:14 -0400
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Re: A Simpler perlish way
Message-Id: <8t4lf4$ena$1@plonk.apk.net>
Bart Lateur wrote in message <49fhusk7mbm0ejsu395g8f99mgr6am2u8n@4ax.com>...
>Jody Fedor wrote:
>
>>if ($yr%4 == 0) {$days[1] = 29} else {$days[1] = 28};
>
>This rule is too simple. The proper rule is:
>
> if the year is divisible by 4
> it's a leap year, unless
> the year is divisible by 100,
> then it's not a leap year, unless
> the year is divisible by 400,
> then it *is* a leap year
>
>So 2000 is a leap year, but 1900 was not.
I assume 2096 is a leap year, then why not 2100? It is four
years later?
2096/4 = 524
2096/100 = 20.96
2096/400 = 5.24
2100/4 = 525
2100/100 = 21 (Shouldn't be a leap year)
2100/400 = 5.25
Doesn't leap year come every 4 years no matter what? Help here.
Jody
------------------------------
Date: Tue, 24 Oct 2000 11:59:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: A Simpler perlish way
Message-Id: <MPG.145f7c06524e5bd898ae66@nntp.hpl.hp.com>
In article <8t4lf4$ena$1@plonk.apk.net> on Tue, 24 Oct 2000 14:43:14 -
0400, Jody Fedor <Jodyman@usa.net> says...
...
> Doesn't leap year come every 4 years no matter what? Help here.
No. Search the Web for explanations. Here's one off the top of the
Google search for 'calendar leap year':
http://155.135.31.26/oliver/smt310-handouts/calendar.htm
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 24 Oct 2000 19:48:48 GMT
From: jgrinwal@my-deja.com
Subject: Re: ActivePerl: Want to skip open files when unlinking
Message-Id: <8t4p2t$msr$1@nnrp1.deja.com>
In article <slrn8vaqqv.k23.mgjv@martien.heliotrope.home>,
mgjv@tradingpost.com.au wrote:
> On Tue, 24 Oct 2000 08:57:15 GMT,
> Gus <gus@black.hole-in-the.net> wrote:
> > jgrinwal@my-deja.com wrote:
> >
> > > The problem is, the application still has log file open--it just
hasn't
> > > updated it because the application has been idle. The "unlink"
> > > returns "Permission denied", the same error I would get if the
file /
> > > directory permissions did not allow deleting.
> >
> > Would it be better to say
> >
> > foreach file
> > if [ exists ]
> > stat perms
> > if [ perms permit delete ]
> > unlink || file must be open
> >
> > Explicity check if you can delete the file, and if you can't the
only other
> > possibility is that NT is preventing you becase the file is open.
>
> Or you do not have the permissions to remove the file because of
> something else than the permissions on the file itself (does NT have
ACL
> functionality, or something like that?), or the file doesn't exist
> anymore (because something else removed it just when you weren't
> looking), or it is a directory with files still in it, or the file
> doesn't exist, because for some reason you constructed the path to it
> incorrectly, or NT ran out of memory while it was trying to do this,
or
> there was a file system error or corruption. NT might even have other
> reasons that I didn't think of. And the developers might invent other
> reasons tomorrow, for the next release of the OS.
>
> Never assume that you know why an unlink, or any system call, fails.
> Inspect the $! variable to find out. If you can't unlink the file, you
> can't. All you can do is display the reason. If the OS doesn't give
you
> more reason than 'permission denied', then that is sad, but it is all
> you have. Assuming that there are only two possible reasons for that
> error even is false. Assuming that there are only two possible errors
in
> total is plainly silly.
>
> To the OP: Make the application that has the log file open behave more
> sanely, and have it rotate its log files after an appropriate time.
That
> means that you can delete or move the old copies, while it still has
its
> current copy open. This is standard behaviour for long running
processes
> and daemons, and any decent application worth its salt should be able
to
> rotate its log files itself, or be told to rotate them, without the
need
> to shut down. If this application can't do that, complain loudly ad
> anoyingly to its author. (On Unix a reopen is enough, and externally
you
> can just rename the file. I don't know whether that will work on NT).
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division |
> Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
> NSW, Australia |
>
The application producing the log files was written to rotate to a new
log after files reach a certain size, or when the NT service is stopped
and restarted. The cleanup script needs to take both into account. It
globs a list of file with the extension '.log' from the requested
directory, then checks each file as a candidate for deletion. If the
file exceeds the deletion criteria limit, (i.e., older than N days, or
larger than M bytes), it next uses Win32::File::GetAttributes to check
if the file is READONLY, SYSTEM, or HIDDEN. If not, then it is a
candidate for deletion.
At that point there are two reasons why the unlink could possibly fail:
1. Someone changed the NT security permissions on the
file/directory, and now none of the files can be deleted.
2. An application still has the file open.
I have eliminated the first by checking NTFS security on the folder /
file in question. This leads me to Reason 2, because
- the NT service is running
- this is the last log the NT service has produced
As the NT service has been idle for 7 days (nothing to process, nothing
to log) the log file has exceeded the age deletion limit.
In the script, if an unlink fails, I do the following
if (unlink($file)) {
print G_LOG "Success!!\n";
} else {
print G_LOG "Failed: $!\n";
next if ($ONE_EMAIL_PER_DIRECTORY);
send_email ($G_TO, $G_FAIL_MSG_SUBJ, "$G_SCRIPT Could not delete
$file: $!\n\nSee $G_LOG\n\n");
$ONE_EMAIL_PER_DIRECTORY = 1;
}
This produces the email with text
Deletion of APPLOG22.log Failed: Permission denied
As you can see by the code, '$!' = "Permission denied". I get the same
response whether the NTFS permissions do not allow deletion, or whether
the file is open by the NT Service.
I want the email if the unlink fails. (because that means someone
accidentally or intentionally changed NTFS permissions). But if I can
skip the deletion attempt if someone has the file open, then I will not
get the email.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 24 Oct 2000 21:53:43 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: ActivePerl: Want to skip open files when unlinking
Message-Id: <slrn8vc174.a0g.mgjv@verbruggen.comdyn.com.au>
On Tue, 24 Oct 2000 19:48:48 GMT,
jgrinwal@my-deja.com <jgrinwal@my-deja.com> wrote:
> In article <slrn8vaqqv.k23.mgjv@martien.heliotrope.home>,
> mgjv@tradingpost.com.au wrote:
> >
> > To the OP: Make the application that has the log file open behave more
> > sanely, and have it rotate its log files after an appropriate time.
>
> I want the email if the unlink fails. (because that means someone
> accidentally or intentionally changed NTFS permissions). But if I can
> skip the deletion attempt if someone has the file open, then I will not
> get the email.
Ok, fair enough. My point was however, that there may be othe reasons
that you haven't thought of that may get the 'Permission' denied
error. Or a future release of NT might add other reasons (ACL
control). Be certain that the logic you employ works, and works
correctly, or you will end up rejecting errors for the wrong reasons.
I don't know of any way to find out whether a file is
already open in Perl. There may be platform specific possibilities on
NT, but I'm not aware of any, and it would mean that you would need to
either use a Win32 specific module, invoke a low level system call
with syscall, or run an external program that provides that
information. Maybe parallell ro this thread you could ask in a windows
programmer's group whether it is possible to even get that
information. If it is, you should be able to write some glue to get
that info back in Perl.
I'll now clear the deck for someone who might know some NT specific
solution.
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Tue, 24 Oct 2000 19:01:41 GMT
From: al_woods@my-deja.com
Subject: Apache/Perl "Method Not Allowed" error
Message-Id: <8t4mag$kb2$1@nnrp1.deja.com>
Hello,
I'm new to the Apache/Perl world and am trying to
get a script that POSTs to work but keep getting
the error:
Method Not Allowed
The requested method POST is not allowed for
the URL /cgi/GOLDTEST.cgi.
Can anyone give me a lead on what I'm missing?
Thanks in advance,
al...
--------------------------------------------------
---------------------
Al Woods mailto:al.woods@pbi.ab.ca |
Information Services
http://www.pbi.ab.ca | Prairie
Bible Institute
(403)443-5511 x3477 | Three
Hills, AB Canada T0M 2N0
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 24 Oct 2000 11:50:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Associative Array Increment
Message-Id: <MPG.145f79edb30689fc98ae65@nntp.hpl.hp.com>
In article <slrn8vb5hk.7n9.tadmc@magna.metronet.com> on Tue, 24 Oct 2000
10:01:24 -0400, Tad McClellan <tadmc@metronet.com> says...
> On Tue, 24 Oct 2000 10:21:56 -0400, Joe Kline <jkline@one.net> wrote:
> >ljl_ljl@my-deja.com wrote:
> >>
> >> I can't really understand what line 10 and 11 about the increment does.
>
> >> $shell_list{$shelltype}++;
> >
> >This is a shortcut
>
> >Alternately it could be written:
> >
> >$shell_list{$shelltype} += 1;
>
> Which is just a longer shortcut :-)
>
> The verbose form is:
>
> $shell_list{$shelltype} = $shell_list{$shelltype} + 1;
Careful, Tad! Those are not equivalent, with regard to warnings for
perviously nonexistent hash members.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 24 Oct 2000 16:44:16 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Associative Array Increment
Message-Id: <slrn8vbt50.956.tadmc@magna.metronet.com>
On Tue, 24 Oct 2000 11:50:56 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn8vb5hk.7n9.tadmc@magna.metronet.com> on Tue, 24 Oct 2000
>10:01:24 -0400, Tad McClellan <tadmc@metronet.com> says...
>> On Tue, 24 Oct 2000 10:21:56 -0400, Joe Kline <jkline@one.net> wrote:
>> >ljl_ljl@my-deja.com wrote:
>> >>
>> >> I can't really understand what line 10 and 11 about the increment does.
>>
>> >> $shell_list{$shelltype}++;
>> >
>> >This is a shortcut
>>
>> >Alternately it could be written:
>> >
>> >$shell_list{$shelltype} += 1;
>>
>> Which is just a longer shortcut :-)
>>
>> The verbose form is:
>>
>> $shell_list{$shelltype} = $shell_list{$shelltype} + 1;
>
>Careful, Tad! Those are not equivalent, with regard to warnings for
>perviously nonexistent hash members.
Careful all of us!
$shell_list{$shelltype}++ is not equivalent to _any_ of them
if the value happens to be a string...
So many things to remember using this Power Tool.
Oh, that power came more easily :-)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 24 Oct 2000 21:59:25 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Associative Array Increment
Message-Id: <slrn8vc1hp.a0g.mgjv@verbruggen.comdyn.com.au>
On Tue, 24 Oct 2000 10:01:24 -0400,
Tad McClellan <tadmc@metronet.com> wrote:
> On Tue, 24 Oct 2000 10:21:56 -0400, Joe Kline <jkline@one.net> wrote:
> >ljl_ljl@my-deja.com wrote:
> >>
> >> I can't really understand what line 10 and 11 about the increment does.
>
> >> $shell_list{$shelltype}++;
> >
> >This is a shortcut
>
> >Alternately it could be written:
> >
> >$shell_list{$shelltype} += 1;
>
> Which is just a longer shortcut :-)
>
> The verbose form is:
>
> $shell_list{$shelltype} = $shell_list{$shelltype} + 1;
if (exists $h{foo4})
{
$f{foo4} = $h{foo4} + 1;
}
else
{
$f{foo4} = 1;
}
Martien
--
Martien Verbruggen |
Interactive Media Division | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd. | spot.
NSW, Australia |
------------------------------
Date: Tue, 24 Oct 2000 12:05:51 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Can someone help
Message-Id: <39F5DD8F.58B234A7@ipac.caltech.edu>
s_punk@my-deja.com wrote:
>
> Im new to perl and I am trying to parse a particular web site. If I
> just print one of the lines it will work. As soon as try to add the
> other lines it will not compile right. Is there something Im not
> seeing?
Certainly. The same thing I'm not seeing:
use strict;
use warnings;
Once you put those lines at the top of your script and fix the obvious errors,
the remaining warning and errors may give you clues about what's wrong. I'll
help you clean a few th9ings up to get you going:
> #!/app/eol/perl/bin/perl
> # This is designed to download the status of the differ weblogic servers
>
> use LWP::UserAgent;
> use File::Copy;
>
> $ua = LWP::UserAgent->new;
> $req = HTTP::Request->new(GET => 'http://somewebsite');
>
> $nrt = $ua->request($req)->as_string;
Put 'my' in front of these three lines to quiet the warnings.
>
> $nrt =~ /version<\/*./;
This line accomplishes nothing.
>
> ($ver, $launched, $uptime) =
my ($ver, $launched, $uptime) =
> ($nrt =~ m@version<.*>(\d[^<]*) # version
> .*Launched<.*>([^<]*) # Launched
> .*Uptime<.*>(\d[^<]*) # uptime
> @x);
> print "$ver, $launched, $uptime\n";
> #if I print one of the $ above it works, add another and it won't print.
I guess I'm not completely clear on what you mean. You mean it will print $ver,
but when you add $launched to the print statement ... what happens exactly? Or
do you mean it fails if you do another request? Or are you trying to pull
multiple sets of version..e.tc. tags out of one request?
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Tue, 24 Oct 2000 21:15:35 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: CGI to run makefile
Message-Id: <39f5fbc6$0$20282$73bec57d@news.be.uu.net>
In article <u9og0a6vld.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
>Fraser <r.fraser@student.murdoch.edu.au> writes:
>
>> I've made a HTML page which I write c code in and I want to submit it to
>> a Perl CGI script to run a "makefile" on a UNIX system and send me back
>> the executable.
>> Can someone please advise on how this is possible.
>
>This is a realatively complex task that breaks down into smaller tasks
>each of which is trivial.
>
>As such the answer to "Can someone please advise on how this is
>possible" is "write a program to do it".
>
OK, I've written a little program to do that :)
#!/usr/bin/perl -w
use strict;
my $complex_task = <<End_of_task;
I've made a HTML page which I write c code in and I want to submit it to
a Perl CGI script to run a "makefile" on a UNIX system and send me back
the executable.
End_of_task
$complex_task =~ tr/\n/ /;
my $breakdown = qr/\b(?=and|to|which|\.)\b/;
my %clpm_lore = (
qr(CGI) =>
q(have you read the CGI documentation yet ? Type "perldoc CGI"),
qr(c code) => q(are you sure you want to do that ?),
qr(doesn't work) => q(check on line 17),
qr(Godzilla!) => q(*plonk*),
qr(HTML) => q(have you used an HTML validator on that ?),
qr(run) => q(that sounds like system(). Type "perldoc -f system"),
qr(submit) => q(OK, your browser will handle that),
qr(send.*?back) =>
q(have you read the CGI documentation yet ? Type "perldoc CGI"),
qr(want) => q(have you thought about other ways to achieve your goal ?),
);
my $counter = 1;
foreach my $trivial_task (split($breakdown, $complex_task)) {
print "$counter : $trivial_task\n";
foreach my $keyword (keys %clpm_lore) {
if ($trivial_task =~ $keyword) {
print "--> $clpm_lore{$keyword}\n";
}
}
$counter++;
}
print "P.S.: don't forget to think about security...\n";
exit;
Improvements are definitely welcome...
Michel.
------------------------------
Date: Tue, 24 Oct 2000 21:53:09 +0100
From: "Bruce Phipps" <bruce_phipps@my-deja.com>
Subject: DBM vs. hash text file
Message-Id: <8t4st0$cht$1@sshuraaa-i-1.production.compuserve.com>
Whats the best option for storing, say, 500 to 1000 customer records (name,
email, phone number, address etc.).
* DBM -- quicker. But what if it gets corrupted or you want to change the
data ? Can you do fixes easily like with text files (say add international
code in front of all phone numbers?
* Text files -- slower. How many records before people would go for DBM?
TIA
Bruce
------------------------------
Date: Tue, 24 Oct 2000 16:50:19 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Don't use -w in CGI?
Message-Id: <brian-ya02408000R2410001650190001@news.panix.com>
In article <m3g0lmjj8c.fsf@solo.david-steuber.com>, David Steuber <nospam@david-steuber.com> posted:
> brian@smithrenaud.com (brian d foy) writes:
>
> ' error messages printed to the browser window can expose system details,
> ' which i consider a security issue. whether or not -w is the culprit
> ' is another matter.
> You may give out some system details that may be proprietary
> information, but the best lock of all is the one where you know all
> the details of its operation and still need the correct key to unlock
> it.
it doesn't even need to be proprietary or seemingly useful. it is
certainly more than the end user needs to know. let's remember that
the lock of which you speak does not exist in practice. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Tue, 24 Oct 2000 21:14:30 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: File Locking and CGI
Message-Id: <WYmJ5.9112$Wq1.5307382@nnrp5-w.sbc.net>
jeacocks@uk.ibm.com wrote:
>>Irrelevant. You don't mention where the program runs. Does it always
>>run on the same server?
>>If so, you can create a local lockfile not on AFS. Open/lock that file,
>>then if successful, open the AFS file and deal with it. When done,
>>close the AFS file and then release the local lock.
> That would work fine if I only required that the lock be maintained while
> the current process was running. Unfortunatly the CGI program locks the
> file, then sends some data to the user, then exits. It then starts again
> as a new process when the user sumbits the form, it should then write out
> the new data and unlock the file. All locks created by flock() get
> destroyed when a process ends this is not what I need.
Ooog. Don't do that. What if you lock the file and the user never
submits the form. What if the computer crashes and they forget what
they're doing? What if they die? You've just prohibited any changes
until an admin goes in and decides to clean out the lock.
You need to lock on a much smaller/shorter/faster granularity.
Have the first process lock the file, get the info, unlock the file.
Then, when the from comes back, lock the file, update the info, unlock
the file.
You don't need persistant locks because you don't want persistant locks.
Yes, there are problems with this scheme (what if a user reposts a
cached page?) but these are the same problems with building any
database.
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< Please move on, ...nothing to see here, please disperse >
------------------------------
Date: Tue, 24 Oct 2000 19:25:04 +0100
From: "Brian Canning" <bcanning@netresults-media.co.uk>
Subject: force dowload
Message-Id: <8t4kk8$6b3$1@newsg4.svr.pol.co.uk>
I have written a small script that generates various pages with links on
them
one of the link is to a PDF file. How can I get it to force a download
instead
of using the Acrobat reader i.e. a download windows pops up and it
doesn't use the plug-in reader inside the window?
Brian
------------------------------
Date: Tue, 24 Oct 2000 14:02:29 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: force dowload
Message-Id: <39F5DCC5.98CF9249@mail.uca.edu>
Brian Canning wrote:
>
> I have written a small script that generates various pages with links on
> them
> one of the link is to a PDF file. How can I get it to force a download
> instead
> of using the Acrobat reader i.e. a download windows pops up and it
> doesn't use the plug-in reader inside the window?
>
> Brian
You could make the file available only to people who do not have Acrobat
reader installed on their system. ;)
Otherwise, if you want to send a PDF file, the receiver can do whatever
s/he wants to with it automatically. Some may suggest changing the
Content-type line of the link to something else (i.e., octet-stream) but
browsers (especially IE) will ignore that if they want to.
Just because you generate the page with Perl (I assume that is why you
are asking an HTML question in this group), it doesn't mean that it's
any different after it leaves your server than a static page.
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Tue, 24 Oct 2000 18:59:09 GMT
From: jb4mt@my-deja.com
Subject: Re: force dowload
Message-Id: <8t4m5o$k7u$1@nnrp1.deja.com>
"Brian Canning" <bcanning@netresults-media.co.uk> wrote:
> I have written a small script that generates various pages with links
on
> them
> one of the link is to a PDF file. How can I get it to force a download
> instead
> of using the Acrobat reader i.e. a download windows pops up and it
> doesn't use the plug-in reader inside the window?
You would do this by issuing the appropriate HTTP headers. I have done
this with PHP but not Perl. The following PHP code works, and perhaps
someone more expert with Perl in this group can modify it to work in
Perl; I'm guessing it won't be too hard.
<?php
$downloadFile = $HTTP_GET_VARS["thisFile"];
$fileName = basename($downloadFile);
header("Content-type: application-download");
header("Content-Disposition: attachment; filename=\"$fileName\"");
$fn=fopen($downloadFile,"r");
fpassthru($fn);
?>
HTH
George
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 24 Oct 2000 20:02:18 GMT
From: hsriniv@my-deja.com
Subject: Help!!!
Message-Id: <8t4ps5$nhb$1@nnrp1.deja.com>
Hi Everybody,
I have a problem with this perl file and I thank you guys in advance
for your help.
Any kind of help is appreciated.
This is the perl script I wrote and it is not executing for the last
part of the script. Could you guys tell me whats the problem there???
format MODULE_NAME =
.
$MODULE_MATCH = "Structdef name:"; #This is the module name
### This is the output file handler and the output file......
open (output_file, ">temp1.v") || die "can't create output file";
### This is the input file handler and the input file........
open (input_file, "CORE_1020.v" ) || die "can't find input file";
select (output_file);
$~ = "MODULE_NAME";
write;
$line_read = <input_file>;
print "$line_read";
while (!eof(input_file))
{
$line_read = <input_file>;
print "$line_read";
if ( $line_read =~ /^endmodule/)
{
goto GET_MODULE_NAME;
}
}
GET_MODULE_NAME:close (output_file);
close (input_file);
open (output_file, ">t1.v") || die "can't create output file";
open (input_file, "almacor_1020.v" ) || die "can't find input file";
$line_read = <input_file>;
$print_first =0;
while (!($line_read =~ /^endmodule/))
{
$line_read = <input_file>;
}
$line_read = <input_file>;
while (!eof(input_file))
{
START_READING: if ($line_read =~ /^module/)
{
print "$line_read";
@words = split(/ /, $line_read);
foreach $words (@words)
{
push (@bigword, $words);
$wordcount +=1;
}
for ($i =0; $i<$wordcount; $i++)
{
$words[$i] = pop(@bigword);
}
@words = reverse(@words);
$file_name = $words[1];
READ_NEXT_LINE: $line_read = <input_file>;
if (($line_read =~ /^inout/) &&
($print_first =~ 0) )
{
print " //PRINT WIRE
HERE \n";
$print_first =1;
}
if ($line_read =~ /^wire/)
{
close (output_file);
goto GET_WIRE;
}
else
{
print "$line_read";
goto READ_NEXT_LINE;
}
GET_WIRE : open (output_file, ">t2.v")
|| die "can't create output file";
READ_GET_WIRE: print "$line_read";
$line_read = <input_file>;
if ($line_read =~ /^endmodule/)
{
goto APPEND_FILE;
}
else
{
goto READ_GET_WIRE;
}
APPEND_FILE : close (output_file);
######## LAST PART ADDED... Works fine before this but doesn't work
########when I add this one?
open (input_file1, "t1.v") || die "can't create output
file";
open (input_file2, "t2.v") || die "can't create output
file";
open (output_file, ">ha.v") || die "can't create output
file";
$line_read1 = <input_file1>;
while (!($line_read1 =~ /PRINT WIRE HERE/))
{
print "$line_read1";
$line_read1 = <input_file1>;
}
$line_read2 = <input_file2>;
while (! eof(input_file2))
{
print "$line_read2";
$line_read2 = <input_file2>;
}
while (! eof(input_file1))
{
print "$line_read1";
$line_read1 = <input_file1>;
}
close(input_file1);
close(input_file2);
close(output_file);
print \n endmodule \n";
#### END OF LAST PART OF THE SCRIPT>>>>>
}
else
{
$line_read = <input_file>;
}
}
The input_file looks like this..... (CORE_1020.v)
module ALMACOR ();
// This is the module name of the file
wire CK125E;
wire ROUT_15;
wire ROUTD_15;
wire ROUTDB_15;
wire RESETOUT;
wire SETOUT;
wire ROUT_14;
wire ROUTD_14;
wire ROUTDB_14;
wire ROUT_13;
wire ROUTD_13;
wire ROUTDB_13;
wire ROUT_12;
wire ROUTD_12;
wire ROUTDB_12;
wire ROUT_11;
wire ROUTD_11;
wire ROUTDB_11;
wire ROUT_10;
wire ROUTD_10;
wire ROUTDB_10;
wire ROUT_9;
wire ROUTD_9;
wire ROUTDB_9;
wire ROUT_8;
wire ROUTD_8;
wire ROUTDB_8;
wire ROUT_7;
wire ROUTD_7;
wire ROUTDB_7;
wire ROUT_6;
wire ROUTD_6;
wire ROUTDB_6;
wire ROUT_5;
wire ROUTD_5;
wire ROUTDB_5;
wire ROUT_4;
wire ROUTD_4;
wire ROUTDB_4;
wire ROUT_3;
wire ROUTD_3;
wire ROUTDB_3;
wire ROUT_2;
wire ROUTD_2;
wire ROUTDB_2;
wire ROUT_1;
wire ROUTD_1;
wire ROUTDB_1;
wire ROUT_0;
wire ROUTD_0;
wire ROUTDB_0;
wire AUXEN;
wire BLANKP;
wire BLANKPDLY;
wire CKPGM;
wire CKPINEN;
wire CTRAUXEN;
wire CTRLEN;
wire CTRMAINEN;
wire CTRREN;
wire DCTR_0;
wire DCTR_10;
wire DCTR_11;
wire DCTR_12;
wire DCTR_13;
wire DCTR_14;
wire DCTR_15;
wire DCTR_1;
wire DCTR_2;
wire DCTR_3;
wire DCTR_4;
wire DCTR_5;
wire DCTR_6;
wire DCTR_7;
wire DCTR_8;
wire DCTR_9;
wire DMDLY_0;
wire DMDLY_10;
wire DMDLY_11;
wire DMDLY_12;
wire DMDLY_13;
wire DMDLY_14;
wire DMDLY_15;
wire DMDLY_1;
wire DMDLY_2;
wire DMDLY_3;
wire DMDLY_4;
wire DMDLY_5;
wire DMDLY_6;
wire DMDLY_7;
wire DMDLY_8;
wire DMDLY_9;
wire DNXT15_0;
wire DNXT15_1;
wire DPREV0_0;
wire DPREV0_1;
wire DUMPENP;
wire LTOR;
wire PGMDATA;
wire PGMOUT;
wire PGMSTB;
wire RDCLKENP;
wire SELDLY_0;
wire SELDLY_1;
wire SELDLY_2;
wire SELDLY_3;
wire SELDLY_4;
wire SELP_0;
wire SELP_1;
wire SELP_2;
wire SELP_3;
wire SELP_4;
wire SELP_5;
wire HIZB;
wire PGMOUTPIN;
wire CKPGMOPIN;
wire PGMSTOPIN;
wire ROUTEN2;
wire OUTPIN_15;
wire OUTPIN_14;
wire OUTPIN_13;
wire OUTPIN_12;
wire OUTPIN_11;
wire OUTPIN_10;
wire OUTPIN_9;
wire OUTPIN_8;
wire OUTPIN_7;
wire OUTPIN_6;
wire OUTPIN_5;
wire OUTPIN_4;
wire OUTPIN_3;
wire OUTPIN_2;
wire OUTPIN_1;
wire OUTPIN_0;
wire CK125OUT;
wire C125OUTPIN;
wire DIV8;
wire RINGOSCPIN;
wire DNXTD_1;
wire NXTPIN_1;
wire DNXTD_0;
wire NXTPIN_0;
wire DMD_15;
wire DTLPIN_15;
wire DMD_14;
wire DTLPIN_14;
wire DMD_13;
wire DTLPIN_13;
wire DMD_12;
wire DTLPIN_12;
wire DMD_11;
wire DTLPIN_11;
wire DMD_10;
wire DTLPIN_10;
wire DMD_9;
wire DTLPIN_9;
wire DMD_8;
wire DTLPIN_8;
wire DMD_7;
wire DTLPIN_7;
wire DMD_6;
wire DTLPIN_6;
wire DMD_5;
wire DTLPIN_5;
wire DMD_4;
wire DTLPIN_4;
wire DMD_3;
wire DTLPIN_3;
wire DMD_2;
wire DTLPIN_2;
wire DMD_1;
wire DTLPIN_1;
wire DMD_0;
wire DTLPIN_0;
wire BLANKD;
wire BLANKOUTPIN;
wire DUMPEND;
wire DUMPOUTPIN;
wire DAD_15;
wire AUXOE;
wire DTRPIN_15;
wire DAD_14;
wire DTRPIN_14;
wire DAD_13;
wire DTRPIN_13;
wire DAD_12;
wire DTRPIN_12;
wire DAD_11;
wire DTRPIN_11;
wire DAD_10;
wire DTRPIN_10;
wire DAD_9;
wire DTRPIN_9;
wire DAD_8;
wire DTRPIN_8;
wire DAD_7;
wire DTRPIN_7;
wire DAD_6;
wire DTRPIN_6;
wire DAD_5;
wire DTRPIN_5;
wire DAD_4;
wire DTRPIN_4;
wire DAD_3;
wire DTRPIN_3;
wire DAD_2;
wire DTRPIN_2;
wire DAD_1;
wire DTRPIN_1;
wire DAD_0;
wire DTRPIN_0;
wire LTOPIN;
wire ROE;
wire PGMSTIPIN;
wire CKPGMPIN;
wire PGMDATAPIN;
wire LTIB;
wire LOE;
wire LTIP;
wire LTIPIN;
wire DR_15;
wire DRPIN_15;
wire DCTRRE_15;
wire DR_14;
wire DRPIN_14;
wire DCTRRE_14;
wire DR_13;
wire DRPIN_13;
wire DCTRRE_13;
wire DR_12;
wire DRPIN_12;
wire DCTRRE_12;
wire DR_11;
wire DRPIN_11;
wire DCTRRE_11;
wire DR_10;
wire DRPIN_10;
wire DCTRRE_10;
wire DR_9;
wire DRPIN_9;
wire DCTRRE_9;
wire DR_8;
wire DRPIN_8;
wire DCTRRE_8;
wire DR_7;
wire DRPIN_7;
wire DCTRRE_7;
wire DR_6;
wire DRPIN_6;
wire DCTRRE_6;
wire DR_5;
wire DRPIN_5;
wire DCTRRE_5;
wire DR_4;
wire DRPIN_4;
wire DCTRRE_4;
wire DR_3;
wire DRPIN_3;
wire DCTRRE_3;
wire DR_2;
wire DRPIN_2;
wire DCTRRE_2;
wire DR_1;
wire DRPIN_1;
wire DCTRRE_1;
wire DR_0;
wire DRPIN_0;
wire DCTRRE_0;
wire DL_15;
wire DLPIN_15;
wire DCTRLE_15;
wire DL_14;
wire DLPIN_14;
wire DCTRLE_14;
wire DL_13;
wire DLPIN_13;
wire DCTRLE_13;
wire DL_12;
wire DLPIN_12;
wire DCTRLE_12;
wire DL_11;
wire DLPIN_11;
wire DCTRLE_11;
wire DL_10;
wire DLPIN_10;
wire DCTRLE_10;
wire DL_9;
wire DLPIN_9;
wire DCTRLE_9;
wire DL_8;
wire DLPIN_8;
wire DCTRLE_8;
wire DL_7;
wire DLPIN_7;
wire DCTRLE_7;
wire DL_6;
wire DLPIN_6;
wire DCTRLE_6;
wire DL_5;
wire DLPIN_5;
wire DCTRLE_5;
wire DL_4;
wire DLPIN_4;
wire DCTRLE_4;
wire DL_3;
wire DLPIN_3;
wire DCTRLE_3;
wire DL_2;
wire DLPIN_2;
wire DCTRLE_2;
wire DL_1;
wire DLPIN_1;
wire DCTRLE_1;
wire DL_0;
wire DLPIN_0;
wire DCTRLE_0;
wire HIZ;
wire HIZBUN;
wire HIZPIN;
wire DBRPIN_15;
wire DAE_15;
wire DBRPIN_14;
wire DAE_14;
wire DBRPIN_13;
wire DAE_13;
wire DBRPIN_12;
wire DAE_12;
wire DBRPIN_11;
wire DAE_11;
wire DBRPIN_10;
wire DAE_10;
wire DBRPIN_9;
wire DAE_9;
wire DBRPIN_8;
wire DAE_8;
wire DBRPIN_7;
wire DAE_7;
wire DBRPIN_6;
wire DAE_6;
wire DBRPIN_5;
wire DAE_5;
wire DBRPIN_4;
wire DAE_4;
wire DBRPIN_3;
wire DAE_3;
wire DBRPIN_2;
wire DAE_2;
wire DBRPIN_1;
wire DAE_1;
wire DBRPIN_0;
wire DAE_0;
wire ROUTEN2B;
wire ROUTEN2UN;
wire YOEBP;
wire XOEBP;
wire BLANKPIN;
wire BLANKE;
wire DUMPENPIN;
wire DUMPENE;
wire XOEBPIN;
wire YOEBPIN;
wire PREVPIN_1;
wire DPREVE_1;
wire PREVPIN_0;
wire DPREVE_0;
wire SELPIN_5;
wire SELE_5;
wire SELPIN_4;
wire SELE_4;
wire SELPIN_3;
wire SELE_3;
wire SELPIN_2;
wire SELE_2;
wire SELPIN_1;
wire SELE_1;
wire SELPIN_0;
wire SELE_0;
wire RDCLKENPIN;
wire RDCLKENE;
wire CKPIN;
wire DBLPIN_15;
wire DME_15;
wire DBLPIN_14;
wire DME_14;
wire DBLPIN_13;
wire DME_13;
wire DBLPIN_12;
wire DME_12;
wire DBLPIN_11;
wire DME_11;
wire DBLPIN_10;
wire DME_10;
wire DBLPIN_9;
wire DME_9;
wire DBLPIN_8;
wire DME_8;
wire DBLPIN_7;
wire DME_7;
wire DBLPIN_6;
wire DME_6;
wire DBLPIN_5;
wire DME_5;
wire DBLPIN_4;
wire DME_4;
wire DBLPIN_3;
wire DME_3;
wire DBLPIN_2;
wire DME_2;
wire DBLPIN_1;
wire DME_1;
wire DBLPIN_0;
wire DME_0;
wire DM_15;
wire DMP_15;
wire DM_14;
wire DMP_14;
wire DM_13;
wire DMP_13;
wire DM_12;
wire DMP_12;
wire DM_11;
wire DMP_11;
wire DM_10;
wire DMP_10;
wire DM_9;
wire DMP_9;
wire DM_8;
wire DMP_8;
wire DM_7;
wire DMP_7;
wire DM_6;
wire DMP_6;
wire DM_5;
wire DMP_5;
wire DM_4;
wire DMP_4;
wire DM_3;
wire DMP_3;
wire DM_2;
wire DMP_2;
wire DM_1;
wire DMP_1;
wire DM_0;
wire DMP_0;
wire BLANKPUN;
wire DCTRL_15;
wire DCTRL_14;
wire DCTRL_13;
wire DCTRL_12;
wire DCTRL_11;
wire DCTRL_10;
wire DCTRL_9;
wire DCTRL_8;
wire DCTRL_7;
wire DCTRL_6;
wire DCTRL_5;
wire DCTRL_4;
wire DCTRL_3;
wire DCTRL_2;
wire DCTRL_1;
wire DCTRL_0;
wire DCTRR_15;
wire DCTRR_14;
wire DCTRR_13;
wire DCTRR_12;
wire DCTRR_11;
wire DCTRR_10;
wire DCTRR_9;
wire DCTRR_8;
wire DCTRR_7;
wire DCTRR_6;
wire DCTRR_5;
wire DCTRR_4;
wire DCTRR_3;
wire DCTRR_2;
wire DCTRR_1;
wire DCTRR_0;
wire DA_15;
wire DA_14;
wire DA_13;
wire DA_12;
wire DA_11;
wire DA_10;
wire DA_9;
wire DA_8;
wire DA_7;
wire DA_6;
wire DA_5;
wire DA_4;
wire DA_3;
wire DA_2;
wire DA_1;
wire DA_0;
wire SELUN_1;
wire SELUN_0;
DFFSRX2 UROUTD_15 ( .CK( CK125E), .D( ROUT_15), .Q( ROUTD_15), .QN(
ROUTDB_15), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_14 ( .CK( CK125E), .D( ROUT_14), .Q( ROUTD_14), .QN(
ROUTDB_14), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_13 ( .CK( CK125E), .D( ROUT_13), .Q( ROUTD_13), .QN(
ROUTDB_13), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_12 ( .CK( CK125E), .D( ROUT_12), .Q( ROUTD_12), .QN(
ROUTDB_12), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_11 ( .CK( CK125E), .D( ROUT_11), .Q( ROUTD_11), .QN(
ROUTDB_11), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_10 ( .CK( CK125E), .D( ROUT_10), .Q( ROUTD_10), .QN(
ROUTDB_10), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_9 ( .CK( CK125E), .D( ROUT_9), .Q( ROUTD_9), .QN(
ROUTDB_9), .RN( RESETOUT), .SN
( SETOUT) );
DFFSRX2 UROUTD_8 ( .CK( CK125E), .D( ROUT_8), .Q( ROUTD_8), .QN(
ROUTDB_8), .RN( RESETOUT), .SN
( SETOUT) );
endmodule
// PRINT MODULE NAME //
module OUTCK ( CK125E, D, Q );
inout CK125E ;
inout D ;
inout Q ;
BUFX12 P4 ( .A( QUNBUF), .Y
( Q) );
DFFX4 UFF ( .CK( CK125E), .D( D), .Q( QUNBUF), .QN
( QUNBUFN) );
wire QUNBUF;
wire Q;
wire CK125E;
wire D;
wire QUNBUFN;
endmodule
Thanks again.
Hari.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4713
**************************************