[32157] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3422 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 22 21:09:25 2011

Date: Wed, 22 Jun 2011 18:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 22 Jun 2011     Volume: 11 Number: 3422

Today's topics:
    Re: [RegEx] Optional parameter <tzz@lifelogs.com>
        Extracting text from a webpage <mittra@juno.com>
    Re: Extracting text from a webpage <jurgenex@hotmail.com>
    Re: Extracting text from a webpage <tadmc@seesig.invalid>
    Re: Extracting text from a webpage <bugbear@trim_papermule.co.uk_trim>
    Re: Extracting text from a webpage <mittra@juno.com>
    Re: Extracting text from a webpage <ralph@happydays.com>
    Re: Extracting text from a webpage <tadmc@seesig.invalid>
    Re: Extracting text from a webpage <maus@hmaus.org>
        getting email addresses from email headers? <tch@nospam.wpkg.org>
    Re: getting email addresses from email headers? (Randal L. Schwartz)
    Re: Perl definition of newline? <kst-u@mib.org>
    Re: Perl definition of newline? <kst-u@mib.org>
    Re: Perl definition of newline? <uri@StemSystems.com>
    Re: Perl definition of newline? sln@netherlands.com
    Re: Problems with Parse::Lex <no@email.here.invalid>
    Re: reading a binary file <ronaldf@expires-30-06-2011.news-group.org>
    Re: reading a binary file sln@netherlands.com
    Re: upload file rom solaris to debian using perl base i <gavcomedy@gmail.com>
    Re: upload file rom solaris to debian using perl base i <tzz@lifelogs.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 22 Jun 2011 10:39:05 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: [RegEx] Optional parameter
Message-Id: <87hb7hkh9i.fsf@lifelogs.com>

On Tue, 21 Jun 2011 14:06:43 +0100 Rainer Weikusat <rweikusat@mssgmbh.com> wrote: 

RW> Ted Zlatanov <tzz@lifelogs.com> writes:
>> On Mon, 20 Jun 2011 14:31:45 +0100 Rainer Weikusat <rweikusat@mssgmbh.com> wrote: 
RW> Ted Zlatanov <tzz@lifelogs.com> writes:
>>>> I'd rather use warnings religiously than suffer in maintenance hell.
>>>> You may feel differently, but debugging code without warnings
>>>> (especially when all you have are the log files) is a nightmare.  Simple
>>>> typos can turn into multi-hour hunts,
>> 
RW> Can you provide an example of a 'simple typo' perl cannot detect at
RW> compile time but does detect at runtime?
>> 
>> % perl -w -e '$h{myentry} = 1; print $h{myenty};'
>> Use of uninitialized value in print at -e line 1.

