如何获得Perl程序输出的文件句柄?(How can get a filehandle for a Perl program's output?)
我有一个加密文件X1,我有一个解密X1的Perl程序P1。 我使用Perl程序p2解析解密的文件。
X1--P1(decrypter) --> X2(plain text file) --p2(parser) --> parse output
我的解析器基于XML :: Parser 。 它可以使用文件句柄解密文件。 现在我得到X2并将其存储在文件系统中并在P2中读取并解析它。 有办法,我可以直接通过P1的输出获取文件句柄,并使用P2中的文件句柄直接解析它,而不需要临时文件?
I have an encrypted file X1, I have a Perl program P1 that decrypts the X1. I am parsing the decrypted file using a Perl program p2.
X1--P1(decrypter) --> X2(plain text file) --p2(parser) --> parse output
My parser is based on XML::Parser. It can work with a filehandle to the decrypted file. Now I am getting the X2 and storing it in the file system and reading it in the P2 and parsing it. Is there way I can directly get the filehandle over the P1's output and use that filehandle in the P2 to parse it directly with out requiring a temporary file?
原文:https://stackoverflow.com/questions/2593014
最满意答案
Twitter Bootstrap 3
如@abimelex的答案所示,输入和按钮可以使用
.input-group
类对齐(请参见http://getbootstrap.com/components/#input-groups-buttons ):组按钮在左侧
<div class="input-group"> <span class="input-group-btn"> <button class="btn btn-default" type="button">Go!</button> </span> <input type="text" class="form-control"> </div>
组按钮在右侧
<div class="input-group"> <input type="text" class="form-control"> <span class="input-group-btn"> <button class="btn btn-default" type="button">Go!</button> </span> </div>
这个解决方案已经被添加,以保持我的答案是最新的,但请坚持你的投票对@abimelex提供的答案 。
Twitter Bootstrap 2
Bootstrap提供了一个
.input-append
类,它作为一个包装元素,并为您修正:<div class="input-append"> <input name="search" id="search"/> <button class="btn">button</button> </div>
正如@OleksiyKhilkevich在他的答案中所指出的那样,使用
.form-horizontal
类来排列input
和button
的第二种方法:<div class="form-horizontal"> <input name="search" id="search"/> <button class="btn">button</button> </div>
差异
这两个类之间的区别在于
.input-append
将button
向上放置input
元素(因此它们看起来像被附加),其中.form-horizontal
将在它们之间放置一个空格。- 注意 -
为了允许
input
和button
元素彼此相邻,没有间距,在.input-append
类中,font-size
已经被设置为0
(这样可以消除inline-block
元素之间的白色间距)。 如果要使用em
或%
测量来覆盖默认值,这可能会对input
元素中的字体大小产生不利影响。Twitter Bootstrap 3
As shown in the answer by @abimelex, inputs and buttons can be aligned by using the
.input-group
classes (see http://getbootstrap.com/components/#input-groups-buttons):Group button on the left side
<div class="input-group"> <span class="input-group-btn"> <button class="btn btn-default" type="button">Go!</button> </span> <input type="text" class="form-control"> </div>
Group button on the right side
<div class="input-group"> <input type="text" class="form-control"> <span class="input-group-btn"> <button class="btn btn-default" type="button">Go!</button> </span> </div>
This solution has been added to keep my answer up to date, but please stick your up-vote on the answer provided by @abimelex.
Twitter Bootstrap 2
Bootstrap offers an
.input-append
class, which works as a wrapper element and corrects this for you:<div class="input-append"> <input name="search" id="search"/> <button class="btn">button</button> </div>
As pointed out by @OleksiyKhilkevich in his answer, there is a second way to align
input
andbutton
by using the.form-horizontal
class:<div class="form-horizontal"> <input name="search" id="search"/> <button class="btn">button</button> </div>
The Differences
The difference between these two classes is that
.input-append
will place thebutton
up against theinput
element (so they look like they are attached), where.form-horizontal
will place a space between them.-- Note --
To allow the
input
andbutton
elements to be next to each other without spacing, thefont-size
has been set to0
in the.input-append
class (this removes the white spacing between theinline-block
elements). This may have an adverse effect on font-sizes in theinput
element if you want to override the defaults usingem
or%
measurements.
相关问答
更多-
http://jsfiddle.net/kv8n7n5g/
引导:将输入与按钮对齐(bootstrap: align input with button)[2022-06-22]
Twitter Bootstrap 3 如@abimelex的答案所示,输入和按钮可以使用.input-group类对齐(请参见http://getbootstrap.com/components/#input-groups-buttons ): 组按钮在左侧< ...好的,首先你需要像使用每月/一次字段一样将周围的div放在Land线元素周围,并且还要制作每月/一次的包装器,因此它们是相同的你只能设置padding-top:0; 到.btn ,图标垂直居中。 这里有一个工作小提琴: https : //jsfiddle.net/sebastianbrosch/rw4eoz6b/ You can set only padding-top:0; to the .btn and the icon is vertically centered. Here a working fiddle: https://jsfiddle.net/sebastianbrosch/rw4eoz6b/使用下面的代码(只需添加display:inline-block&vertical-align:top on textbox和.input-group-btn,增加按钮高度)这就是我做的: .btn-group { flex-wrap: wrap; width: 80px; } button{ width:80px; } 这是JSFiddle演示 I solved the problem using the flex property on the outer .row .row-flex { display: flex; align-items: center; } Image只需将类col-lg-6到按钮div: