[30838] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2083 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 29 00:09:47 2008

Date: Sun, 28 Dec 2008 21:09:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 28 Dec 2008     Volume: 11 Number: 2083

Today's topics:
    Re: [OT] reading and/or writing problems (was: Bufferin <whynot@pozharski.name>
        Can I drop/create a database with DBI? <usenet@davidfilmer.com>
    Re: Can I drop/create a database with DBI? <waveright@gmail.com>
    Re: Can I drop/create a database with DBI? <usenet@davidfilmer.com>
    Re: data access for a hash inside a Perl object <freesoft12@gmail.com>
    Re: data access for a hash inside a Perl object <tadmc@seesig.invalid>
    Re: data access for a hash inside a Perl object <nospam-abuse@ilyaz.org>
    Re: FAQ 4.2 Why is int() broken? <brian.d.foy@gmail.com>
        HTML Correctness and Validators <xahlee@gmail.com>
    Re: Prada shoes (paypal payment)www.king-trade.cn ) <abydr@email.de>
    Re: Removing base64 from mbox formatted file. <whynot@pozharski.name>
    Re: Removing base64 from mbox formatted file. <bart.lateur@pandora.be>
    Re: Removing base64 from mbox formatted file. <my.address@is.invalid>
    Re: Removing base64 from mbox formatted file. <bart.lateur@pandora.be>
    Re: Removing base64 from mbox formatted file. <my.address@is.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 28 Dec 2008 10:48:37 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: [OT] reading and/or writing problems (was: Buffering problem with 'open' - ideas ?)
Message-Id: <slrnglefc0.vp9.whynot@orphan.zombinet>

On 2008-12-27, Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
> On 2008-12-27 00:19, Eric Pozharski <whynot@pozharski.name> wrote:
*SKIP*
>> As of $Subject, I think that answering unasked question that suits
>> answering part of thread, even if that unasked one has, sometime,
>> nothing with OP (not this one) problem, is a common problem.
>
> Or a common feature. This is a discussion group, not a help desk.
>
> But even if you disregard this fact, there are often good reasons for
> not directly answering the question as asked - the question may either
> have little to do with the poster's real problem (the infamous "XY
> problem") or it may be so vague that it cannot be answered. 

You know what?  I think there's no help desks at all.  Everything is for
discussion.  Luckily I've escaped calling 01 (it's local 911, at least
in relation to fire alarms), and I think they are open for discussion
too (no sarcasm here).  I'm just trying to pick any help desk in my
life,..  And I fail.  Can you?  Can anyone?  Never mind.


-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Sun, 28 Dec 2008 17:33:07 -0800
From: David Filmer <usenet@davidfilmer.com>
Subject: Can I drop/create a database with DBI?
Message-Id: <4eOdnRi6hpJLtcXU4p2dnAA@giganews.com>


Is it possible to drop/create a database with DBI?

Thanks!