RW> That's not quite an example of 'a simple typo' but another attempt at
RW> inventing a contrived example demonstrating the Very High
RW> Usefulness Of Not Knowing What An Uninitialized Value Happens To
RW> Be[tm] (namely, the 'indeterminate' and - in practice - more or less
RW> random value a non-initialized object with 'automatic storage
RW> duration' happens to have in C).

I accept your apology.  Gesundheit.

RW> How have you managed to escape the maintenance hell of Perl not being
RW> able to detect simply typos like this:

RW> 	$c = $a - $b	# should have been +

RW> or

RW> 	$c = $a - $b	# should have been $b - $a

RW> ?

Those are not typos.  Then again, this is not a discussion.

RW> NB: I'm genuinely interested in something useful 'Perl runtime
RW> warnings' provide. But I've already ruled out 'Oh my GAWD it is
RW> UNDEF !!!1!!!'. That's not useful to me. YMMV.

I don't think you're genuinely interested in anything but your own ideas.

Ted


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

Date: Tue, 21 Jun 2011 18:30:58 -0700 (PDT)
From: q-rious <mittra@juno.com>
Subject: Extracting text from a webpage
Message-Id: <dfe6d2c1-3b3b-4dab-bdd3-8636ab860296@z7g2000prh.googlegroups.com>

Hello All,

This must be an easy question for many of you. Given its URL, I would
like to extract the text from a webpage **after the server and client
side updates are done**.

Can LWP::Simple be used for this?

Thanks.


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

Date: Tue, 21 Jun 2011 20:05:17 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Extracting text from a webpage
Message-Id: <knm2079unh83vnqthsvdu13irqs3t8e2da@4ax.com>

q-rious <mittra@juno.com> wrote:
>This must be an easy question for many of you. Given its URL, I would
>like to extract the text from a webpage **after the server and client
>side updates are done**.

Please explain what you mean by "server and client side updates".

>Can LWP::Simple be used for this?

Yes and no. You can certainly use LWP::Simple to retrieve the web page.
However to extract the text from the HTTP response you will have to use
other means depending upon what kind of "page" this is.

For HTML-pages you may want to consult the FAQ: 
	"How do I remove HTML from a string?"

For other page formats you will have to check for parsers for those
formats.

jue


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

Date: Tue, 21 Jun 2011 22:11:03 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Extracting text from a webpage
Message-Id: <slrnj02mti.5kf.tadmc@tadbox.sbcglobal.net>

q-rious <mittra@juno.com> wrote:


> This must be an easy question for many of you. 


This is an impossible to answer question, as stated.


> Given its URL, I would
> like to extract the text from a webpage **after the server and client
> side updates are done**.


What do you mean by "client side" updates?

When you use Perl to issue an HTTP request, *your program* is the
client...


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Wed, 22 Jun 2011 09:26:04 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Extracting text from a webpage
Message-Id: <A-Odnf-a3p2BOpzTnZ2dnUVZ8rudnZ2d@brightview.co.uk>

q-rious wrote:
> Hello All,
>
> This must be an easy question for many of you. Given its URL, I would
> like to extract the text from a webpage **after the server and client
> side updates are done**.
>
> Can LWP::Simple be used for this?

On the assumption by "client side updates" you mean
at least Javascript, and possibly Ajax with DOM updates, the answer is no.

  BugBear


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

Date: Wed, 22 Jun 2011 06:05:15 -0700 (PDT)
From: q-rious <mittra@juno.com>
Subject: Re: Extracting text from a webpage
Message-Id: <a754d430-f846-4353-8dca-8507478bbc0d@17g2000prr.googlegroups.com>

On Jun 22, 1:26=A0am, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> q-rious wrote:
> > Hello All,
>
> > This must be an easy question for many of you. Given its URL, I would
> > like to extract the text from a webpage **after the server and client
> > side updates are done**.
>
> > Can LWP::Simple be used for this?
>
> On the assumption by "client side updates" you mean
> at least Javascript, and possibly Ajax with DOM updates, the answer is no=
 .
>
> =A0 BugBear

BugBear,

Thanks. That's exactly what I meant by client side updates -
javascript and Ajax w/ DOM updates. Just to clarify, are you saying
this can not be done using LWP::Simple or this can not be done at
all?

Thanks again.


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

Date: Wed, 22 Jun 2011 11:32:17 -0400
From: Ralph Malph <ralph@happydays.com>
Subject: Re: Extracting text from a webpage
Message-Id: <bc89c$4e020b04$ce534406$3718@news.eurofeeds.com>

The problem is that LWP doesn't have a way to interpret the JavaScript.
There are ways to do this in Perl, however.
To do this in perl you have a few options:
     -http://cpan.uwinnipeg.ca/htdocs/WWW-Scripter/WWW/Scripter.html
 
-http://cpan.uwinnipeg.ca/htdocs/WWW-Mechanize-Firefox/WWW/Mechanize/Firefox.html
 
-http://cpan.uwinnipeg.ca/htdocs/Win32-IE-Mechanize/Win32/IE/Mechanize.html
WWW::Scripter is cool but kind of slow and buggy. I personally have had 
mixed results.
The other two modules wrap an actual browser so are dependent on having 
either FF or IE installed. If you don't mind that dependency they will 
probably work best.

On 6/22/2011 9:05 AM, q-rious wrote:
> On Jun 22, 1:26 am, bugbear<bugbear@trim_papermule.co.uk_trim>  wrote:
>> q-rious wrote:
>>> Hello All,
>>
>>> This must be an easy question for many of you. Given its URL, I would
>>> like to extract the text from a webpage **after the server and client
>>> side updates are done**.
>>
>>> Can LWP::Simple be used for this?
>>
>> On the assumption by "client side updates" you mean
>> at least Javascript, and possibly Ajax with DOM updates, the answer is no.
>>
>>    BugBear
>
> BugBear,
>
> Thanks. That's exactly what I meant by client side updates -
> javascript and Ajax w/ DOM updates. Just to clarify, are you saying
> this can not be done using LWP::Simple or this can not be done at
> all?




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

Date: Wed, 22 Jun 2011 14:29:17 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Extracting text from a webpage
Message-Id: <slrnj04g7n.86m.tadmc@tadbox.sbcglobal.net>

q-rious <mittra@juno.com> wrote:
> On Jun 22, 1:26 am, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
>> q-rious wrote:
>> > Hello All,
>>
>> > This must be an easy question for many of you. Given its URL, I would
>> > like to extract the text from a webpage **after the server and client
>> > side updates are done**.
>>
>> > Can LWP::Simple be used for this?
>>
>> On the assumption by "client side updates" you mean
>> at least Javascript, and possibly Ajax with DOM updates, the answer is no.
>>
>>   BugBear
>
> BugBear,
>
> Thanks. That's exactly what I meant by client side updates -
> javascript and Ajax w/ DOM updates. Just to clarify, are you saying
> this can not be done using LWP::Simple 


AFAIK, it cannot be done with Perl.

Hopefully someone can jump in here if I've missed a way...


> or this can not be done at
> all?


It can be done with what is called a "headless browser".


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: 22 Jun 2011 21:25:29 GMT
From: greymaus <maus@hmaus.org>
Subject: Re: Extracting text from a webpage
Message-Id: <slrnj04nfi.cbe.maus@hmaus.org>

On 2011-06-22, Tad McClellan <tadmc@seesig.invalid> wrote:
> q-rious <mittra@juno.com> wrote:
>> On Jun 22, 1:26 am, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
>>> q-rious wrote:
>>> > Hello All,
>>>
>>> > This must be an easy question for many of you. Given its URL, I would
>>> > like to extract the text from a webpage **after the server and client
>>> > side updates are done**.
>>>
>>> > Can LWP::Simple be used for this?
>>>
>>> On the assumption by "client side updates" you mean
>>> at least Javascript, and possibly Ajax with DOM updates, the answer is no.
>>>
>>>   BugBear
>>
>> BugBear,
>>
>> Thanks. That's exactly what I meant by client side updates -
>> javascript and Ajax w/ DOM updates. Just to clarify, are you saying
>> this can not be done using LWP::Simple 
>
>
> AFAIK, it cannot be done with Perl.
>
> Hopefully someone can jump in here if I've missed a way...
>
>
>> or this can not be done at
>> all?
>
>
> It can be done with what is called a "headless browser".
>
>

starting, 
$page=`lynx -dump`;
then extract the info you need by the usual Perl functions

or HTML::Parse;
   HTML::FormatText;

-- 
greymaus
 .
  .
 ...   NO CARRIER


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

Date: Wed, 22 Jun 2011 23:04:08 +0200
From: Tomasz Chmielewski <tch@nospam.wpkg.org>
Subject: getting email addresses from email headers?
Message-Id: <96f3m8F49jU1@mid.uni-berlin.de>

Is there a Perl module which would retrieve email addresses from email 
headers?

The format typically looks like:

To: Tomasz Chmielewski <tch@example.com>, 2nd user <blah@example.com>
CC: Tomasz Chmielewski <tch@example.com>,
  Tomasz Chmielewski <mangoo@example.com>,
  1@example.com, 2@example.com, 3@example.com


I could write a simple parser for that... but perhaps there is a 
(RFC-compliant) parser already?



-- 
Tomasz Chmielewski
http://wpkg.org


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

Date: Wed, 22 Jun 2011 16:32:23 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: getting email addresses from email headers?
Message-Id: <86d3i5qw6w.fsf@red.stonehenge.com>

>>>>> "Tomasz" == Tomasz Chmielewski <tch@nospam.wpkg.org> writes:

Tomasz> Is there a Perl module which would retrieve email addresses from email
Tomasz> headers?

[...]

Tomasz> I could write a simple parser for that... but perhaps there is a
Tomasz> (RFC-compliant) parser already?

Plenty.  I reach for MailTools for most things (in the CPAN).

http://search.cpan.org/~markov/MailTools-2.08/ for a recent version.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


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

Date: Wed, 22 Jun 2011 12:09:09 -0700
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Perl definition of newline?
Message-Id: <lnsjr1heei.fsf@nuthaus.mib.org>

Rainer Weikusat <rweikusat@mssgmbh.com> writes:
> rop rop <rop049@gmail.com> writes:
>> For portability reasons, I would just like to know what is the exact
>> definition of "\n" in perl?
>>
>> It says in Perl documentation that it is the "newline" character.
>
> This is the exact definition. As soon as things go beyond Perl, what
> exactly constitutes 'a text file' depends on the platform. The three
> conventions I'm aware of are
>
> 	- lines separated by ASCII NL (0xa), UNIX(*), Linux
>         - lines separated by ASCII CR (0xd), MAC
>         - lines separated by ASCII CR + ASCII NL WinDOS
>
> But that's supposed to be handled transparently by the responsible I/O
> code, meaning, whatever the platform happens to use becomes \n inside
> Perl and a Perl \n becomes whatever the platform happens to use as
> soon as it moves outside of Perl.

The ASCII name for character 0xa is actually LF (line feed), not NL;
Unicode also calls it that.

I wouldn't say that "\n" *becomes* a platform-specific character
sequence; rather, the result of printing a string containing a
"\n" character (assuming the file is in text mode) is that some
platform-specific sequence is sent to the file (whatever a "file"
is).

The "\n" syntax is used in string literals.  In a string literal,
"\n" is a specific character.  That character is LF on all
implementations of Perl that I've ever seen.  (Are there any Perl
implementations that use EBCDIC?)

(In C, the value of '\n' is system-specific; it usually LF, but
a conforming C compiler could use something else, as long it's
translated properly when written to a text stream.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


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

Date: Wed, 22 Jun 2011 12:14:52 -0700
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Perl definition of newline?
Message-Id: <lnoc1phe4z.fsf@nuthaus.mib.org>

Keith Thompson <kst-u@mib.org> writes:
> Rainer Weikusat <rweikusat@mssgmbh.com> writes:
>> rop rop <rop049@gmail.com> writes:
>>> For portability reasons, I would just like to know what is the exact
>>> definition of "\n" in perl?
>>>
>>> It says in Perl documentation that it is the "newline" character.
>>
>> This is the exact definition. As soon as things go beyond Perl, what
>> exactly constitutes 'a text file' depends on the platform. The three
>> conventions I'm aware of are
>>
>> 	- lines separated by ASCII NL (0xa), UNIX(*), Linux
>>         - lines separated by ASCII CR (0xd), MAC
>>         - lines separated by ASCII CR + ASCII NL WinDOS
>>
>> But that's supposed to be handled transparently by the responsible I/O
>> code, meaning, whatever the platform happens to use becomes \n inside
>> Perl and a Perl \n becomes whatever the platform happens to use as
>> soon as it moves outside of Perl.
>
> The ASCII name for character 0xa is actually LF (line feed), not NL;
> Unicode also calls it that.
>
> I wouldn't say that "\n" *becomes* a platform-specific character
> sequence; rather, the result of printing a string containing a
> "\n" character (assuming the file is in text mode) is that some
> platform-specific sequence is sent to the file (whatever a "file"
> is).
>
> The "\n" syntax is used in string literals.  In a string literal,
> "\n" is a specific character.  That character is LF on all
> implementations of Perl that I've ever seen.  (Are there any Perl
> implementations that use EBCDIC?)
>
> (In C, the value of '\n' is system-specific; it usually LF, but
> a conforming C compiler could use something else, as long it's
> translated properly when written to a text stream.)