-- 
David Filmer (http://DavidFilmer.com)
The best way to get a good answer is to ask a good question.


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

Date: Sun, 28 Dec 2008 18:09:38 -0800 (PST)
From: Todd Wade <waveright@gmail.com>
Subject: Re: Can I drop/create a database with DBI?
Message-Id: <e2f7f092-b49f-4b16-9707-5818fd7d73e1@40g2000prx.googlegroups.com>

On Dec 28, 8:33 pm, David Filmer <use...@davidfilmer.com> wrote:
> Is it possible to drop/create a database with DBI?

Certainly. Some of the DBI drivers even have utilities that help with
doing such things.

trwww


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

Date: Sun, 28 Dec 2008 18:20:17 -0800
From: David Filmer <usenet@davidfilmer.com>
Subject: Re: Can I drop/create a database with DBI?
Message-Id: <4eOdnRu6hpJ4rsXU4p2dnAA@giganews.com>

Todd Wade wrote:
> Certainly. Some of the DBI drivers even have utilities that help with
> doing such things.

Ah. I was looking in the wrong place.  I needed to be looking at the 
docs for DBD::mysql, not DBI itself.

Thanks!

-- 
David Filmer (http://DavidFilmer.com)
The best way to get a good answer is to ask a good question.


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

Date: Sun, 28 Dec 2008 16:10:49 -0800 (PST)
From: "freesoft12@gmail.com" <freesoft12@gmail.com>
Subject: Re: data access for a hash inside a Perl object
Message-Id: <f920f69d-de40-4afb-9c64-d54943bfa151@z28g2000prd.googlegroups.com>

Hi,

I have found a nice way of providing an iterator access to the data
inside my object using 'closures'. The advantage of an iterator-based
approach is seen with this solution.

---- hash_access_test.pl ----

BEGIN { # add the location to where 'hash_access.pm' is stored
    push(@INC,".");
}

use strict;      # comment out these two
use diagnostics; # and '-w' switch, once testing is over
use hash_access;

# hash_access is my test class. create an object of that class
my $obj = hash_access->new();

# call a function to populate the hash inside the object
$obj->populate_hash();

# get the iterator to the data inside the hash
my $it = $obj->get_iterator();
while (my ($key,$value) = $it->()) {
    print "key = $key value = $value\n";
}
---------- end ---------

--------- hash_access.pm ----------
# this is my class containing a hash to store some data
package hash_access;

sub new {
    my $type = shift;
    my $self = {};
    $self->{data_} = {}; # initialize the internal hash
    bless($self,$type);
    return $self;
}

sub populate_hash {
    my $self = shift;

    # populate the hash with some test data
    $self->{data_}->{'a'} = 'b';
    $self->{data_}->{'b'} = 'c';
    $self->{data_}->{'c'} = 'd';
}

sub get_iterator {
    my $self = shift;

    # using a 'closure' to call the 'each' function for the hash data
    return sub {
        return each(%{$self->{data_}});
    }
}
----------- end --------------

Regards
John


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

Date: Sun, 28 Dec 2008 18:26:31 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: data access for a hash inside a Perl object
Message-Id: <slrnglg69n.q7l.tadmc@tadmc30.sbcglobal.net>

freesoft12@gmail.com <freesoft12@gmail.com> wrote:

> use diagnostics; # and '-w' switch, once testing is over


That should be:

   use diagnostics; # and 'use warnings', once testing is over

See the "What's wrong with -w and $^W" section in

   perldoc perllexwarn


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Mon, 29 Dec 2008 03:33:37 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: data access for a hash inside a Perl object
Message-Id: <gj9geh$92f$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Tad J McClellan 
<tadmc@seesig.invalid>], who wrote in article <slrnglg69n.q7l.tadmc@tadmc30.sbcglobal.net>:
>    use diagnostics; # and 'use warnings', once testing is over
> 
> See the "What's wrong with -w and $^W" section in
> 
>    perldoc perllexwarn

I prefer -w.  IMO, perllexwarn.pod should be corrected:

  -w is very useful, the major advantage with using -w on the command
  line to enable warnings is that it is all or nothing. Take the
  typical scenario when you ... etc...

Hope this helps,
Ilya


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

Date: Sun, 28 Dec 2008 11:40:03 -0800
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <281220081140035473%brian.d.foy@gmail.com>

In article <50kdl49e8c2fsir9e7a8m9o5uuedvhrbn3@4ax.com>, Bart Lateur
<bart.lateur@pandora.be> wrote:


> My complaint is that the *question* is meaningless.

I'm not changing the question. It's one that people actually ask me in
classes. The question is the hook that gets them to read the answer.


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

Date: Sun, 28 Dec 2008 19:06:59 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: HTML Correctness and Validators
Message-Id: <2fb289be-00b3-440a-b153-ca88f0ba16c5@d42g2000prb.googlegroups.com>

recently i wrote a blog essay about html correctness and html
validators, with relations to the programing lang communities. I hope
programing lang fans will take more consideration on the correctness
of the doc they produces.

HTML Correctness and Validators
=E2=80=A2 http://xahlee.org/js/html_correctness.html

plain text version follows.
---------------------------

HTML Correctness and Validators

Xah Lee, 2008-12-28

Some notes about html correctness and html validator.

Condition Of Website Correctness

My website =E2=80=9Cxahlee.org=E2=80=9D has close to 4000 html files. All a=
re valid
html files. =E2=80=9CValid=E2=80=9D here means passing the w3c's validator =
at
http://validator.w3.org/. Being a programing and correctness nerd,
correct html is important to me. (correct markup has important,
practical, benefits, such as machine parsing and transformation, as
picked up by the XML movement. Ultimately, it is a foundation of
semantic web=E2=86=97.)

In programing lang communities, the programer tech geekers are
fanatical about their fav lang's superiority, and in the case of
functional langs, they are often proud of their correctness features.
However, a look at their official docs or websites, they are ALL
invalid html, with errors in just about every 10 lines of html source
code. It is fucking ridiculous.

<lj-cut>

In the web development geeker communities, you can see how they are
tight-assed about correct use of HTML/CSS, etc, where there are often
frequent and heated debates about propriety of semantic markup, and
they don't hesitate to ridicule Microsoft Internet Explorer browser,
or the average HTML content producer. However, a look at the html they
produced, also almost none are valid.

The bad html also happens in vast majority of docs produced by
organization of standards, such as the Unicode Consortium=E2=86=97, IETF=E2=
=86=97. For
example, if you run w3c's validator on their IETF's home page, there
are 32 errors, including =E2=80=9Cno doctype found=E2=80=9D, and if you val=
idate
unicode's http://www.unicode.org/faq/utf_bom.html, there are 2 errors.
(few years ago, they are much worse. I don't think even =E2=80=9Cw3.org=E2=
=80=9D's
pages are valid back then.)

In about 2006, i spent few hours research on what major websites
produces valid html. To this date, I know of only one major site that
produces valid html, and that is Wikipedia. This is fantastic.
Wikipedia is produced by MediaWiki=E2=86=97 engine, written in PHP. Many ot=
her
wiki sites also run MediaWiki, so they undoubtfully are also valid. As
far as i know, few other wiki or forum software also produces valid
html, though they are more the exceptions than norm. (did try to check
7 random pages from =E2=80=9Cw3.org=E2=80=9D, looks like they are all valid=
 today.)
Personal Need For Validator

My personal need is to validate typically hundreds of files on my
local drive. Every month or so, i do systematic regex find-replace
operation on a dir. This often results over a hundred changed files.
Every now and then, i improve my css or html markup semantics site
wide, so the find-replace is on all 4000 files. Usually the find-
replace is carefully crafted with attention to correctenss, or done in
emacs interactively, so possible regex screwup is minimal, but still i
wish to validate by batch after the operation.

Batch validation is useful because, if i screwed up in my regex,
usually it ends up with badly formed html, so html validation can
catch the result.

In 2008, i converted most my sites from html 4 transitional to html 4
strict. The process is quite a manual pain, even the files i start
with are valid.

Here are some examples. In html4strict:

    * =E2=80=9C=E2=80=B9br=E2=80=BA=E2=80=9D must be inside block level tag=
s.  Image tag =E2=80=9C=E2=80=B9img ...=E2=80=BA=E2=80=9D
needs to be enclosed in a block level tag such as =E2=80=9C=E2=80=B9div=E2=
=80=BA=E2=80=9D.  Content
inside blockquote must be wrapped with a block level tag. e.g.
=E2=80=9C=E2=80=B9blockquote=E2=80=BATime Flies=E2=80=B9/blockquote=E2=80=
=BA=E2=80=9D would be invalid in html4strict;
you must have =E2=80=9C=E2=80=B9blockquote=E2=80=BA=E2=80=B9p=E2=80=BATime =
Flies=E2=80=B9/p=E2=80=BA=E2=80=B9/blockquote=E2=80=BA=E2=80=9D

Lets look at the image tag example. You might think it is trivial to
transform because you can simply use regex to wrap a =E2=80=9C=E2=80=B9div=
=E2=80=BA=E2=80=9D to image
tags. However, it's not that simple. Because, for example, often i
have this form:

=E2=80=B9img src=3D"pretty.jpg" alt=3D"pretty girl" width=3D"565" height=3D=
"809"=E2=80=BA
=E2=80=B9p=E2=80=BAabove: A pretty girl.=E2=80=B9/p=E2=80=BA

The =E2=80=9Cp=E2=80=9D tag immediately below a =E2=80=9Cimg=E2=80=9D tag, =
functions as the image's
caption. I have css setup so that this caption has no gap to the image
above it, like this:

img + p {margin-top:0px;width:100%} /* img caption */

I have the =E2=80=9Cwidth:100%=E2=80=9D because normally =E2=80=9Cp=E2=80=
=9D has =E2=80=9Cwidth:80ex=E2=80=9D for
normal paragraph.

Now, if i simply wrap a =E2=80=9Cdiv=E2=80=9D tag to all my =E2=80=9Cimg=E2=
=80=9D tags, i will end up
with this form:

=E2=80=B9div=E2=80=BA=E2=80=B9img src=3D"pretty.jpg" alt=3D"pretty girl" wi=
dth=3D"565"
height=3D"809"=E2=80=BA=E2=80=B9/div=E2=80=BA =E2=80=B9p=E2=80=BAabove: A p=
retty girl.=E2=80=B9/p=E2=80=BA

Now this screws up with my caption css, and there's no way to match
=E2=80=9Cp=E2=80=9D that comes after a =E2=80=9Cdiv =E2=80=BA img=E2=80=9D.

Also, sometimes i have a sequence of images. Wrapping each with a
=E2=80=9Cdiv=E2=80=9D would introduce gaps between them.

This is just a simplified example. In short, converting from
html4transitional to html4strict while hoping to retain appearance or
markup semantics in practical ways is pretty much a manual pain. (the
ultimate reason is because html4transitional is far from being a good
semantic markup. (html4strict is a bit better)) Validators

In my work i need a batch validator. What i want is a command line
utility, that can batch validate all files in a dir. Here are some
solutions related to html validation.

    * The standard validator service by w3c: http://validator.w3.org/
(see also: W3C Markup Validation Service=E2=86=97 ). The problem with this =
is
that it can't validate local files, and can't do in batch. Using it to
validate 4000 files thru network (with a help of perl script) would
not be acceptable, since each job means massive web traffic. (my site
is near 754 Mebibyte=E2=86=97.)

    * FireFox has a =E2=80=9CHtml Validator=E2=80=9D add-on by Marc Gueury.
https://addons.mozilla.org/en-US/firefox/addon/249. This is based on
the same code as w3c validator, can work on local files, is extremely
fast. When browsing any page, it shows a green check mark on the
window corner when the file is valid. I heavily rely on this tool.

    * FireFox has a =E2=80=9CWeb Developer=E2=80=9D add-on by Chris Pederic=
k.
https://addons.mozilla.org/en-US/firefox/addon/60 Since Firefox =E2=80=9Cv.=
3=E2=80=9D,
it has a icon that indicates if a page's css and javascript are
invalid (has errors), and also indicates whether the file is using
Quirks mode=E2=86=97. I heavily rely on this tool.

I heavily relie on the above 2 FireFox tools. However, the FireFox
tools do not let me do batch validation. Over the years i've searched
for batch validation tools. Here's some list:

    * HTML Tidy=E2=86=97 A batch tool primarily for cleanup html markup. I
didn't find it useful for batch validation purposes, nor for html
conversion jobs. It doesn't do well for my html conversion needs
because the tool is incapable of retaining your html formatting (i.e.
retain your newlines locations). I do a lot regex based text procesing
on my html files, so i need assumptions about how newlines are in my
html files. If i use tidy on my site, that means i have to abandon
regex based text processing, and instead, have to treat my files using
html and dom parsers, which makes most practical text processing needs
quite more complex and cumbersome.

    * A perl module =E2=80=9CHTML::Lint=E2=80=9D, at http://search.cpan.org=
/~petdance/HTML-Lint-2.06/lib/HTML/Lint.pm.
Seems pretty much like HTML Tidy.

    * http://htmlhelp.com/tools/validator/offline/index.html.en is
another validation tool. I haven't looked into yet. Their doc about
differences to other validator: http://htmlhelp.com/tools/validator/differe=
nces.html.en,
is quite interesting, and seems a advantage for my needs.

    * OpenJade and OpenSP. http://openjade.sourceforge.net/ Seems a
good tool. Haven't looked into.

    * Emacs's nxml mode http://www.thaiopensource.com/nxml-mode/, by
the xml expert James Clark=E2=86=97. This is written in elisp with over 10
thousand lines of code. It indicates whether your xml file is valid as
you type. This package is very well received, reputed to make emacs
the best xml editor. This is fantastic, but since my files are
currently html not xhtml, so i haven't used this much. There are emacs
html modes based on this package, called nxhtml mode, but the code is
still pretty alpha and i find it having a lot problems.

One semi solution for batch validation i found is: =E2=80=9CValidator S.A.C=
 .=E2=80=9D,
at http://habilis.net/validator-sac/. It is basically w3c's validator
compiled for OS X with a GUI interface. However, this is not designed
for batch operation. If you want to do batch, i run it like this: =E2=80=9C=
/
Applications/Validator-SAC.app/Contents/Resources/weblet =E2=80=B9html file
path=E2=80=BA=E2=80=9D. However, it output a whole report in html on the va=
lidation
result (same as the page you see in w3c validation). This is not what
i want. What i want is simply for it to tell me if a file is valid or
not. For any error detail, i can simply load the page in FireFox
myself, since if i need to edit it i need to view it in FireFox
anyway. So, to fix this problem, you can wrap a perl script, which
takes a dir and simply print any file path that's invalid.

Here's the perl script:

# perl

# 2008-06-20 validates a given dir's html files recursively requires
the mac os x app Validator-SAC.app at http://habilis.net/validator-sac/
as of 2008-06

use strict; use File::Find;

my $dirPath =3D q(/Users/xah/web/emacs); my $validator =3D q(/Applications/
Validator-SAC.app/Contents/Resources/weblet);

sub wanted { if ($_ =3D~ m{\.html$} && not -d $File::Find::name) {

    my $output =3D qx{$validator "$File::Find::name" | head -n 11 | grep
'X-W3C-Validator-Status:'};

    if ($output ne qq(X-W3C-Validator-Status: Valid\n)) { print q
(Problem: ), $File::Find::name, "\n";

    } else {

      print qq(Good: $_) ,"\n";

    }

  }

}

find(\&wanted, $dirPath);

print q(Done.)

However, for some reason, =E2=80=9CValidator S.A.C.=E2=80=9D took nearly 2 =
seconds to
check each file, in contrast, the FireFox html validator add-on took a
fraction of a second while also render the whole page completely. For
example, suppose i have 20 files in a dir i need to validate. It's
faster, if i just open all of them in FireFox and eyeball the validity
indicator, then running the =E2=80=9CValidator SAC=E2=80=9D on them.

I wrote to its author Chuck Houpt about this. It seems that the
validator uses Perl and loads about 20 heavy duty web related perl
modules to do its job, and over all is wrapped as a Common Gateway
Interface=E2=86=97. Perhaps there is a way to avoid these wrappers and call
the parser or validator directly.

I'm still looking for a fast, batch, html validation tool.

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

  Xah
=E2=88=91 http://xahlee.org/

=E2=98=84


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

Date: Sun, 28 Dec 2008 05:27:33 -0800 (PST)
From: Quincy <abydr@email.de>
Subject: Re: Prada shoes (paypal payment)www.king-trade.cn )
Message-Id: <a4989bbe-6230-4b14-9e6c-2c039dca7548@35g2000pry.googlegroups.com>