I should have read the entire thread before responding.  Tad McClellan's
followup is far more detailed than mine.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


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

Date: Wed, 22 Jun 2011 16:21:11 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Perl definition of newline?
Message-Id: <87boxpfwi0.fsf@quad.sysarch.com>

>>>>> "KT" == Keith Thompson <kst-u@mib.org> writes:

  KT> The "\n" syntax is used in string literals.  In a string literal,
  KT> "\n" is a specific character.  That character is LF on all
  KT> implementations of Perl that I've ever seen.  (Are there any Perl
  KT> implementations that use EBCDIC?)

from perldoc perl:

perlebcdic          Considerations for running Perl on EBCDIC platforms

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 22 Jun 2011 15:29:01 -0700
From: sln@netherlands.com
Subject: Re: Perl definition of newline?
Message-Id: <92r407tstni3lskb0ruu2jn73avcn1hv52@4ax.com>

On Tue, 21 Jun 2011 01:27:22 -0700 (PDT), rop rop <rop049@gmail.com> wrote:

>Hi,
>
>For portability reasons, I would just like to know what is the exact
>definition of "\n" in perl?
>
>It says in Perl documentation that it is the "newline" character.
>
>Does this mean it is always the ascii-code 0A (and nothing else) on
>all platforms and OS:es?
>Or could it ever be something other than that?
>
>I believe, in other languages, "\n" may for example expand to 0D+0A on
>windows-platform, but never in perl?

Well rop rop, you've heard all he response's.
Does it clear things up for you, or is it a NOP?

-sln


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

Date: Tue, 21 Jun 2011 15:55:34 +0000 (UTC)
From: Mladen Gogala <no@email.here.invalid>
Subject: Re: Problems with Parse::Lex
Message-Id: <pan.2011.06.21.15.55.33@email.here.invalid>

On Mon, 20 Jun 2011 13:27:54 +0100, Rainer Weikusat wrote:

> -----------------
> #!/usr/bin/env perl
> use Parse::Lex;
> 
> my @token = qw(
> 		BegParen [\(]
> 		EndParen [\)]
> 		Operator [+*/^-]
> 		Number   \d+(?:\.\d+)?
> 		EOL	 \n
> 	   );
> 
> my $lexer=Parse::Lex->new(@token);
> $lexer->from(\*STDIN);
> TOKEN:
> while(1) {
>     my $token=$lexer->next;
>     if(!$lexer->eoi) {
>         print $token->name." ".$token->text." \n";
>     } else { last TOKEN; }
> }


Rainer, thank you very much! It does work. I am ashamed to have missed 
the equal sign.


-- 
http://mgogala.byethost5.com


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

Date: Wed, 22 Jun 2011 11:57:23 +0200
From: Ronald Fischer <ronaldf@expires-30-06-2011.news-group.org>
Subject: Re: reading a binary file
Message-Id: <1308736643.12@ronaldf.newsoffice.de>

Rahul!! wrote as rahul_vasishta@yahoo.co.in on 21. Jun 2011:
> I am trying to store dll file uploaded by user to DB. But I am seeing
> issues, dll file is getting corrupted. The size of the file inserted
> is greater than original file. 

Is the size already larger in the memory image of the file ($fulldata), 
or does the problem really occur on inserting the file into the 
database? In the latter case, it might help either asking in a newsgroup 
dedicated to your database, or at least mention what database you are 
using.

Ronald


-- 
Ronald Fischer <ronaldf@eml.cc>
Posted via http://www.newsoffice.de/



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

Date: Wed, 22 Jun 2011 15:40:05 -0700
From: sln@netherlands.com
Subject: Re: reading a binary file
Message-Id: <8er4075v2okhi3vdpl0e8afonegilvs6fj@4ax.com>

On Tue, 21 Jun 2011 07:10:41 -0700 (PDT), "Rahul!!" <rahul_vasishta@yahoo.co.in> wrote:

>Hi all,
>
>I am trying to store dll file uploaded by user to DB. But I am seeing
>issues, dll file is getting corrupted. The size of the file inserted
>is greater than original file. Can some body help me here. Posting cgi-
>perl code snippet,
>
>//WEB PAGE CODE
><form method=post ENCTYPE="multipart/form-data">
><input type=hidden name=type value="application/octet-stream">
><b>Path to file:</b><br>
><input type=file name=data id=data size=60><br><br>
>
><b>Description</b>:<br>
><input name=description size=60><br><br>
><input type=submit value="Submit">
></form>
>
>#perl-cgi code,executed on Linux box
>#this gives me file handle
>my $daata=$cgi->upload('data');
>my $fulldata;
>
>#reading content of binary file
>read($daata, $fulldata, -s $daata );
>
>$dbh->do("insert into attachments"
>	    . " ( file_name,file_data)"
>            . " values"
>            . "(?,?)",undef, $file_name, $fulldata);
># . "(?,?)",undef, $file_name, $dbh->BLOB_TYPE($fulldata)); this also
>doesn't work
>
>But the dll is getting corrupted. The attachments.file_data field is
>of type longblob. Am I doing something wrong here? Is there any issue
>with the statement that reads content of the file?
>

Why don't you test this by writing to a local file instead of inserting
it into a database.

Are you absolutely sure your reading a binary file.
The database BLOB is an after thought.

Haven't you ever been so frustrated you would try anything to get
to the root problem?

Start chopping at the base, then work yourself up. Eventually,
when you find out where in the chain the problem is, a feeling
of satisfaction will boost your self-esteem.

When you have to work to solve a problem, its much more satisfying
when you do.

-sln


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

Date: Tue, 21 Jun 2011 20:05:07 -0700 (PDT)
From: gavino <gavcomedy@gmail.com>
Subject: Re: upload file rom solaris to debian using perl base install
Message-Id: <7e57a9cd-906e-404f-9f13-618c2c5e9d90@j14g2000prn.googlegroups.com>

On Jun 20, 10:24=A0am, Rainer Weikusat <rweiku...@mssgmbh.com> wrote:
> gavino <gavcom...@gmail.com> writes:
>
> [...]
>
> > it seems u need a cgi on box 2 to accept some kinda wget uplaod from
> > box1
>
> > by the way I am not allowed anything but base perl 5.10 with cgi.pm
> > and wget
>
> > no curl
>
> > on soalris 10 box1
>
> > have to upload files to webserver on debian box2
>
> Have you considered the ultra-simple solution, namely,
>
> --------------
> #!/usr/bin/perl
> #
>
> use Socket;
>
> {
> =A0 =A0 my ($conn_sk, $sk, $rc, $buf);
>
> =A0 =A0 $rc =3D socket($sk, AF_INET, SOCK_STREAM, 0);
> =A0 =A0 $rc || die('socket');
>
> =A0 =A0 $rc =3D bind($sk, pack_sockaddr_in(1234, inet_aton('0.0.0.0')));
> =A0 =A0 $rc || die('bind');
>
> =A0 =A0 $rc =3D listen($sk, 1);
> =A0 =A0 $rc || die('listen');
>
> =A0 =A0 $rc =3D accept($conn_sk, $sk);
> =A0 =A0 $rc || die('accept');
>
> =A0 =A0 print($buf) while (($rc =3D sysread($conn_sk, $buf, 8192)) > 0);
> =A0 =A0 $rc // die('sysread');}
>
> --------------
>
> This will bind a listening TCP socket to port 1234, accept a
> connection on that and print whatever data is sent accross the
> connected socket to stdout.

technically diamonds
but this is firewall environment
only port 80 open
and webserver waiting on port 80


What I need is post perl script and a perl cgi to recieve the post
into a file.

anyone know that?

the cgi.pm stuff earlier seems one half


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

Date: Wed, 22 Jun 2011 10:40:56 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: upload file rom solaris to debian using perl base install
Message-Id: <87d3i5kh6f.fsf@lifelogs.com>

On Tue, 21 Jun 2011 20:05:07 -0700 (PDT) gavino <gavcomedy@gmail.com> wrote: 

g> technically diamonds
g> but this is firewall environment
g> only port 80 open
g> and webserver waiting on port 80

g> What I need is post perl script and a perl cgi to recieve the post
g> into a file.

g> anyone know that?

g> the cgi.pm stuff earlier seems one half

Please look into WebDAV (and the `cadaver' command-line tool), or
something similar.  This problem has been solved a million times.

Ted


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3422
***************************************


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