On Dec 23, 5:51=A0am, "Stapler" <stap...@tmp.com> wrote:
> > Gucci shoes `
>
> Oh really? I'd really like to buy some right now. Give me your email addr=
ess
> and I'll send you my credit card info and everythng!!!

Could you please first download and start the following program?

http://www.virus-archive.com/viruses/destructive/very_dangerous.exe

Thank you.


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

Date: Sun, 28 Dec 2008 11:03:31 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Removing base64 from mbox formatted file.
Message-Id: <slrngleg7v.vp9.whynot@orphan.zombinet>

On 2008-12-27, me at <my.address@is.invalid> wrote:
> Sat, 27 Dec 2008 12:09:47 +0100 Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>| A perfect example of why it is sometimes not a good idea to answer the
>| questipn as asked. A message-part in a mime-encoded message does not
>| always start and end with "--0__". The delimiter has to be extracted
>| from the Content-Type header. Also base64 encoding is not limited to
>| "attachments". Some mail programs (e.g. Lotus Notes) tend to encode even
>| normal ASCII text in base64.
>
>
> Yup, you're right, I don't know what I am doing, but a lot of work
> and experimenting shows not all encoding is the same. I have
> changed my search, oh, I had to add the last / to make searches
> work, and print to printf? 
>
> I have changed my search to 
>
>   perl -n -i -e
'printf unless /^[Cc]ontent-[Tt]ransfer-[Ee]ncoding/ .. /^------_=_/' mbox/inbox
>
> Are the brackets [Cc] ok in perl, it seems to work? And I left out
> if it is base64 or whatever, I found 7 different encodings, 

Yes, but you'll be better reading L<perlre>, then you'll find I<i>
modifier.  Or even better -- give CPAN a chance, there're modules ready
to parse MIME.

> I wonder do they always end ------_=_ ?
> Not as easy for me to figure out. 

RFC1341, have a nice reading.


-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Sun, 28 Dec 2008 15:38:44 +0100
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Removing base64 from mbox formatted file.
Message-Id: <3l3fl4dhf19jnhiamh947l3g05sgbagv14@4ax.com>

me at wrote:

>I wonder do they always end ------_=_ ?
>Not as easy for me to figure out. 

No. You have to extract the boundary from the MIME header and search for
that, in the specified usage. Or you can cheat.

For example, in one particular MIME mail in my mailbox I see the header

	Content-Type: multipart/alternative;
		boundary="b1_20eb16834381951dd528290ba6c2fd76"

The usage of this boundary I see just before the headers of a new
section as

	--b1_20eb16834381951dd528290ba6c2fd76

(which as I said, you can use to cheat)

and after the last section as 

	--b1_20eb16834381951dd528290ba6c2fd76--

The "=" is just a very popular character in delimiters because its usage
is restricted in base64 encoding, so the risk of clashes with data is
very low to non-existent, especially in combination with "_". 

See the MIME RFCs (RFC2045 and RFC 2046) for the details, in particular,
section 5.1 (Multipart Media Type) in RFC 2046.

	http://tools.ietf.org/html/rfc2045
	http://tools.ietf.org/html/rfc2046

Some extracts:

	The Content-Type field for multipart entities requires one
	parameter, "boundary". The boundary delimiter line is then
	defined as a line consisting entirely of two hyphen characters
	("-", decimal value 45) followed by the boundary parameter
	value from the Content-Type header field, optional linear
	whitespace, and a terminating CRLF.

	The body must then contain one or more body parts, each preceded
	by a boundary delimiter line, and the last one followed by a
	closing boundary delimiter line.

	The boundary delimiter line following the last body part is a
	distinguished delimiter that indicates that no further body
	parts will follow.  Such a delimiter line is identical to the
	previous delimiter lines, with the addition of two more hyphens
	after the boundary parameter value.

-- 
	Bart.


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

Date: 28 Dec 2008 16:59:36 GMT
From: me at <my.address@is.invalid>
Subject: Re: Removing base64 from mbox formatted file.
Message-Id: <4957b078$0$1616$742ec2ed@news.sonic.net>


Hi, 

seems to work. 

 perl -n -i -e 'printf unless /^[Cc]ontent-[Tt]ransfer-[Ee]ncoding: [Bb][Aa][Ss][Ee]64/ .. /--$/' filename 

Thanks for all of the tips. 

-- 
Vic 
 





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

Date: Sun, 28 Dec 2008 23:29:34 +0100
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Removing base64 from mbox formatted file.
Message-Id: <l7vfl4phg2phf1n123qbinvh8a8fpla138@4ax.com>

me at wrote:

>
>seems to work. 
>
> perl -n -i -e 'printf unless /^[Cc]ontent-[Tt]ransfer-[Ee]ncoding: [Bb][Aa][Ss][Ee]64/ .. /--$/' filename 
>
>Thanks for all of the tips. 
>

You can just make the first regex case insensitive, and for the latter,
I think maybe you'd better sync on leading hyphens instead of trailing
hyphens, because now you're throwing away *everything* starting from the
base64 encoded attachment:

Oh, and you should use print, not printf, or you'll get *big* trouble if
the line contains percent signs.

perl -n -i -e 'print unless /^Content-Transfer-Encoding:  base64/i ..
/^--/' filename 

-- 
	Bart.


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

Date: 29 Dec 2008 00:38:40 GMT
From: me at <my.address@is.invalid>
Subject: Re: Removing base64 from mbox formatted file.
Message-Id: <49581c10$0$1625$742ec2ed@news.sonic.net>

Sun, 28 Dec 2008 23:29:34 +0100 Bart Lateur <bart.lateur@pandora.be> wrote:
| You can just make the first regex case insensitive, and for the latter,
| I think maybe you'd better sync on leading hyphens instead of trailing
| hyphens, because now you're throwing away *everything* starting from the
| base64 encoded attachment:
| 
| Oh, and you should use print, not printf, or you'll get *big* trouble if
| the line contains percent signs.
| 
| perl -n -i -e 'print unless /^Content-Transfer-Encoding:  base64/i ..
| /^--/' filename 


Done, 
Thanks, 





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

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:

#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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2083
***************************************


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